Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: src/ic.cc

Issue 10735003: Handle accessors on the prototype chain in StoreICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added a unit test. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ 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.
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698