Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index 335e687c0b50070c0889cf3bae0de83884962121..a3f99e4ce80946b14e6179f25f02686152f8a788 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -1234,26 +1234,6 @@ MaybeObject* StoreIC::Store(Handle<Object> object, |
return *result; |
} |
- // Use specialized code for setting the length of arrays with fast |
- // properties. Slow properties might indicate redefinition of the length |
- // property. Note that when redefined using Object.freeze, it's possible |
- // to have fast properties but a read-only length. |
- if (FLAG_use_ic && |
- receiver->IsJSArray() && |
- name->Equals(isolate()->heap()->length_string()) && |
- Handle<JSArray>::cast(receiver)->AllowsSetElementsLength() && |
- receiver->HasFastProperties() && |
- !receiver->map()->is_frozen()) { |
- Handle<Code> stub = |
- StoreArrayLengthStub(kind(), strict_mode()).GetCode(isolate()); |
- set_target(*stub); |
- TRACE_IC("StoreIC", name); |
- Handle<Object> result = JSReceiver::SetProperty( |
- receiver, name, value, NONE, strict_mode(), store_mode); |
- RETURN_IF_EMPTY_HANDLE(isolate(), result); |
- return *result; |
- } |
- |
LookupResult lookup(isolate()); |
bool can_store = LookupForWrite(receiver, name, value, &lookup, this); |
if (!can_store && |
@@ -1404,6 +1384,17 @@ Handle<Code> StoreIC::CompileHandler(LookupResult* lookup, |
// TODO(dcarney): Handle correctly. |
if (callback->IsDeclaredAccessorInfo()) break; |
ASSERT(callback->IsForeign()); |
+ |
+ // Use specialized code for setting the length of arrays with fast |
+ // properties. Slow properties might indicate redefinition of the length |
+ // property. |
+ if (receiver->IsJSArray() && |
+ name->Equals(isolate()->heap()->length_string()) && |
+ Handle<JSArray>::cast(receiver)->AllowsSetElementsLength() && |
+ receiver->HasFastProperties()) { |
+ return compiler.CompileStoreArrayLength(receiver, lookup, name); |
+ } |
+ |
// No IC support for old-style native accessors. |
break; |
} |