OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/json-parser.h" | 5 #include "src/json-parser.h" |
6 | 6 |
7 #include "src/char-predicates-inl.h" | 7 #include "src/char-predicates-inl.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 Handle<JSObject> json_object, Handle<Map> map, | 475 Handle<JSObject> json_object, Handle<Map> map, |
476 ZoneList<Handle<Object> >* properties) { | 476 ZoneList<Handle<Object> >* properties) { |
477 JSObject::AllocateStorageForMap(json_object, map); | 477 JSObject::AllocateStorageForMap(json_object, map); |
478 DCHECK(!json_object->map()->is_dictionary_map()); | 478 DCHECK(!json_object->map()->is_dictionary_map()); |
479 | 479 |
480 DisallowHeapAllocation no_gc; | 480 DisallowHeapAllocation no_gc; |
481 | 481 |
482 int length = properties->length(); | 482 int length = properties->length(); |
483 for (int i = 0; i < length; i++) { | 483 for (int i = 0; i < length; i++) { |
484 Handle<Object> value = (*properties)[i]; | 484 Handle<Object> value = (*properties)[i]; |
| 485 // Initializing store. |
485 json_object->WriteToField(i, *value); | 486 json_object->WriteToField(i, *value); |
486 } | 487 } |
487 } | 488 } |
488 | 489 |
489 // Parse a JSON array. Position must be right at '['. | 490 // Parse a JSON array. Position must be right at '['. |
490 template <bool seq_one_byte> | 491 template <bool seq_one_byte> |
491 Handle<Object> JsonParser<seq_one_byte>::ParseJsonArray() { | 492 Handle<Object> JsonParser<seq_one_byte>::ParseJsonArray() { |
492 HandleScope scope(isolate()); | 493 HandleScope scope(isolate()); |
493 ZoneList<Handle<Object> > elements(4, zone()); | 494 ZoneList<Handle<Object> > elements(4, zone()); |
494 DCHECK_EQ(c0_, '['); | 495 DCHECK_EQ(c0_, '['); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 AdvanceSkipWhitespace(); | 804 AdvanceSkipWhitespace(); |
804 return result; | 805 return result; |
805 } | 806 } |
806 | 807 |
807 // Explicit instantiation. | 808 // Explicit instantiation. |
808 template class JsonParser<true>; | 809 template class JsonParser<true>; |
809 template class JsonParser<false>; | 810 template class JsonParser<false>; |
810 | 811 |
811 } // namespace internal | 812 } // namespace internal |
812 } // namespace v8 | 813 } // namespace v8 |
OLD | NEW |