Message from discussion
Reduce stack frame size in JSON.stringify. (issue 11366087)
Received: by 10.58.161.236 with SMTP id xv12mr3101253veb.5.1352124996759;
Mon, 05 Nov 2012 06:16:36 -0800 (PST)
X-BeenThere: v8-dev@googlegroups.com
Received: by 10.220.155.207 with SMTP id t15ls5273871vcw.8.gmail; Mon, 05 Nov
2012 06:16:36 -0800 (PST)
Received: by 10.52.69.77 with SMTP id c13mr2874586vdu.4.1352124996175;
Mon, 05 Nov 2012 06:16:36 -0800 (PST)
Received: by 10.52.69.77 with SMTP id c13mr2874585vdu.4.1352124996164;
Mon, 05 Nov 2012 06:16:36 -0800 (PST)
Return-Path: <3RMqXUBUJAMEjoyvtp1tjvklyl2pl3-oynthps....@2uix4h7xygsz66weerlq.apphosting.bounces.google.com>
Received: from mail-vb0-f71.google.com (mail-vb0-f71.google.com [209.85.212.71])
by gmr-mx.google.com with ESMTPS id dj17si2601042vdb.1.2012.11.05.06.16.36
(version=TLSv1/SSLv3 cipher=OTHER);
Mon, 05 Nov 2012 06:16:36 -0800 (PST)
Received-SPF: pass (google.com: domain of 3RMqXUBUJAMEjoyvtp1tjvklyl2pl3-oynthps....@2uix4h7xygsz66weerlq.apphosting.bounces.google.com designates 209.85.212.71 as permitted sender) client-ip=209.85.212.71;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of 3RMqXUBUJAMEjoyvtp1tjvklyl2pl3-oynthps....@2uix4h7xygsz66weerlq.apphosting.bounces.google.com designates 209.85.212.71 as permitted sender) smtp.mail=3RMqXUBUJAMEjoyvtp1tjvklyl2pl3-oynthps....@2uix4h7xygsz66weerlq.apphosting.bounces.google.com; dkim=pass header...@chromium.org
Received: by mail-vb0-f71.google.com with SMTP id k17so10412456vbj.2
for <v8-dev@googlegroups.com>; Mon, 05 Nov 2012 06:16:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=chromium.org; s=google;
h=mime-version:reply-to:x-google-appengine-app-id:message-id:date
:subject:from:to:cc:content-type;
bh=ajBuGqcHHrtcWDnXXVq0283KO3o6kURXARNlmVfGCCg=;
b=lrLX5Eb7N7k+BDgMNj0Ms3HtUdTZ9Nz+1W2QAZ2HC1sKvqKUBAvxZlH07sn7rTSdn5
KY5qSQKG/6Nm9Fsr3BG6Z6i4yDivT6270PpSfbnpxfzGAj0i9l0Mnrf5ix0QczUf68pd
nrM4ueUen7LRVjt6SEcrrbOVxEpMDmZ9Fbn4A=
MIME-Version: 1.0
Received: by 10.58.59.73 with SMTP id x9mr3201223veq.39.1352124996049; Mon, 05
Nov 2012 06:16:36 -0800 (PST)
Reply-To: yang...@chromium.org, verwa...@chromium.org, v8-dev@googlegroups.com
Message-ID: <047d7b5d451614dbe004cdc02...@google.com>
Date: Mon, 05 Nov 2012 14:16:36 +0000
Subject: Reduce stack frame size in JSON.stringify. (issue 11366087)
From: yang...@chromium.org
To: verwa...@chromium.org
Cc: v8-dev@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
Reviewers: Toon Verwaest,
Message:
PTAL.
Description:
Reduce stack frame size in JSON.stringify.
BUG=
Please review this at http://codereview.chromium.org/11366087/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/json-stringifier.h
Index: src/json-stringifier.h
diff --git a/src/json-stringifier.h b/src/json-stringifier.h
index
f083ff4916856f820ed8048ffb132ca7803b11d2..1aa72b71b4e08a3f519696488cb2efe2ed3fd0d4
100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -567,28 +567,26 @@ BasicJsonStringifier::Result
BasicJsonStringifier::SerializeJSObject(
if (object->HasFastProperties() &&
!object->HasIndexedInterceptor() &&
!object->HasNamedInterceptor() &&
- object->elements() == isolate_->heap()->empty_fixed_array()) {
- Handle<DescriptorArray> descs(
- object->map()->instance_descriptors(), isolate_);
- int num_desc = object->map()->NumberOfOwnDescriptors();
+ object->elements()->length() == 0) {
Handle<Map> map(object->map());
- bool map_changed = false;
+ int num_desc = map->NumberOfOwnDescriptors();
for (int i = 0; i < num_desc; i++) {
- Handle<String> key(descs->GetKey(i), isolate_);
- PropertyDetails details = descs->GetDetails(i);
+ Handle<String> key(map->instance_descriptors()->GetKey(i), isolate_);
+ PropertyDetails details = map->instance_descriptors()->GetDetails(i);
if (details.IsDontEnum() || details.IsDeleted()) continue;
Handle<Object> property;
- if (details.type() == FIELD && !map_changed) {
+ if (details.type() == FIELD && *map == object->map()) {
property = Handle<Object>(
- object->FastPropertyAt(descs->GetFieldIndex(i)), isolate_);
+ object->FastPropertyAt(
+ map->instance_descriptors()->GetFieldIndex(i)),
+ isolate_);
} else {
property = GetProperty(object, key);
+ if (property.is_null()) return EXCEPTION;
}
- if (property.is_null()) return EXCEPTION;
Result result = SerializeProperty(property, comma, key);
if (!comma && result == SUCCESS) comma = true;
if (result >= EXCEPTION) return result;
- if (*map != object->map()) map_changed = true;
}
} else {
bool has_exception = false;