| 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 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2833 * Attempts to load a property with an interceptor (which must be present), | 2833 * Attempts to load a property with an interceptor (which must be present), |
| 2834 * but doesn't search the prototype chain. | 2834 * but doesn't search the prototype chain. |
| 2835 * | 2835 * |
| 2836 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't | 2836 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't |
| 2837 * provide any value for the given name. | 2837 * provide any value for the given name. |
| 2838 */ | 2838 */ |
| 2839 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) { | 2839 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) { |
| 2840 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); | 2840 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); |
| 2841 Handle<Name> name = | 2841 Handle<Name> name = |
| 2842 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); | 2842 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); |
| 2843 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>( | 2843 Handle<JSObject> receiver = |
| 2844 NamedLoadHandlerCompiler::kInterceptorArgsInfoIndex); | 2844 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); |
| 2845 Handle<JSObject> holder = |
| 2846 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); |
| 2847 HandleScope scope(isolate); |
| 2848 Handle<InterceptorInfo> interceptor_info(holder->GetNamedInterceptor()); |
| 2845 | 2849 |
| 2846 if (name->IsSymbol() && !interceptor_info->can_intercept_symbols()) | 2850 if (name->IsSymbol() && !interceptor_info->can_intercept_symbols()) |
| 2847 return isolate->heap()->no_interceptor_result_sentinel(); | 2851 return isolate->heap()->no_interceptor_result_sentinel(); |
| 2848 | 2852 |
| 2849 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); | 2853 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); |
| 2850 v8::GenericNamedPropertyGetterCallback getter = | 2854 v8::GenericNamedPropertyGetterCallback getter = |
| 2851 FUNCTION_CAST<v8::GenericNamedPropertyGetterCallback>(getter_address); | 2855 FUNCTION_CAST<v8::GenericNamedPropertyGetterCallback>(getter_address); |
| 2852 DCHECK(getter != NULL); | 2856 DCHECK(getter != NULL); |
| 2853 | 2857 |
| 2854 Handle<JSObject> receiver = | |
| 2855 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); | |
| 2856 Handle<JSObject> holder = | |
| 2857 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); | |
| 2858 PropertyCallbackArguments callback_args(isolate, interceptor_info->data(), | 2858 PropertyCallbackArguments callback_args(isolate, interceptor_info->data(), |
| 2859 *receiver, *holder); | 2859 *receiver, *holder); |
| 2860 { | 2860 { |
| 2861 // Use the interceptor getter. | 2861 // Use the interceptor getter. |
| 2862 HandleScope scope(isolate); | |
| 2863 v8::Handle<v8::Value> r = | 2862 v8::Handle<v8::Value> r = |
| 2864 callback_args.Call(getter, v8::Utils::ToLocal(name)); | 2863 callback_args.Call(getter, v8::Utils::ToLocal(name)); |
| 2865 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | 2864 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 2866 if (!r.IsEmpty()) { | 2865 if (!r.IsEmpty()) { |
| 2867 Handle<Object> result = v8::Utils::OpenHandle(*r); | 2866 Handle<Object> result = v8::Utils::OpenHandle(*r); |
| 2868 result->VerifyApiCallResultType(); | 2867 result->VerifyApiCallResultType(); |
| 2869 return *v8::Utils::OpenHandle(*r); | 2868 return *v8::Utils::OpenHandle(*r); |
| 2870 } | 2869 } |
| 2871 } | 2870 } |
| 2872 | 2871 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3000 static const Address IC_utilities[] = { | 2999 static const Address IC_utilities[] = { |
| 3001 #define ADDR(name) FUNCTION_ADDR(name), | 3000 #define ADDR(name) FUNCTION_ADDR(name), |
| 3002 IC_UTIL_LIST(ADDR) NULL | 3001 IC_UTIL_LIST(ADDR) NULL |
| 3003 #undef ADDR | 3002 #undef ADDR |
| 3004 }; | 3003 }; |
| 3005 | 3004 |
| 3006 | 3005 |
| 3007 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3006 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| 3008 } | 3007 } |
| 3009 } // namespace v8::internal | 3008 } // namespace v8::internal |
| OLD | NEW |