Index: src/compiler/js-builtin-reducer.cc |
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc |
index f028cb70c44fc77dc8339c32968b3d8f51cf509c..b47d8162c9b742e2fd694901103ac9fa6f4c0660 100644 |
--- a/src/compiler/js-builtin-reducer.cc |
+++ b/src/compiler/js-builtin-reducer.cc |
@@ -145,11 +145,16 @@ bool CanInlineArrayResizeOperation(Handle<Map> receiver_map) { |
if (!receiver_map->prototype()->IsJSArray()) return false; |
Handle<JSArray> receiver_prototype(JSArray::cast(receiver_map->prototype()), |
isolate); |
+ // Ensure that all prototypes of the {receiver} are stable. |
+ for (PrototypeIterator it(isolate, receiver_prototype, kStartAtReceiver); |
+ !it.IsAtEnd(); it.Advance()) { |
+ Handle<JSReceiver> current = PrototypeIterator::GetCurrent<JSReceiver>(it); |
+ if (!current->map()->is_stable()) return false; |
+ } |
return receiver_map->instance_type() == JS_ARRAY_TYPE && |
IsFastElementsKind(receiver_map->elements_kind()) && |
!receiver_map->is_dictionary_map() && receiver_map->is_extensible() && |
(!receiver_map->is_prototype_map() || receiver_map->is_stable()) && |
- receiver_prototype->map()->is_stable() && |
isolate->IsFastArrayConstructorPrototypeChainIntact() && |
isolate->IsAnyInitialArrayPrototype(receiver_prototype) && |
!IsReadOnlyLengthDescriptor(receiver_map); |