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