OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2887 */ | 2887 */ |
2888 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) { | 2888 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) { |
2889 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); | 2889 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); |
2890 Handle<Name> name = | 2890 Handle<Name> name = |
2891 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); | 2891 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); |
2892 Handle<JSObject> receiver = | 2892 Handle<JSObject> receiver = |
2893 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); | 2893 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); |
2894 Handle<JSObject> holder = | 2894 Handle<JSObject> holder = |
2895 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); | 2895 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); |
2896 HandleScope scope(isolate); | 2896 HandleScope scope(isolate); |
2897 Handle<InterceptorInfo> interceptor_info(holder->GetNamedInterceptor()); | 2897 auto res = JSObject::GetPropertyWithInterceptor(holder, receiver, name); |
2898 | 2898 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
2899 if (name->IsSymbol() && !interceptor_info->can_intercept_symbols()) | 2899 Handle<Object> result; |
2900 return isolate->heap()->no_interceptor_result_sentinel(); | 2900 if (res.ToHandle(&result)) return *result; |
2901 | |
2902 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); | |
2903 v8::GenericNamedPropertyGetterCallback getter = | |
2904 FUNCTION_CAST<v8::GenericNamedPropertyGetterCallback>(getter_address); | |
2905 DCHECK(getter != NULL); | |
2906 | |
2907 PropertyCallbackArguments callback_args(isolate, interceptor_info->data(), | |
2908 *receiver, *holder); | |
2909 { | |
2910 // Use the interceptor getter. | |
2911 v8::Handle<v8::Value> r = | |
2912 callback_args.Call(getter, v8::Utils::ToLocal(name)); | |
2913 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | |
2914 if (!r.IsEmpty()) { | |
2915 Handle<Object> result = v8::Utils::OpenHandle(*r); | |
2916 result->VerifyApiCallResultType(); | |
2917 return *v8::Utils::OpenHandle(*r); | |
2918 } | |
2919 } | |
2920 | |
2921 return isolate->heap()->no_interceptor_result_sentinel(); | 2901 return isolate->heap()->no_interceptor_result_sentinel(); |
2922 } | 2902 } |
2923 | 2903 |
2924 | 2904 |
2925 static Object* ThrowReferenceError(Isolate* isolate, Name* name) { | 2905 static Object* ThrowReferenceError(Isolate* isolate, Name* name) { |
2926 // If the load is non-contextual, just return the undefined result. | 2906 // If the load is non-contextual, just return the undefined result. |
2927 // Note that both keyed and non-keyed loads may end up here. | 2907 // Note that both keyed and non-keyed loads may end up here. |
2928 HandleScope scope(isolate); | 2908 HandleScope scope(isolate); |
2929 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); | 2909 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); |
2930 if (ic.contextual_mode() != CONTEXTUAL) { | 2910 if (ic.contextual_mode() != CONTEXTUAL) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3048 static const Address IC_utilities[] = { | 3028 static const Address IC_utilities[] = { |
3049 #define ADDR(name) FUNCTION_ADDR(name), | 3029 #define ADDR(name) FUNCTION_ADDR(name), |
3050 IC_UTIL_LIST(ADDR) NULL | 3030 IC_UTIL_LIST(ADDR) NULL |
3051 #undef ADDR | 3031 #undef ADDR |
3052 }; | 3032 }; |
3053 | 3033 |
3054 | 3034 |
3055 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3035 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
3056 } | 3036 } |
3057 } // namespace v8::internal | 3037 } // namespace v8::internal |
OLD | NEW |