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 2896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2907 */ | 2907 */ |
2908 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) { | 2908 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) { |
2909 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); | 2909 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); |
2910 Handle<Name> name = | 2910 Handle<Name> name = |
2911 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); | 2911 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); |
2912 Handle<JSObject> receiver = | 2912 Handle<JSObject> receiver = |
2913 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); | 2913 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); |
2914 Handle<JSObject> holder = | 2914 Handle<JSObject> holder = |
2915 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); | 2915 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); |
2916 HandleScope scope(isolate); | 2916 HandleScope scope(isolate); |
2917 Handle<InterceptorInfo> interceptor_info(holder->GetNamedInterceptor()); | 2917 auto res = JSObject::GetPropertyWithInterceptor(holder, receiver, name); |
2918 | 2918 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
2919 if (name->IsSymbol() && !interceptor_info->can_intercept_symbols()) | 2919 Handle<Object> result; |
2920 return isolate->heap()->no_interceptor_result_sentinel(); | 2920 if (res.ToHandle(&result)) return *result; |
2921 | |
2922 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); | |
2923 v8::GenericNamedPropertyGetterCallback getter = | |
2924 FUNCTION_CAST<v8::GenericNamedPropertyGetterCallback>(getter_address); | |
2925 DCHECK(getter != NULL); | |
2926 | |
2927 PropertyCallbackArguments callback_args(isolate, interceptor_info->data(), | |
2928 *receiver, *holder); | |
2929 { | |
2930 // Use the interceptor getter. | |
2931 v8::Handle<v8::Value> r = | |
2932 callback_args.Call(getter, v8::Utils::ToLocal(name)); | |
2933 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | |
2934 if (!r.IsEmpty()) { | |
2935 Handle<Object> result = v8::Utils::OpenHandle(*r); | |
2936 result->VerifyApiCallResultType(); | |
2937 return *v8::Utils::OpenHandle(*r); | |
2938 } | |
2939 } | |
2940 | |
2941 return isolate->heap()->no_interceptor_result_sentinel(); | 2921 return isolate->heap()->no_interceptor_result_sentinel(); |
2942 } | 2922 } |
2943 | 2923 |
2944 | 2924 |
2945 static Object* ThrowReferenceError(Isolate* isolate, Name* name) { | 2925 static Object* ThrowReferenceError(Isolate* isolate, Name* name) { |
2946 // If the load is non-contextual, just return the undefined result. | 2926 // If the load is non-contextual, just return the undefined result. |
2947 // Note that both keyed and non-keyed loads may end up here. | 2927 // Note that both keyed and non-keyed loads may end up here. |
2948 HandleScope scope(isolate); | 2928 HandleScope scope(isolate); |
2949 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); | 2929 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); |
2950 if (ic.contextual_mode() != CONTEXTUAL) { | 2930 if (ic.contextual_mode() != CONTEXTUAL) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3068 static const Address IC_utilities[] = { | 3048 static const Address IC_utilities[] = { |
3069 #define ADDR(name) FUNCTION_ADDR(name), | 3049 #define ADDR(name) FUNCTION_ADDR(name), |
3070 IC_UTIL_LIST(ADDR) NULL | 3050 IC_UTIL_LIST(ADDR) NULL |
3071 #undef ADDR | 3051 #undef ADDR |
3072 }; | 3052 }; |
3073 | 3053 |
3074 | 3054 |
3075 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3055 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
3076 } | 3056 } |
3077 } // namespace v8::internal | 3057 } // namespace v8::internal |
OLD | NEW |