Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index 9dccca4f577308064bc42a01b87f9159ab38fd31..d7f0f3251c86b20106ba3fba360b80df24563ad9 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -1450,6 +1450,7 @@ void StoreIC::UpdateCaches(LookupResult* lookup, |
// Compute the code stub for this store; used for rewriting to |
// monomorphic state and making sure that the code stub is in the |
// stub cache. |
+ Handle<JSObject> holder(lookup->holder()); |
Handle<Code> code; |
switch (type) { |
case FIELD: |
@@ -1477,19 +1478,30 @@ void StoreIC::UpdateCaches(LookupResult* lookup, |
code = isolate()->stub_cache()->ComputeStoreGlobal( |
name, global, cell, strict_mode); |
} else { |
- if (lookup->holder() != *receiver) return; |
+ if (!holder.is_identical_to(receiver)) return; |
code = isolate()->stub_cache()->ComputeStoreNormal(strict_mode); |
} |
break; |
case CALLBACKS: { |
- Handle<Object> callback_object(lookup->GetCallbackObject()); |
- if (!callback_object->IsAccessorInfo()) return; |
- Handle<AccessorInfo> callback = |
- Handle<AccessorInfo>::cast(callback_object); |
- if (v8::ToCData<Address>(callback->setter()) == 0) return; |
- ASSERT(callback->IsCompatibleReceiver(*receiver)); |
- code = isolate()->stub_cache()->ComputeStoreCallback( |
- name, receiver, callback, strict_mode); |
+ Handle<Object> callback(lookup->GetCallbackObject()); |
+ if (callback->IsAccessorInfo()) { |
+ Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback); |
+ if (v8::ToCData<Address>(info->setter()) == 0) return; |
+ ASSERT(info->IsCompatibleReceiver(*receiver)); |
+ code = isolate()->stub_cache()->ComputeStoreCallback( |
+ name, receiver, info, strict_mode); |
+ } else if (callback->IsAccessorPair()) { |
+ Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter()); |
+ if (!setter->IsJSFunction()) return; |
+ if (holder->IsGlobalObject()) return; |
+ if (!receiver->HasFastProperties()) return; |
+ code = isolate()->stub_cache()->ComputeStoreViaSetter( |
+ name, receiver, Handle<JSFunction>::cast(setter), strict_mode); |
+ } else { |
+ ASSERT(callback->IsForeign()); |
+ // No IC support for old-style native accessors. |
+ return; |
+ } |
break; |
} |
case INTERCEPTOR: |