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/value-serializer.h" | 5 #include "src/value-serializer.h" |
6 | 6 |
7 #include <type_traits> | 7 #include <type_traits> |
8 | 8 |
9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 // Copies a vector of property values into an object, given the map that should | 1588 // Copies a vector of property values into an object, given the map that should |
1589 // be used. | 1589 // be used. |
1590 static void CommitProperties(Handle<JSObject> object, Handle<Map> map, | 1590 static void CommitProperties(Handle<JSObject> object, Handle<Map> map, |
1591 const std::vector<Handle<Object>>& properties) { | 1591 const std::vector<Handle<Object>>& properties) { |
1592 JSObject::AllocateStorageForMap(object, map); | 1592 JSObject::AllocateStorageForMap(object, map); |
1593 DCHECK(!object->map()->is_dictionary_map()); | 1593 DCHECK(!object->map()->is_dictionary_map()); |
1594 | 1594 |
1595 DisallowHeapAllocation no_gc; | 1595 DisallowHeapAllocation no_gc; |
1596 DescriptorArray* descriptors = object->map()->instance_descriptors(); | 1596 DescriptorArray* descriptors = object->map()->instance_descriptors(); |
1597 for (unsigned i = 0; i < properties.size(); i++) { | 1597 for (unsigned i = 0; i < properties.size(); i++) { |
| 1598 // Initializing store. |
1598 object->WriteToField(i, descriptors->GetDetails(i), *properties[i]); | 1599 object->WriteToField(i, descriptors->GetDetails(i), *properties[i]); |
1599 } | 1600 } |
1600 } | 1601 } |
1601 | 1602 |
1602 Maybe<uint32_t> ValueDeserializer::ReadJSObjectProperties( | 1603 Maybe<uint32_t> ValueDeserializer::ReadJSObjectProperties( |
1603 Handle<JSObject> object, SerializationTag end_tag, | 1604 Handle<JSObject> object, SerializationTag end_tag, |
1604 bool can_use_transitions) { | 1605 bool can_use_transitions) { |
1605 uint32_t num_properties = 0; | 1606 uint32_t num_properties = 0; |
1606 | 1607 |
1607 // Fast path (following map transitions). | 1608 // Fast path (following map transitions). |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 if (stack.size() != 1) { | 1872 if (stack.size() != 1) { |
1872 isolate_->Throw(*isolate_->factory()->NewError( | 1873 isolate_->Throw(*isolate_->factory()->NewError( |
1873 MessageTemplate::kDataCloneDeserializationError)); | 1874 MessageTemplate::kDataCloneDeserializationError)); |
1874 return MaybeHandle<Object>(); | 1875 return MaybeHandle<Object>(); |
1875 } | 1876 } |
1876 return scope.CloseAndEscape(stack[0]); | 1877 return scope.CloseAndEscape(stack[0]); |
1877 } | 1878 } |
1878 | 1879 |
1879 } // namespace internal | 1880 } // namespace internal |
1880 } // namespace v8 | 1881 } // namespace v8 |
OLD | NEW |