| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 Handle<Object> value; | 353 Handle<Object> value; |
| 354 | 354 |
| 355 // Try to follow existing transitions as long as possible. Once we stop | 355 // Try to follow existing transitions as long as possible. Once we stop |
| 356 // transitioning, no transition can be found anymore. | 356 // transitioning, no transition can be found anymore. |
| 357 if (transitioning) { | 357 if (transitioning) { |
| 358 // First check whether there is a single expected transition. If so, try | 358 // First check whether there is a single expected transition. If so, try |
| 359 // to parse it first. | 359 // to parse it first. |
| 360 bool follow_expected = false; | 360 bool follow_expected = false; |
| 361 Handle<Map> target; | 361 Handle<Map> target; |
| 362 if (seq_one_byte) { | 362 if (seq_one_byte) { |
| 363 key = Map::ExpectedTransitionKey(map); | 363 key = TransitionArray::ExpectedTransitionKey(map); |
| 364 follow_expected = !key.is_null() && ParseJsonString(key); | 364 follow_expected = !key.is_null() && ParseJsonString(key); |
| 365 } | 365 } |
| 366 // If the expected transition hits, follow it. | 366 // If the expected transition hits, follow it. |
| 367 if (follow_expected) { | 367 if (follow_expected) { |
| 368 target = Map::ExpectedTransitionTarget(map); | 368 target = TransitionArray::ExpectedTransitionTarget(map); |
| 369 } else { | 369 } else { |
| 370 // If the expected transition failed, parse an internalized string and | 370 // If the expected transition failed, parse an internalized string and |
| 371 // try to find a matching transition. | 371 // try to find a matching transition. |
| 372 key = ParseJsonInternalizedString(); | 372 key = ParseJsonInternalizedString(); |
| 373 if (key.is_null()) return ReportUnexpectedCharacter(); | 373 if (key.is_null()) return ReportUnexpectedCharacter(); |
| 374 | 374 |
| 375 target = Map::FindTransitionToField(map, key); | 375 target = TransitionArray::FindTransitionToField(map, key); |
| 376 // If a transition was found, follow it and continue. | 376 // If a transition was found, follow it and continue. |
| 377 transitioning = !target.is_null(); | 377 transitioning = !target.is_null(); |
| 378 } | 378 } |
| 379 if (c0_ != ':') return ReportUnexpectedCharacter(); | 379 if (c0_ != ':') return ReportUnexpectedCharacter(); |
| 380 | 380 |
| 381 AdvanceSkipWhitespace(); | 381 AdvanceSkipWhitespace(); |
| 382 value = ParseJsonValue(); | 382 value = ParseJsonValue(); |
| 383 if (value.is_null()) return ReportUnexpectedCharacter(); | 383 if (value.is_null()) return ReportUnexpectedCharacter(); |
| 384 | 384 |
| 385 if (transitioning) { | 385 if (transitioning) { |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 787 |
| 788 DCHECK_EQ('"', c0_); | 788 DCHECK_EQ('"', c0_); |
| 789 // Advance past the last '"'. | 789 // Advance past the last '"'. |
| 790 AdvanceSkipWhitespace(); | 790 AdvanceSkipWhitespace(); |
| 791 return result; | 791 return result; |
| 792 } | 792 } |
| 793 | 793 |
| 794 } } // namespace v8::internal | 794 } } // namespace v8::internal |
| 795 | 795 |
| 796 #endif // V8_JSON_PARSER_H_ | 796 #endif // V8_JSON_PARSER_H_ |
| OLD | NEW |