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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } else { | 427 } else { |
428 transitioning = false; | 428 transitioning = false; |
429 } | 429 } |
430 } | 430 } |
431 | 431 |
432 DCHECK(!transitioning); | 432 DCHECK(!transitioning); |
433 | 433 |
434 // Commit the intermediate state to the object and stop transitioning. | 434 // Commit the intermediate state to the object and stop transitioning. |
435 CommitStateToJsonObject(json_object, map, &properties); | 435 CommitStateToJsonObject(json_object, map, &properties); |
436 | 436 |
437 Runtime::DefineObjectProperty(json_object, key, value, NONE).Check(); | 437 JSObject::DefinePropertyOrElement(json_object, key, value).Check(); |
438 } while (transitioning && MatchSkipWhiteSpace(',')); | 438 } while (transitioning && MatchSkipWhiteSpace(',')); |
439 | 439 |
440 // If we transitioned until the very end, transition the map now. | 440 // If we transitioned until the very end, transition the map now. |
441 if (transitioning) { | 441 if (transitioning) { |
442 CommitStateToJsonObject(json_object, map, &properties); | 442 CommitStateToJsonObject(json_object, map, &properties); |
443 } else { | 443 } else { |
444 while (MatchSkipWhiteSpace(',')) { | 444 while (MatchSkipWhiteSpace(',')) { |
445 HandleScope local_scope(isolate()); | 445 HandleScope local_scope(isolate()); |
446 if (c0_ != '"') return ReportUnexpectedCharacter(); | 446 if (c0_ != '"') return ReportUnexpectedCharacter(); |
447 | 447 |
(...skipping 15 matching lines...) Expand all Loading... |
463 Handle<String> key; | 463 Handle<String> key; |
464 Handle<Object> value; | 464 Handle<Object> value; |
465 | 465 |
466 key = ParseJsonInternalizedString(); | 466 key = ParseJsonInternalizedString(); |
467 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); | 467 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); |
468 | 468 |
469 AdvanceSkipWhitespace(); | 469 AdvanceSkipWhitespace(); |
470 value = ParseJsonValue(); | 470 value = ParseJsonValue(); |
471 if (value.is_null()) return ReportUnexpectedCharacter(); | 471 if (value.is_null()) return ReportUnexpectedCharacter(); |
472 | 472 |
473 Runtime::DefineObjectProperty(json_object, key, value, NONE).Check(); | 473 JSObject::DefinePropertyOrElement(json_object, key, value).Check(); |
474 } | 474 } |
475 } | 475 } |
476 | 476 |
477 if (c0_ != '}') { | 477 if (c0_ != '}') { |
478 return ReportUnexpectedCharacter(); | 478 return ReportUnexpectedCharacter(); |
479 } | 479 } |
480 } | 480 } |
481 AdvanceSkipWhitespace(); | 481 AdvanceSkipWhitespace(); |
482 return scope.CloseAndEscape(json_object); | 482 return scope.CloseAndEscape(json_object); |
483 } | 483 } |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 | 835 |
836 DCHECK_EQ('"', c0_); | 836 DCHECK_EQ('"', c0_); |
837 // Advance past the last '"'. | 837 // Advance past the last '"'. |
838 AdvanceSkipWhitespace(); | 838 AdvanceSkipWhitespace(); |
839 return result; | 839 return result; |
840 } | 840 } |
841 | 841 |
842 } } // namespace v8::internal | 842 } } // namespace v8::internal |
843 | 843 |
844 #endif // V8_JSON_PARSER_H_ | 844 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |