 Chromium Code Reviews
 Chromium Code Reviews Issue 2405213002:
  V8 support for cached accessors.  (Closed)
    
  
    Issue 2405213002:
  V8 support for cached accessors.  (Closed) 
  | 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 |