Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/property-descriptor.h" | 5 #include "src/property-descriptor.h" |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | |
| 7 #include "src/factory.h" | 8 #include "src/factory.h" |
| 8 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 9 #include "src/lookup.h" | 10 #include "src/lookup.h" |
| 10 #include "src/objects-inl.h" | 11 #include "src/objects-inl.h" |
| 11 | 12 |
| 12 namespace v8 { | 13 namespace v8 { |
| 13 namespace internal { | 14 namespace internal { |
| 14 | 15 |
| 15 // Helper function for ToPropertyDescriptor. Comments describe steps for | 16 // Helper function for ToPropertyDescriptor. Comments describe steps for |
| 16 // "enumerable", other properties are handled the same way. | 17 // "enumerable", other properties are handled the same way. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 36 // objects: nothing on the prototype chain, just own fast data properties. | 37 // objects: nothing on the prototype chain, just own fast data properties. |
| 37 // Must not have observable side effects, because the slow path will restart | 38 // Must not have observable side effects, because the slow path will restart |
| 38 // the entire conversion! | 39 // the entire conversion! |
| 39 bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<Object> obj, | 40 bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<Object> obj, |
| 40 PropertyDescriptor* desc) { | 41 PropertyDescriptor* desc) { |
| 41 if (!obj->IsJSObject()) return false; | 42 if (!obj->IsJSObject()) return false; |
| 42 Map* map = Handle<JSObject>::cast(obj)->map(); | 43 Map* map = Handle<JSObject>::cast(obj)->map(); |
| 43 if (map->instance_type() != JS_OBJECT_TYPE) return false; | 44 if (map->instance_type() != JS_OBJECT_TYPE) return false; |
| 44 if (map->is_access_check_needed()) return false; | 45 if (map->is_access_check_needed()) return false; |
| 45 if (map->prototype() != *isolate->initial_object_prototype()) return false; | 46 if (map->prototype() != *isolate->initial_object_prototype()) return false; |
| 47 // During bootstrapping, the object_function_prototype_map hasn't been | |
| 48 // set up yet. | |
| 49 if (isolate->bootstrapper()->IsActive()) return false; | |
|
Jakob Kummerow
2015/10/15 17:08:55
Alternative fix:
Object* empty_prototype_map = is
| |
| 46 if (JSObject::cast(map->prototype())->map() != | 50 if (JSObject::cast(map->prototype())->map() != |
| 47 isolate->native_context()->object_function_prototype_map()) { | 51 isolate->native_context()->object_function_prototype_map()) { |
| 48 return false; | 52 return false; |
| 49 } | 53 } |
| 50 // TODO(jkummerow): support dictionary properties? | 54 // TODO(jkummerow): support dictionary properties? |
| 51 if (map->is_dictionary_map()) return false; | 55 if (map->is_dictionary_map()) return false; |
| 52 Handle<DescriptorArray> descs = | 56 Handle<DescriptorArray> descs = |
| 53 Handle<DescriptorArray>(map->instance_descriptors()); | 57 Handle<DescriptorArray>(map->instance_descriptors()); |
| 54 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 58 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
| 55 PropertyDetails details = descs->GetDetails(i); | 59 PropertyDetails details = descs->GetDetails(i); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 DCHECK(obj->IsJSProxy()); | 216 DCHECK(obj->IsJSProxy()); |
| 213 UNIMPLEMENTED(); | 217 UNIMPLEMENTED(); |
| 214 } | 218 } |
| 215 // 23. Return desc. | 219 // 23. Return desc. |
| 216 return true; | 220 return true; |
| 217 } | 221 } |
| 218 | 222 |
| 219 | 223 |
| 220 } // namespace internal | 224 } // namespace internal |
| 221 } // namespace v8 | 225 } // namespace v8 |
| OLD | NEW |