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

Unified Diff: src/ic.cc

Issue 155141: Improved version of LookupForRead (tnx to Kasper) + some faster paths.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
===================================================================
--- src/ic.cc (revision 2399)
+++ src/ic.cc (working copy)
@@ -273,28 +273,39 @@
static void LookupForRead(Object* object,
String* name,
LookupResult* lookup) {
- object->Lookup(name, lookup);
- if (lookup->IsNotFound() || lookup->type() != INTERCEPTOR) {
- return;
- }
+ AssertNoAllocation no_gc; // pointers must stay valid
- JSObject* holder = lookup->holder();
- if (HasInterceptorGetter(holder)) {
- return;
- }
+ // Skip all the objects with named interceptors, but
+ // without actual getter.
+ while (true) {
+ object->Lookup(name, lookup);
+ // Besides normal conditions (property not found or it's not
+ // an interceptor), bail out of lookup is not cacheable: we won't
+ // be able to IC it anyway and regular lookup should work fine.
+ if (lookup->IsNotFound() || lookup->type() != INTERCEPTOR ||
+ !lookup->IsCacheable()) {
+ return;
+ }
- // There is no getter, just skip it and lookup down the proto chain
- holder->LocalLookupRealNamedProperty(name, lookup);
- if (lookup->IsValid()) {
- return;
- }
+ JSObject* holder = lookup->holder();
+ if (HasInterceptorGetter(holder)) {
+ return;
+ }
- Object* proto = holder->GetPrototype();
- if (proto == Heap::null_value()) {
- return;
+ holder->LocalLookupRealNamedProperty(name, lookup);
+ if (lookup->IsValid()) {
+ ASSERT(lookup->type() != INTERCEPTOR);
+ return;
+ }
+
+ Object* proto = holder->GetPrototype();
+ if (proto->IsNull()) {
+ lookup->NotFound();
+ return;
+ }
+
+ object = proto;
}
-
- LookupForRead(proto, name, lookup);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698