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

Unified Diff: src/objects.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/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index f852ca0de39dee015d82e03b5f7f326910688c56..e2413a05c072630d7d74fdb754c9f70fd61a0ea2 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1325,6 +1325,11 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor(LookupIterator* it) {
// const declaration would conflict with the getter.
DCHECK(!structure->IsForeign());
+ // Accessor with 'cached' private property.
+ if (it->TryLookupCacheProperty()) {
+ return Object::GetProperty(it);
Toon Verwaest 2016/10/21 08:22:14 Why not do GetProperty directly in TryLookupCached
vogelheim 2016/11/03 16:12:24 Hmm. That would seem to do the wrong thing for the
+ }
+
// API style callbacks.
if (structure->IsAccessorInfo()) {
Handle<JSObject> holder = it->GetHolder<JSObject>();
@@ -20218,5 +20223,19 @@ Handle<JSModuleNamespace> Module::GetModuleNamespace(Handle<Module> module) {
return ns;
}
+MaybeHandle<Name> FunctionTemplateInfo::TryGetCachePropertyName(
+ Isolate* isolate, Handle<Object> getter) {
+ if (getter->IsFunctionTemplateInfo()) {
Toon Verwaest 2016/10/21 08:22:14 It should be easy to support JSFunctions backed by
vogelheim 2016/11/03 16:12:24 Do we have a use case for that? (I'm generally fo
+ Handle<FunctionTemplateInfo> fti =
+ Handle<FunctionTemplateInfo>::cast(getter);
+ // Check if the accessor is backed by a private property (cached accessor).
+ if (!fti->cache_property()->IsTheHole(isolate)) {
+ Handle<Name> name = handle(Name::cast(fti->cache_property()));
+ return MaybeHandle<Name>(name);
+ }
+ }
+ return MaybeHandle<Name>();
+}
+
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698