summaryrefslogtreecommitdiff
path: root/deps/v8/src
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2013-04-03 22:11:32 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2013-04-03 22:11:32 +0400
commit55d058e624984fa5362203ba6a2bc7e033a4003b (patch)
tree61b20a0d6f28a9d67bd90d957c1dcee6186de45c /deps/v8/src
parent88686aa4106499a603365b887e2381b55c61c027 (diff)
downloadnode-55d058e624984fa5362203ba6a2bc7e033a4003b.tar.gz
v8: cherry-pick 75311294 from upstream
Quote from commit message: Create a new HandleScope for each JSON-parsed object to avoid excessive growth.
Diffstat (limited to 'deps/v8/src')
-rw-r--r--deps/v8/src/json-parser.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/deps/v8/src/json-parser.h b/deps/v8/src/json-parser.h
index 03ed22d70..ebe3db138 100644
--- a/deps/v8/src/json-parser.h
+++ b/deps/v8/src/json-parser.h
@@ -287,6 +287,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonValue() {
// Parse a JSON object. Position must be right at '{'.
template <bool seq_ascii>
Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
+ HandleScope scope;
Handle<Object> prototype;
Handle<JSObject> json_object =
factory()->NewJSObject(object_constructor());
@@ -360,12 +361,13 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
if (!prototype.is_null()) SetPrototype(json_object, prototype);
}
AdvanceSkipWhitespace();
- return json_object;
+ return scope.CloseAndEscape(json_object);
}
// Parse a JSON array. Position must be right at '['.
template <bool seq_ascii>
Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() {
+ HandleScope scope;
ZoneScope zone_scope(zone(), DELETE_ON_EXIT);
ZoneList<Handle<Object> > elements(4, zone());
ASSERT_EQ(c0_, '[');
@@ -388,7 +390,8 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() {
for (int i = 0, n = elements.length(); i < n; i++) {
fast_elements->set(i, *elements[i]);
}
- return factory()->NewJSArrayWithElements(fast_elements);
+ Handle<Object> json_array = factory()->NewJSArrayWithElements(fast_elements);
+ return scope.CloseAndEscape(json_array);
}