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

Unified Diff: src/ic.cc

Issue 17027007: Install a generic handler whenever we fail to update the IC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « src/ic.h ('k') | src/x64/ic-x64.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 77e01967f6a80fe405c3a12f7043d2da88b66d88..029aafdcf714cb08d71721494717afc566ad78a2 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -936,15 +936,7 @@ MaybeObject* LoadIC::Load(State state,
}
// Update inline cache and stub cache.
- if (FLAG_use_ic) {
- if (!object->IsJSObject()) {
- // TODO(jkummerow): It would be nice to support non-JSObjects in
- // UpdateCaches, then we wouldn't need to go generic here.
- set_target(*generic_stub());
- } else {
- UpdateCaches(&lookup, state, object, name);
- }
- }
+ if (FLAG_use_ic) UpdateCaches(&lookup, state, object, name);
PropertyAttributes attr;
if (lookup.IsInterceptor() || lookup.IsHandler()) {
@@ -1204,11 +1196,17 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
Handle<Object> object,
Handle<String> name) {
// Bail out if the result is not cacheable.
- if (!lookup->IsCacheable()) return;
+ if (!lookup->IsCacheable()) {
+ set_target(*generic_stub());
+ return;
+ }
- // Loading properties from values is not common, so don't try to
- // deal with non-JS objects here.
- if (!object->IsJSObject()) return;
+ // TODO(jkummerow): It would be nice to support non-JSObjects in
+ // UpdateCaches, then we wouldn't need to go generic here.
+ if (!object->IsJSObject()) {
+ set_target(*generic_stub());
+ return;
+ }
Handle<JSObject> receiver = Handle<JSObject>::cast(object);
Handle<Code> code;
@@ -1219,7 +1217,10 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
code = pre_monomorphic_stub();
} else {
code = ComputeLoadHandler(lookup, receiver, name);
- if (code.is_null()) return;
+ if (code.is_null()) {
+ set_target(*generic_stub());
+ return;
+ }
}
PatchCache(state, kNonStrictMode, receiver, name, code);
@@ -1640,6 +1641,12 @@ MaybeObject* StoreIC::Store(State state,
IsUndeclaredGlobal(object)) {
// Strict mode doesn't allow setting non-existent global property.
return ReferenceError("not_defined", name);
+ } else if (FLAG_use_ic &&
+ (lookup.IsNormal() ||
+ (lookup.IsField() && lookup.CanHoldValue(value)))) {
+ Handle<Code> stub = strict_mode == kStrictMode
+ ? generic_stub_strict() : generic_stub();
+ set_target(*stub);
}
// Set the property.
@@ -1660,9 +1667,14 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
// These are not cacheable, so we never see such LookupResults here.
ASSERT(!lookup->IsHandler());
- Handle<Code> code =
- ComputeStoreMonomorphic(lookup, strict_mode, receiver, name);
- if (code.is_null()) return;
+ Handle<Code> code = ComputeStoreMonomorphic(
+ lookup, strict_mode, receiver, name);
+ if (code.is_null()) {
+ Handle<Code> stub = strict_mode == kStrictMode
+ ? generic_stub_strict() : generic_stub();
+ set_target(*stub);
+ return;
+ }
PatchCache(state, strict_mode, receiver, name, code);
TRACE_IC("StoreIC", name, state, target());
« no previous file with comments | « src/ic.h ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698