Chromium Code Reviews| Index: src/isolate.cc |
| diff --git a/src/isolate.cc b/src/isolate.cc |
| index 79a9020bfc5ab53b8cbb01adc6cd6c64bec40e97..5afa954ce23958b2eb44b05e7bad11b2e35a2cfc 100644 |
| --- a/src/isolate.cc |
| +++ b/src/isolate.cc |
| @@ -2443,6 +2443,43 @@ HTracer* Isolate::GetHTracer() { |
| } |
| +Map* Isolate::get_initial_js_array_map(ElementsKind kind) { |
| + Context* native_context = context()->native_context(); |
| + Object* maybe_map_array = native_context->js_array_maps(); |
| + if (!maybe_map_array->IsUndefined()) { |
| + Object* maybe_transitioned_map = |
| + FixedArray::cast(maybe_map_array)->get(kind); |
| + if (!maybe_transitioned_map->IsUndefined()) { |
| + return Map::cast(maybe_transitioned_map); |
| + } |
| + } |
| + return NULL; |
| +} |
| + |
| + |
| +bool Isolate::IsFastArrayConstructorPrototypeChainIntact() { |
| + Map* root_array_map = |
|
ulan
2013/05/10 14:34:25
Can root_array_map be NULL here?
danno
2013/05/10 14:40:12
Done.
|
| + get_initial_js_array_map(GetInitialFastElementsKind()); |
| + JSObject* initial_array_proto = JSObject::cast(*initial_array_prototype()); |
| + |
| + // Check that the array prototype hasn't been altered WRT empty elements. |
| + if (root_array_map->prototype() != initial_array_proto) return false; |
| + if (initial_array_proto->elements() != heap()->empty_fixed_array()) { |
| + return false; |
| + } |
| + |
| + // Check that the object prototype hasn't been altered WRT empty elements. |
| + JSObject* initial_object_proto = JSObject::cast(*initial_object_prototype()); |
| + Object* root_array_map_proto = initial_array_proto->GetPrototype(); |
| + if (root_array_map_proto != initial_object_proto) return false; |
| + if (initial_object_proto->elements() != heap()->empty_fixed_array()) { |
| + return false; |
| + } |
| + |
| + return initial_object_proto->GetPrototype()->IsNull(); |
| +} |
| + |
| + |
| CodeStubInterfaceDescriptor* |
| Isolate::code_stub_interface_descriptor(int index) { |
| return code_stub_interface_descriptors_ + index; |