Chromium Code Reviews| 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-inl.h" | 8 #include "src/isolate-inl.h" |
| 9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 isolate->factory()->NewFixedArray(max_number_of_properties); | 200 isolate->factory()->NewFixedArray(max_number_of_properties); |
| 201 | 201 |
| 202 info = *data; | 202 info = *data; |
| 203 while (info != nullptr) { | 203 while (info != nullptr) { |
| 204 // Accumulate accessors. | 204 // Accumulate accessors. |
| 205 Object* maybe_properties = info->property_accessors(); | 205 Object* maybe_properties = info->property_accessors(); |
| 206 if (!maybe_properties->IsUndefined(isolate)) { | 206 if (!maybe_properties->IsUndefined(isolate)) { |
| 207 valid_descriptors = AccessorInfo::AppendUnique( | 207 valid_descriptors = AccessorInfo::AppendUnique( |
| 208 handle(maybe_properties, isolate), array, valid_descriptors); | 208 handle(maybe_properties, isolate), array, valid_descriptors); |
| 209 } | 209 } |
| 210 info = info->GetParent(isolate); | 210 // Make sure to use the handle since AppendUnique above might have caused |
| 211 // a GC. | |
| 212 info = data->GetParent(isolate); | |
|
Michael Lippautz
2016/08/26 09:22:25
Let me know if this is fine or you'd prefer a loop
| |
| 211 } | 213 } |
| 212 | 214 |
| 213 // Install accumulated accessors. | 215 // Install accumulated accessors. |
| 214 for (int i = 0; i < valid_descriptors; i++) { | 216 for (int i = 0; i < valid_descriptors; i++) { |
| 215 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); | 217 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); |
| 216 JSObject::SetAccessor(obj, accessor).Assert(); | 218 JSObject::SetAccessor(obj, accessor).Assert(); |
| 217 } | 219 } |
| 218 } | 220 } |
| 219 | 221 |
| 220 Object* maybe_property_list = data->property_list(); | 222 Object* maybe_property_list = data->property_list(); |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 711 if (!obj->instance_call_handler()->IsUndefined(isolate)) { | 713 if (!obj->instance_call_handler()->IsUndefined(isolate)) { |
| 712 map->set_is_callable(); | 714 map->set_is_callable(); |
| 713 map->set_is_constructor(true); | 715 map->set_is_constructor(true); |
| 714 } | 716 } |
| 715 | 717 |
| 716 return result; | 718 return result; |
| 717 } | 719 } |
| 718 | 720 |
| 719 } // namespace internal | 721 } // namespace internal |
| 720 } // namespace v8 | 722 } // namespace v8 |
| OLD | NEW |