OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/api-natives.h" | 5 #include "src/api-natives.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // Disable access checks while instantiating the object. | 144 // Disable access checks while instantiating the object. |
145 AccessCheckDisableScope access_check_scope(isolate, obj); | 145 AccessCheckDisableScope access_check_scope(isolate, obj); |
146 | 146 |
147 int i = 0; | 147 int i = 0; |
148 for (int c = 0; c < data->number_of_properties(); c++) { | 148 for (int c = 0; c < data->number_of_properties(); c++) { |
149 auto name = handle(Name::cast(properties.get(i++)), isolate); | 149 auto name = handle(Name::cast(properties.get(i++)), isolate); |
150 PropertyDetails details(Smi::cast(properties.get(i++))); | 150 PropertyDetails details(Smi::cast(properties.get(i++))); |
151 PropertyAttributes attributes = details.attributes(); | 151 PropertyAttributes attributes = details.attributes(); |
152 PropertyKind kind = details.kind(); | 152 PropertyKind kind = details.kind(); |
153 | 153 |
154 if (obj->map()->owns_descriptors() && | |
155 obj->map()->instance_descriptors()->length() != 0 && | |
156 obj->map()->instance_descriptors()->NumberOfSlackDescriptors() == 0 && | |
157 TransitionArray::SearchTransition(obj->map(), kind, *name, | |
158 attributes) == NULL) { | |
159 Map::EnsureDescriptorSlack(handle(obj->map()), | |
160 data->number_of_properties() - c); | |
161 } | |
162 | |
163 if (kind == kData) { | 154 if (kind == kData) { |
164 auto prop_data = handle(properties.get(i++), isolate); | 155 auto prop_data = handle(properties.get(i++), isolate); |
165 | 156 |
166 RETURN_ON_EXCEPTION(isolate, DefineDataProperty(isolate, obj, name, | 157 RETURN_ON_EXCEPTION(isolate, DefineDataProperty(isolate, obj, name, |
167 prop_data, attributes), | 158 prop_data, attributes), |
168 JSObject); | 159 JSObject); |
169 } else { | 160 } else { |
170 auto getter = handle(properties.get(i++), isolate); | 161 auto getter = handle(properties.get(i++), isolate); |
171 auto setter = handle(properties.get(i++), isolate); | 162 auto setter = handle(properties.get(i++), isolate); |
172 RETURN_ON_EXCEPTION(isolate, | 163 RETURN_ON_EXCEPTION(isolate, |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); | 561 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); |
571 JSObject::SetAccessor(result, accessor).Assert(); | 562 JSObject::SetAccessor(result, accessor).Assert(); |
572 } | 563 } |
573 | 564 |
574 DCHECK(result->shared()->IsApiFunction()); | 565 DCHECK(result->shared()->IsApiFunction()); |
575 return result; | 566 return result; |
576 } | 567 } |
577 | 568 |
578 } // namespace internal | 569 } // namespace internal |
579 } // namespace v8 | 570 } // namespace v8 |
OLD | NEW |