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

Unified Diff: src/ic.cc

Issue 118501: Re-land patch r2110. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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 | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
===================================================================
--- src/ic.cc (revision 2135)
+++ src/ic.cc (working copy)
@@ -849,6 +849,20 @@
}
+static bool StoreICableLookup(LookupResult* lookup) {
+ // Bail out if we didn't find a result.
+ if (!lookup->IsValid() || !lookup->IsCacheable()) return false;
+
+ // If the property is read-only, we leave the IC in its current
+ // state.
+ if (lookup->IsReadOnly()) return false;
+
+ if (!lookup->IsLoaded()) return false;
+
+ return true;
+}
+
+
Object* StoreIC::Store(State state,
Handle<Object> object,
Handle<String> name,
@@ -873,12 +887,12 @@
}
// Lookup the property locally in the receiver.
- LookupResult lookup;
- receiver->LocalLookup(*name, &lookup);
-
- // Update inline cache and stub cache.
- if (FLAG_use_ic && lookup.IsLoaded()) {
- UpdateCaches(&lookup, state, receiver, name, value);
+ if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) {
+ LookupResult lookup;
+ receiver->LocalLookup(*name, &lookup);
+ if (StoreICableLookup(&lookup)) {
+ UpdateCaches(&lookup, state, receiver, name, value);
+ }
}
// Set the property.
@@ -893,15 +907,10 @@
Handle<Object> value) {
ASSERT(lookup->IsLoaded());
// Skip JSGlobalProxy.
- if (receiver->IsJSGlobalProxy()) return;
+ ASSERT(!receiver->IsJSGlobalProxy());
- // Bail out if we didn't find a result.
- if (!lookup->IsValid() || !lookup->IsCacheable()) return;
+ ASSERT(StoreICableLookup(lookup));
- // If the property is read-only, we leave the IC in its current
- // state.
- if (lookup->IsReadOnly()) return;
-
// If the property has a non-field type allowing map transitions
// where there is extra room in the object, we leave the IC in its
// current state.
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698