| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 471 } |
| 472 | 472 |
| 473 template <bool seq_one_byte> | 473 template <bool seq_one_byte> |
| 474 void JsonParser<seq_one_byte>::CommitStateToJsonObject( | 474 void JsonParser<seq_one_byte>::CommitStateToJsonObject( |
| 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 DescriptorArray* descriptors = map->instance_descriptors(); |
| 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 // Initializing store. |
| 486 json_object->WriteToField(i, *value); | 486 json_object->WriteToField(i, descriptors->GetDetails(i), *value); |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 | 489 |
| 490 // Parse a JSON array. Position must be right at '['. | 490 // Parse a JSON array. Position must be right at '['. |
| 491 template <bool seq_one_byte> | 491 template <bool seq_one_byte> |
| 492 Handle<Object> JsonParser<seq_one_byte>::ParseJsonArray() { | 492 Handle<Object> JsonParser<seq_one_byte>::ParseJsonArray() { |
| 493 HandleScope scope(isolate()); | 493 HandleScope scope(isolate()); |
| 494 ZoneList<Handle<Object> > elements(4, zone()); | 494 ZoneList<Handle<Object> > elements(4, zone()); |
| 495 DCHECK_EQ(c0_, '['); | 495 DCHECK_EQ(c0_, '['); |
| 496 | 496 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 AdvanceSkipWhitespace(); | 804 AdvanceSkipWhitespace(); |
| 805 return result; | 805 return result; |
| 806 } | 806 } |
| 807 | 807 |
| 808 // Explicit instantiation. | 808 // Explicit instantiation. |
| 809 template class JsonParser<true>; | 809 template class JsonParser<true>; |
| 810 template class JsonParser<false>; | 810 template class JsonParser<false>; |
| 811 | 811 |
| 812 } // namespace internal | 812 } // namespace internal |
| 813 } // namespace v8 | 813 } // namespace v8 |
| OLD | NEW |