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 |