OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/lookup.h" | 5 #include "src/lookup.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/elements.h" | 9 #include "src/elements.h" |
10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 if (access_check_info) { | 835 if (access_check_info) { |
836 Object* interceptor = IsElement() ? access_check_info->indexed_interceptor() | 836 Object* interceptor = IsElement() ? access_check_info->indexed_interceptor() |
837 : access_check_info->named_interceptor(); | 837 : access_check_info->named_interceptor(); |
838 if (interceptor) { | 838 if (interceptor) { |
839 return handle(InterceptorInfo::cast(interceptor), isolate_); | 839 return handle(InterceptorInfo::cast(interceptor), isolate_); |
840 } | 840 } |
841 } | 841 } |
842 return Handle<InterceptorInfo>(); | 842 return Handle<InterceptorInfo>(); |
843 } | 843 } |
844 | 844 |
| 845 bool LookupIterator::TryLookupCachedProperty() { |
| 846 return state() == LookupIterator::ACCESSOR && |
| 847 GetAccessors()->IsAccessorPair() && LookupCachedProperty(); |
| 848 } |
| 849 |
| 850 bool LookupIterator::LookupCachedProperty() { |
| 851 DCHECK_EQ(state(), LookupIterator::ACCESSOR); |
| 852 DCHECK(GetAccessors()->IsAccessorPair()); |
| 853 |
| 854 AccessorPair* accessor_pair = AccessorPair::cast(*GetAccessors()); |
| 855 Handle<Object> getter(accessor_pair->getter(), isolate()); |
| 856 MaybeHandle<Name> maybe_name = |
| 857 FunctionTemplateInfo::TryGetCachedPropertyName(isolate(), getter); |
| 858 if (maybe_name.is_null()) return false; |
| 859 |
| 860 // We have found a cached property! Modify the iterator accordingly. |
| 861 name_ = maybe_name.ToHandleChecked(); |
| 862 Restart(); |
| 863 CHECK_EQ(state(), LookupIterator::DATA); |
| 864 return true; |
| 865 } |
| 866 |
845 } // namespace internal | 867 } // namespace internal |
846 } // namespace v8 | 868 } // namespace v8 |
OLD | NEW |