OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_JSON_PARSER_H_ | 5 #ifndef V8_JSON_PARSER_H_ |
6 #define V8_JSON_PARSER_H_ | 6 #define V8_JSON_PARSER_H_ |
7 | 7 |
8 #include "src/char-predicates.h" | 8 #include "src/char-predicates.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 // Parse any JSON value. | 257 // Parse any JSON value. |
258 template <bool seq_one_byte> | 258 template <bool seq_one_byte> |
259 Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() { | 259 Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() { |
260 StackLimitCheck stack_check(isolate_); | 260 StackLimitCheck stack_check(isolate_); |
261 if (stack_check.HasOverflowed()) { | 261 if (stack_check.HasOverflowed()) { |
262 isolate_->StackOverflow(); | 262 isolate_->StackOverflow(); |
263 return Handle<Object>::null(); | 263 return Handle<Object>::null(); |
264 } | 264 } |
265 | 265 |
266 if (isolate_->stack_guard()->InterruptRequested()) { | 266 if (stack_check.InterruptRequested()) { |
267 ExecutionAccess access(isolate_); | 267 ExecutionAccess access(isolate_); |
268 // Avoid blocking GC in long running parser (v8:3974). | 268 // Avoid blocking GC in long running parser (v8:3974). |
269 isolate_->stack_guard()->CheckAndHandleGCInterrupt(); | 269 isolate_->stack_guard()->HandleGCInterrupt(); |
270 } | 270 } |
271 | 271 |
272 if (c0_ == '"') return ParseJsonString(); | 272 if (c0_ == '"') return ParseJsonString(); |
273 if ((c0_ >= '0' && c0_ <= '9') || c0_ == '-') return ParseJsonNumber(); | 273 if ((c0_ >= '0' && c0_ <= '9') || c0_ == '-') return ParseJsonNumber(); |
274 if (c0_ == '{') return ParseJsonObject(); | 274 if (c0_ == '{') return ParseJsonObject(); |
275 if (c0_ == '[') return ParseJsonArray(); | 275 if (c0_ == '[') return ParseJsonArray(); |
276 if (c0_ == 'f') { | 276 if (c0_ == 'f') { |
277 if (AdvanceGetChar() == 'a' && AdvanceGetChar() == 'l' && | 277 if (AdvanceGetChar() == 'a' && AdvanceGetChar() == 'l' && |
278 AdvanceGetChar() == 's' && AdvanceGetChar() == 'e') { | 278 AdvanceGetChar() == 's' && AdvanceGetChar() == 'e') { |
279 AdvanceSkipWhitespace(); | 279 AdvanceSkipWhitespace(); |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 | 838 |
839 DCHECK_EQ('"', c0_); | 839 DCHECK_EQ('"', c0_); |
840 // Advance past the last '"'. | 840 // Advance past the last '"'. |
841 AdvanceSkipWhitespace(); | 841 AdvanceSkipWhitespace(); |
842 return result; | 842 return result; |
843 } | 843 } |
844 | 844 |
845 } } // namespace v8::internal | 845 } } // namespace v8::internal |
846 | 846 |
847 #endif // V8_JSON_PARSER_H_ | 847 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |