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