Author: [email protected]
Date: Wed Jun 10 07:45:46 2009
New Revision: 2136
Modified:
branches/bleeding_edge/src/ic.cc
branches/bleeding_edge/test/cctest/test-api.cc
Log:
Re-land patch r2110.
[email protected]
Review URL: http://codereview.chromium.org/118501
Modified: branches/bleeding_edge/src/ic.cc
==============================================================================
--- branches/bleeding_edge/src/ic.cc (original)
+++ branches/bleeding_edge/src/ic.cc Wed Jun 10 07:45:46 2009
@@ -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,14 +907,9 @@
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;
-
- // If the property is read-only, we leave the IC in its current
- // state.
- if (lookup->IsReadOnly()) return;
+ ASSERT(StoreICableLookup(lookup));
// 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
Modified: branches/bleeding_edge/test/cctest/test-api.cc
==============================================================================
--- branches/bleeding_edge/test/cctest/test-api.cc (original)
+++ branches/bleeding_edge/test/cctest/test-api.cc Wed Jun 10 07:45:46 2009
@@ -5008,6 +5008,22 @@
}
+THREADED_TEST(InterceptorStoreICWithNoSetter) {
+ v8::HandleScope scope;
+ v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
+ templ->SetNamedPropertyHandler(InterceptorLoadXICGetter);
+ LocalContext context;
+ context->Global()->Set(v8_str("o"), templ->NewInstance());
+ v8::Handle<Value> value = CompileRun(
+ "for (var i = 0; i < 1000; i++) {"
+ " o.y = 239;"
+ "}"
+ "42 + o.y");
+ CHECK_EQ(239 + 42, value->Int32Value());
+}
+
+
+
v8::Handle<Value> call_ic_function;
v8::Handle<Value> call_ic_function2;
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---