Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: src/json-parser.h

Issue 7374002: Refactor allocation policies. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/isolate.cc ('k') | src/jsregexp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 Handle<Object> ParseJsonArray(); 142 Handle<Object> ParseJsonArray();
143 143
144 144
145 // Mark that a parsing error has happened at the current token, and 145 // Mark that a parsing error has happened at the current token, and
146 // return a null handle. Primarily for readability. 146 // return a null handle. Primarily for readability.
147 inline Handle<Object> ReportUnexpectedCharacter() { 147 inline Handle<Object> ReportUnexpectedCharacter() {
148 return Handle<Object>::null(); 148 return Handle<Object>::null();
149 } 149 }
150 150
151 inline Isolate* isolate() { return isolate_; } 151 inline Isolate* isolate() { return isolate_; }
152 inline Zone* zone() { return isolate_->zone(); }
152 153
153 static const int kInitialSpecialStringLength = 1024; 154 static const int kInitialSpecialStringLength = 1024;
154 155
155 156
156 private: 157 private:
157 Handle<String> source_; 158 Handle<String> source_;
158 int source_length_; 159 int source_length_;
159 Handle<SeqAsciiString> seq_source_; 160 Handle<SeqAsciiString> seq_source_;
160 161
161 Isolate* isolate_; 162 Isolate* isolate_;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 315 }
315 } 316 }
316 AdvanceSkipWhitespace(); 317 AdvanceSkipWhitespace();
317 return json_object; 318 return json_object;
318 } 319 }
319 320
320 // Parse a JSON array. Position must be right at '['. 321 // Parse a JSON array. Position must be right at '['.
321 template <bool seq_ascii> 322 template <bool seq_ascii>
322 Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() { 323 Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() {
323 ZoneScope zone_scope(isolate(), DELETE_ON_EXIT); 324 ZoneScope zone_scope(isolate(), DELETE_ON_EXIT);
324 ZoneList<Handle<Object> > elements(4); 325 ZoneList<Handle<Object> > elements(zone(), 4);
325 ASSERT_EQ(c0_, '['); 326 ASSERT_EQ(c0_, '[');
326 327
327 AdvanceSkipWhitespace(); 328 AdvanceSkipWhitespace();
328 if (c0_ != ']') { 329 if (c0_ != ']') {
329 do { 330 do {
330 Handle<Object> element = ParseJsonValue(); 331 Handle<Object> element = ParseJsonValue();
331 if (element.is_null()) return ReportUnexpectedCharacter(); 332 if (element.is_null()) return ReportUnexpectedCharacter();
332 elements.Add(element); 333 elements.Add(element);
333 } while (MatchSkipWhiteSpace(',')); 334 } while (MatchSkipWhiteSpace(','));
334 if (c0_ != ']') { 335 if (c0_ != ']') {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 } 590 }
590 ASSERT_EQ('"', c0_); 591 ASSERT_EQ('"', c0_);
591 // Advance past the last '"'. 592 // Advance past the last '"'.
592 AdvanceSkipWhitespace(); 593 AdvanceSkipWhitespace();
593 return result; 594 return result;
594 } 595 }
595 596
596 } } // namespace v8::internal 597 } } // namespace v8::internal
597 598
598 #endif // V8_JSON_PARSER_H_ 599 #endif // V8_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/jsregexp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698