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