Commit f12bdb27 authored by antonm@chromium.org's avatar antonm@chromium.org

Improved version of LookupForRead (tnx to Kasper) + some faster paths.

1) add no GC check;
2) do not use recursion;

Review URL: http://codereview.chromium.org/155141

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2462 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 36b69749
......@@ -273,28 +273,39 @@ static bool HasInterceptorGetter(JSObject* object) {
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
// 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;
}
JSObject* holder = lookup->holder();
if (HasInterceptorGetter(holder)) {
return;
}
JSObject* holder = lookup->holder();
if (HasInterceptorGetter(holder)) {
return;
}
// There is no getter, just skip it and lookup down the proto chain
holder->LocalLookupRealNamedProperty(name, lookup);
if (lookup->IsValid()) {
return;
}
holder->LocalLookupRealNamedProperty(name, lookup);
if (lookup->IsValid()) {
ASSERT(lookup->type() != INTERCEPTOR);
return;
}
Object* proto = holder->GetPrototype();
if (proto == Heap::null_value()) {
return;
}
Object* proto = holder->GetPrototype();
if (proto->IsNull()) {
lookup->NotFound();
return;
}
LookupForRead(proto, name, lookup);
object = proto;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment