Index: src/json-parser.h |
diff --git a/src/json-parser.h b/src/json-parser.h |
index d22cd0da3aa1a97b46ab80f1cc66f25dc28aded0..7265165ac11c37a4960fe49bbf3d03b5ecc460b6 100644 |
--- a/src/json-parser.h |
+++ b/src/json-parser.h |
@@ -43,15 +43,15 @@ namespace internal { |
template <bool seq_ascii> |
class JsonParser BASE_EMBEDDED { |
public: |
- static Handle<Object> Parse(Handle<String> source) { |
- return JsonParser().ParseJson(source); |
+ static Handle<Object> Parse(Handle<String> source, Zone* zone) { |
+ return JsonParser().ParseJson(source, zone); |
} |
static const int kEndOfString = -1; |
private: |
// Parse a string containing a single JSON value. |
- Handle<Object> ParseJson(Handle<String> source); |
+ Handle<Object> ParseJson(Handle<String> source, Zone* zone); |
inline void Advance() { |
position_++; |
@@ -149,6 +149,7 @@ class JsonParser BASE_EMBEDDED { |
} |
inline Isolate* isolate() { return isolate_; } |
+ inline Zone* zone() const { return zone_; } |
static const int kInitialSpecialStringLength = 1024; |
@@ -161,11 +162,14 @@ class JsonParser BASE_EMBEDDED { |
Isolate* isolate_; |
uc32 c0_; |
int position_; |
+ Zone* zone_; |
}; |
template <bool seq_ascii> |
-Handle<Object> JsonParser<seq_ascii>::ParseJson(Handle<String> source) { |
+Handle<Object> JsonParser<seq_ascii>::ParseJson(Handle<String> source, |
+ Zone* zone) { |
isolate_ = source->map()->GetHeap()->isolate(); |
+ zone_ = zone; |
FlattenString(source); |
source_ = source; |
source_length_ = source_->length(); |
@@ -323,7 +327,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() { |
template <bool seq_ascii> |
Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() { |
ZoneScope zone_scope(isolate(), DELETE_ON_EXIT); |
- ZoneList<Handle<Object> > elements(4); |
+ ZoneList<Handle<Object> > elements(4, zone()); |
ASSERT_EQ(c0_, '['); |
AdvanceSkipWhitespace(); |
@@ -331,7 +335,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() { |
do { |
Handle<Object> element = ParseJsonValue(); |
if (element.is_null()) return ReportUnexpectedCharacter(); |
- elements.Add(element); |
+ elements.Add(element, zone()); |
} while (MatchSkipWhiteSpace(',')); |
if (c0_ != ']') { |
return ReportUnexpectedCharacter(); |