| 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/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/char-predicates-inl.h" | 10 #include "src/char-predicates-inl.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 // Parse any JSON value. | 255 // Parse any JSON value. |
| 256 template <bool seq_one_byte> | 256 template <bool seq_one_byte> |
| 257 Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() { | 257 Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() { |
| 258 StackLimitCheck stack_check(isolate_); | 258 StackLimitCheck stack_check(isolate_); |
| 259 if (stack_check.HasOverflowed()) { | 259 if (stack_check.HasOverflowed()) { |
| 260 isolate_->StackOverflow(); | 260 isolate_->StackOverflow(); |
| 261 return Handle<Object>::null(); | 261 return Handle<Object>::null(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 if (isolate_->stack_guard()->InterruptRequested()) { |
| 265 // Avoid blocking GC in long running parser (v8:3974). |
| 266 isolate_->stack_guard()->CheckAndHandleGCInterrupt(); |
| 267 } |
| 268 |
| 264 if (c0_ == '"') return ParseJsonString(); | 269 if (c0_ == '"') return ParseJsonString(); |
| 265 if ((c0_ >= '0' && c0_ <= '9') || c0_ == '-') return ParseJsonNumber(); | 270 if ((c0_ >= '0' && c0_ <= '9') || c0_ == '-') return ParseJsonNumber(); |
| 266 if (c0_ == '{') return ParseJsonObject(); | 271 if (c0_ == '{') return ParseJsonObject(); |
| 267 if (c0_ == '[') return ParseJsonArray(); | 272 if (c0_ == '[') return ParseJsonArray(); |
| 268 if (c0_ == 'f') { | 273 if (c0_ == 'f') { |
| 269 if (AdvanceGetChar() == 'a' && AdvanceGetChar() == 'l' && | 274 if (AdvanceGetChar() == 'a' && AdvanceGetChar() == 'l' && |
| 270 AdvanceGetChar() == 's' && AdvanceGetChar() == 'e') { | 275 AdvanceGetChar() == 's' && AdvanceGetChar() == 'e') { |
| 271 AdvanceSkipWhitespace(); | 276 AdvanceSkipWhitespace(); |
| 272 return factory()->false_value(); | 277 return factory()->false_value(); |
| 273 } | 278 } |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 792 |
| 788 DCHECK_EQ('"', c0_); | 793 DCHECK_EQ('"', c0_); |
| 789 // Advance past the last '"'. | 794 // Advance past the last '"'. |
| 790 AdvanceSkipWhitespace(); | 795 AdvanceSkipWhitespace(); |
| 791 return result; | 796 return result; |
| 792 } | 797 } |
| 793 | 798 |
| 794 } } // namespace v8::internal | 799 } } // namespace v8::internal |
| 795 | 800 |
| 796 #endif // V8_JSON_PARSER_H_ | 801 #endif // V8_JSON_PARSER_H_ |
| OLD | NEW |