| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 Handle<Object> value = ParseJsonValue(); | 341 Handle<Object> value = ParseJsonValue(); |
| 342 if (value.is_null()) return ReportUnexpectedCharacter(); | 342 if (value.is_null()) return ReportUnexpectedCharacter(); |
| 343 | 343 |
| 344 JSObject::SetOwnElement(json_object, index, value, SLOPPY).Assert(); | 344 JSObject::SetOwnElement(json_object, index, value, SLOPPY).Assert(); |
| 345 continue; | 345 continue; |
| 346 } | 346 } |
| 347 // Not an index, fallback to the slow path. | 347 // Not an index, fallback to the slow path. |
| 348 } | 348 } |
| 349 | 349 |
| 350 position_ = start_position; | 350 position_ = start_position; |
| 351 #ifdef DEBUG | 351 #if DCHECK_IS_ON |
| 352 c0_ = '"'; | 352 c0_ = '"'; |
| 353 #endif | 353 #endif |
| 354 | 354 |
| 355 Handle<String> key; | 355 Handle<String> key; |
| 356 Handle<Object> value; | 356 Handle<Object> value; |
| 357 | 357 |
| 358 // Try to follow existing transitions as long as possible. Once we stop | 358 // Try to follow existing transitions as long as possible. Once we stop |
| 359 // transitioning, no transition can be found anymore. | 359 // transitioning, no transition can be found anymore. |
| 360 if (transitioning) { | 360 if (transitioning) { |
| 361 // First check whether there is a single expected transition. If so, try | 361 // First check whether there is a single expected transition. If so, try |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 Object* element = string_table->KeyAt(entry); | 762 Object* element = string_table->KeyAt(entry); |
| 763 if (element == isolate()->heap()->undefined_value()) { | 763 if (element == isolate()->heap()->undefined_value()) { |
| 764 // Lookup failure. | 764 // Lookup failure. |
| 765 result = factory()->InternalizeOneByteString( | 765 result = factory()->InternalizeOneByteString( |
| 766 seq_source_, position_, length); | 766 seq_source_, position_, length); |
| 767 break; | 767 break; |
| 768 } | 768 } |
| 769 if (element != isolate()->heap()->the_hole_value() && | 769 if (element != isolate()->heap()->the_hole_value() && |
| 770 String::cast(element)->IsOneByteEqualTo(string_vector)) { | 770 String::cast(element)->IsOneByteEqualTo(string_vector)) { |
| 771 result = Handle<String>(String::cast(element), isolate()); | 771 result = Handle<String>(String::cast(element), isolate()); |
| 772 #ifdef DEBUG | 772 #if DCHECK_IS_ON |
| 773 uint32_t hash_field = | 773 uint32_t hash_field = |
| 774 (hash << String::kHashShift) | String::kIsNotArrayIndexMask; | 774 (hash << String::kHashShift) | String::kIsNotArrayIndexMask; |
| 775 DCHECK_EQ(static_cast<int>(result->Hash()), | 775 DCHECK_EQ(static_cast<int>(result->Hash()), |
| 776 static_cast<int>(hash_field >> String::kHashShift)); | 776 static_cast<int>(hash_field >> String::kHashShift)); |
| 777 #endif | 777 #endif |
| 778 break; | 778 break; |
| 779 } | 779 } |
| 780 entry = StringTable::NextProbe(entry, count++, capacity); | 780 entry = StringTable::NextProbe(entry, count++, capacity); |
| 781 } | 781 } |
| 782 position_ = position; | 782 position_ = position; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 812 | 812 |
| 813 DCHECK_EQ('"', c0_); | 813 DCHECK_EQ('"', c0_); |
| 814 // Advance past the last '"'. | 814 // Advance past the last '"'. |
| 815 AdvanceSkipWhitespace(); | 815 AdvanceSkipWhitespace(); |
| 816 return result; | 816 return result; |
| 817 } | 817 } |
| 818 | 818 |
| 819 } } // namespace v8::internal | 819 } } // namespace v8::internal |
| 820 | 820 |
| 821 #endif // V8_JSON_PARSER_H_ | 821 #endif // V8_JSON_PARSER_H_ |
| OLD | NEW |