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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 } | 417 } |
418 } else { | 418 } else { |
419 key = ParseJsonInternalizedString(); | 419 key = ParseJsonInternalizedString(); |
420 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); | 420 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); |
421 | 421 |
422 AdvanceSkipWhitespace(); | 422 AdvanceSkipWhitespace(); |
423 value = ParseJsonValue(); | 423 value = ParseJsonValue(); |
424 if (value.is_null()) return ReportUnexpectedCharacter(); | 424 if (value.is_null()) return ReportUnexpectedCharacter(); |
425 } | 425 } |
426 | 426 |
427 JSObject::SetOwnPropertyIgnoreAttributes( | 427 Runtime::DefineObjectProperty(json_object, key, value, NONE).Check(); |
428 json_object, key, value, NONE).Assert(); | |
429 } while (MatchSkipWhiteSpace(',')); | 428 } while (MatchSkipWhiteSpace(',')); |
430 if (c0_ != '}') { | 429 if (c0_ != '}') { |
431 return ReportUnexpectedCharacter(); | 430 return ReportUnexpectedCharacter(); |
432 } | 431 } |
433 | 432 |
434 // If we transitioned until the very end, transition the map now. | 433 // If we transitioned until the very end, transition the map now. |
435 if (transitioning) { | 434 if (transitioning) { |
436 JSObject::AllocateStorageForMap(json_object, map); | 435 JSObject::AllocateStorageForMap(json_object, map); |
437 int length = properties.length(); | 436 int length = properties.length(); |
438 for (int i = 0; i < length; i++) { | 437 for (int i = 0; i < length; i++) { |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 | 781 |
783 DCHECK_EQ('"', c0_); | 782 DCHECK_EQ('"', c0_); |
784 // Advance past the last '"'. | 783 // Advance past the last '"'. |
785 AdvanceSkipWhitespace(); | 784 AdvanceSkipWhitespace(); |
786 return result; | 785 return result; |
787 } | 786 } |
788 | 787 |
789 } } // namespace v8::internal | 788 } } // namespace v8::internal |
790 | 789 |
791 #endif // V8_JSON_PARSER_H_ | 790 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |