Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: src/ic/ic.cc

Issue 893573003: Do not embed interceptor in handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/ia32/handler-compiler-ia32.cc ('k') | src/ic/mips/handler-compiler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/ic/ia32/handler-compiler-ia32.cc ('k') | src/ic/mips/handler-compiler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698