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

Unified Diff: src/lookup.cc

Issue 2405213002: V8 support for cached accessors. (Closed)
Patch Set: Toon's feedback. Created 4 years, 1 month 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/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index fa6d579122b618554de15db315a823262c5dfc52..256aa02d21cf4ffffc9487b0b2bbd6662bb07cb6 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -842,5 +842,27 @@ Handle<InterceptorInfo> LookupIterator::GetInterceptorForFailedAccessCheck()
return Handle<InterceptorInfo>();
}
+bool LookupIterator::TryLookupCachedProperty() {
+ return state() == LookupIterator::ACCESSOR &&
+ GetAccessors()->IsAccessorPair() && LookupCachedProperty();
+}
+
+bool LookupIterator::LookupCachedProperty() {
+ DCHECK_EQ(state(), LookupIterator::ACCESSOR);
+ DCHECK(GetAccessors()->IsAccessorPair());
+
+ AccessorPair* accessor_pair = AccessorPair::cast(*GetAccessors());
+ Handle<Object> getter(accessor_pair->getter(), isolate());
+ MaybeHandle<Name> maybe_name =
+ FunctionTemplateInfo::TryGetCachedPropertyName(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
« no previous file with comments | « src/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698