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

Unified Diff: src/ic.cc

Issue 2868108: Revert r5174. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 4 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/stub-cache.h » ('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 5176)
+++ src/ic.cc (working copy)
@@ -501,24 +501,20 @@
// Lookup the property in the object.
LookupResult lookup;
- {
- AssertNoGC nogc; // GC could invalidate the pointers held in lookup.
+ LookupForRead(*object, *name, &lookup);
- LookupForRead(*object, *name, &lookup);
-
- if (!lookup.IsProperty()) {
- // If the object does not have the requested property, check which
- // exception we need to throw.
- if (IsContextual(object)) {
- return ReferenceError("not_defined", name);
- }
- return TypeError("undefined_method", object, name);
+ if (!lookup.IsProperty()) {
+ // If the object does not have the requested property, check which
+ // exception we need to throw.
+ if (IsContextual(object)) {
+ return ReferenceError("not_defined", name);
}
+ return TypeError("undefined_method", object, name);
+ }
- // Lookup is valid: Update inline cache and stub cache.
- if (FLAG_use_ic) {
- UpdateCaches(&lookup, state, object, name);
- }
+ // Lookup is valid: Update inline cache and stub cache.
+ if (FLAG_use_ic) {
+ UpdateCaches(&lookup, state, object, name);
}
// Get the property.
@@ -791,73 +787,69 @@
// Named lookup in the object.
LookupResult lookup;
- {
- AssertNoGC nogc; // GC could invalidate the pointers held in lookup.
+ LookupForRead(*object, *name, &lookup);
- LookupForRead(*object, *name, &lookup);
-
- // If we did not find a property, check if we need to throw an exception.
- if (!lookup.IsProperty()) {
- if (FLAG_strict || IsContextual(object)) {
- return ReferenceError("not_defined", name);
- }
- LOG(SuspectReadEvent(*name, *object));
+ // If we did not find a property, check if we need to throw an exception.
+ if (!lookup.IsProperty()) {
+ if (FLAG_strict || IsContextual(object)) {
+ return ReferenceError("not_defined", name);
}
+ LOG(SuspectReadEvent(*name, *object));
+ }
- bool can_be_inlined =
- FLAG_use_ic &&
- state == PREMONOMORPHIC &&
- lookup.IsProperty() &&
- lookup.IsCacheable() &&
- lookup.holder() == *object &&
- lookup.type() == FIELD &&
- !object->IsAccessCheckNeeded();
+ bool can_be_inlined =
+ FLAG_use_ic &&
+ state == PREMONOMORPHIC &&
+ lookup.IsProperty() &&
+ lookup.IsCacheable() &&
+ lookup.holder() == *object &&
+ lookup.type() == FIELD &&
+ !object->IsAccessCheckNeeded();
- if (can_be_inlined) {
- Map* map = lookup.holder()->map();
- // Property's index in the properties array. If negative we have
- // an inobject property.
- int index = lookup.GetFieldIndex() - map->inobject_properties();
- if (index < 0) {
- // Index is an offset from the end of the object.
- int offset = map->instance_size() + (index * kPointerSize);
- if (PatchInlinedLoad(address(), map, offset)) {
- set_target(megamorphic_stub());
- #ifdef DEBUG
- if (FLAG_trace_ic) {
- PrintF("[LoadIC : inline patch %s]\n", *name->ToCString());
- }
- #endif
- return lookup.holder()->FastPropertyAt(lookup.GetFieldIndex());
- #ifdef DEBUG
- } else {
- if (FLAG_trace_ic) {
- PrintF("[LoadIC : no inline patch %s (patching failed)]\n",
- *name->ToCString());
- }
+ if (can_be_inlined) {
+ Map* map = lookup.holder()->map();
+ // Property's index in the properties array. If negative we have
+ // an inobject property.
+ int index = lookup.GetFieldIndex() - map->inobject_properties();
+ if (index < 0) {
+ // Index is an offset from the end of the object.
+ int offset = map->instance_size() + (index * kPointerSize);
+ if (PatchInlinedLoad(address(), map, offset)) {
+ set_target(megamorphic_stub());
+#ifdef DEBUG
+ if (FLAG_trace_ic) {
+ PrintF("[LoadIC : inline patch %s]\n", *name->ToCString());
}
+#endif
+ return lookup.holder()->FastPropertyAt(lookup.GetFieldIndex());
+#ifdef DEBUG
} else {
if (FLAG_trace_ic) {
- PrintF("[LoadIC : no inline patch %s (not inobject)]\n",
+ PrintF("[LoadIC : no inline patch %s (patching failed)]\n",
*name->ToCString());
}
}
} else {
- if (FLAG_use_ic && state == PREMONOMORPHIC) {
- if (FLAG_trace_ic) {
- PrintF("[LoadIC : no inline patch %s (not inlinable)]\n",
- *name->ToCString());
- #endif
- }
+ if (FLAG_trace_ic) {
+ PrintF("[LoadIC : no inline patch %s (not inobject)]\n",
+ *name->ToCString());
}
}
-
- // Update inline cache and stub cache.
- if (FLAG_use_ic) {
- UpdateCaches(&lookup, state, object, name);
+ } else {
+ if (FLAG_use_ic && state == PREMONOMORPHIC) {
+ if (FLAG_trace_ic) {
+ PrintF("[LoadIC : no inline patch %s (not inlinable)]\n",
+ *name->ToCString());
+#endif
+ }
}
}
+ // Update inline cache and stub cache.
+ if (FLAG_use_ic) {
+ UpdateCaches(&lookup, state, object, name);
+ }
+
PropertyAttributes attr;
if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) {
// Get the property.
@@ -1045,21 +1037,17 @@
// Named lookup.
LookupResult lookup;
- {
- AssertNoGC nogc; // GC could invalidate the pointers held in lookup.
+ LookupForRead(*object, *name, &lookup);
- LookupForRead(*object, *name, &lookup);
-
- // If we did not find a property, check if we need to throw an exception.
- if (!lookup.IsProperty()) {
- if (FLAG_strict || IsContextual(object)) {
- return ReferenceError("not_defined", name);
- }
+ // If we did not find a property, check if we need to throw an exception.
+ if (!lookup.IsProperty()) {
+ if (FLAG_strict || IsContextual(object)) {
+ return ReferenceError("not_defined", name);
}
+ }
- if (FLAG_use_ic) {
- UpdateCaches(&lookup, state, object, name);
- }
+ if (FLAG_use_ic) {
+ UpdateCaches(&lookup, state, object, name);
}
PropertyAttributes attr;
@@ -1257,8 +1245,6 @@
// Lookup the property locally in the receiver.
if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) {
- AssertNoGC nogc; // GC could invalidate the pointers held in lookup.
-
LookupResult lookup;
if (LookupForWrite(*receiver, *name, &lookup)) {
@@ -1432,17 +1418,13 @@
return *value;
}
- {
- AssertNoGC nogc; // GC could invalidate the pointers held in lookup.
+ // Lookup the property locally in the receiver.
+ LookupResult lookup;
+ receiver->LocalLookup(*name, &lookup);
- // Lookup the property locally in the receiver.
- LookupResult lookup;
- receiver->LocalLookup(*name, &lookup);
-
- // Update inline cache and stub cache.
- if (FLAG_use_ic) {
- UpdateCaches(&lookup, state, receiver, name, value);
- }
+ // Update inline cache and stub cache.
+ if (FLAG_use_ic) {
+ UpdateCaches(&lookup, state, receiver, name, value);
}
// Set the property.
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698