Chromium Code Reviews| Index: src/ic.cc |
| diff --git a/src/ic.cc b/src/ic.cc |
| index 1f0070b193dff8b232a3020a1cd72654e44d3bea..e3663c0b5ff8e443a667c3d85b98d6d7647eaa1e 100644 |
| --- a/src/ic.cc |
| +++ b/src/ic.cc |
| @@ -1315,7 +1315,15 @@ static bool LookupForWrite(Handle<JSObject> receiver, |
| LookupResult* lookup) { |
| receiver->LocalLookup(*name, lookup); |
| if (!StoreICableLookup(lookup)) { |
| - return false; |
| + // 2nd chance: There can be accessors somewhere in the prototype chain, but |
| + // for compatibility reasons we have to hide this behind a flag. Note that |
| + // we explicitly exclude native accessors for now, because the stubs are not |
| + // yet prepared for this scenario. |
| + if (!FLAG_es5_readonly) return false; |
|
Vyacheslav Egorov (Google)
2012/07/04 11:48:34
Sorry, I do not understand why es5_readonly semant
rossberg
2012/07/04 13:18:17
Perhaps it isn't necessary, but this patch amends
|
| + receiver->Lookup(*name, lookup); |
| + if (!lookup->IsCallbacks()) return false; |
| + Handle<Object> callback(lookup->GetCallbackObject()); |
| + return callback->IsAccessorPair() && StoreICableLookup(lookup); |
| } |
| if (lookup->IsInterceptor() && |
| @@ -1494,7 +1502,8 @@ void StoreIC::UpdateCaches(LookupResult* lookup, |
| if (holder->IsGlobalObject()) return; |
| if (!receiver->HasFastProperties()) return; |
| code = isolate()->stub_cache()->ComputeStoreViaSetter( |
| - name, receiver, Handle<JSFunction>::cast(setter), strict_mode); |
| + name, receiver, holder, Handle<JSFunction>::cast(setter), |
| + strict_mode); |
| } else { |
| ASSERT(callback->IsForeign()); |
| // No IC support for old-style native accessors. |