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

Unified Diff: src/lookup.cc

Issue 2405213002: V8 support for cached accessors. (Closed)
Patch Set: Centralized lookup in LookupIterator::TryLookupCacheProperty. Also rebase. Created 4 years, 2 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
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index 3921e1657c8511b5de5a1d96b6f802ae1649bbf0..51d02990298c3a5fc55fa1984f2e039d053f21c3 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -835,5 +835,24 @@ Handle<InterceptorInfo> LookupIterator::GetInterceptorForFailedAccessCheck()
return Handle<InterceptorInfo>();
}
+bool LookupIterator::TryLookupCacheProperty() {
+ if (state() != LookupIterator::ACCESSOR) return false;
+
+ Handle<Object> accessors = GetAccessors();
+ if (!accessors->IsAccessorPair()) return false;
Toon Verwaest 2016/10/21 08:22:14 You should be able to make this a DCHECK and only
vogelheim 2016/11/03 16:12:24 Mostly done. There's now a LookupCachedProperty,
+
+ Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
+ isolate());
Toon Verwaest 2016/10/21 08:22:14 you don't need isolate() here
vogelheim 2016/11/03 16:12:23 The compiler disagrees. With only one param, this
Toon Verwaest 2016/11/04 10:19:52 You're right; I misread I guess. Object includes S
+ MaybeHandle<Name> maybe_name =
+ FunctionTemplateInfo::TryGetCachePropertyName(isolate(), getter);
+ if (maybe_name.is_null()) return false;
+
+ // We have found a cached property! Modify the iterator accordingly.
+ name_ = maybe_name.ToHandleChecked();
+ Restart();
+ CHECK_EQ(state(), LookupIterator::DATA);
+ return true;
+}
+
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698