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

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

Issue 760883002: Add interceptor support for symbols (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test Created 6 years 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/elements.cc ('k') | src/objects.h » ('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 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 2636
2637 /** 2637 /**
2638 * Attempts to load a property with an interceptor (which must be present), 2638 * Attempts to load a property with an interceptor (which must be present),
2639 * but doesn't search the prototype chain. 2639 * but doesn't search the prototype chain.
2640 * 2640 *
2641 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't 2641 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't
2642 * provide any value for the given name. 2642 * provide any value for the given name.
2643 */ 2643 */
2644 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) { 2644 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) {
2645 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); 2645 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength);
2646 Handle<Name> name_handle = 2646 Handle<Name> name =
2647 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); 2647 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex);
2648 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>( 2648 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>(
2649 NamedLoadHandlerCompiler::kInterceptorArgsInfoIndex); 2649 NamedLoadHandlerCompiler::kInterceptorArgsInfoIndex);
2650 2650
2651 // TODO(rossberg): Support symbols in the API. 2651 if (name->IsSymbol() && !interceptor_info->can_intercept_symbols())
2652 if (name_handle->IsSymbol())
2653 return isolate->heap()->no_interceptor_result_sentinel(); 2652 return isolate->heap()->no_interceptor_result_sentinel();
2654 Handle<String> name = Handle<String>::cast(name_handle);
2655 2653
2656 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); 2654 Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
2657 v8::NamedPropertyGetterCallback getter = 2655 v8::GenericNamedPropertyGetterCallback getter =
2658 FUNCTION_CAST<v8::NamedPropertyGetterCallback>(getter_address); 2656 FUNCTION_CAST<v8::GenericNamedPropertyGetterCallback>(getter_address);
2659 DCHECK(getter != NULL); 2657 DCHECK(getter != NULL);
2660 2658
2661 Handle<JSObject> receiver = 2659 Handle<JSObject> receiver =
2662 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); 2660 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex);
2663 Handle<JSObject> holder = 2661 Handle<JSObject> holder =
2664 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); 2662 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex);
2665 PropertyCallbackArguments callback_args(isolate, interceptor_info->data(), 2663 PropertyCallbackArguments callback_args(isolate, interceptor_info->data(),
2666 *receiver, *holder); 2664 *receiver, *holder);
2667 { 2665 {
2668 // Use the interceptor getter. 2666 // Use the interceptor getter.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 static const Address IC_utilities[] = { 2779 static const Address IC_utilities[] = {
2782 #define ADDR(name) FUNCTION_ADDR(name), 2780 #define ADDR(name) FUNCTION_ADDR(name),
2783 IC_UTIL_LIST(ADDR) NULL 2781 IC_UTIL_LIST(ADDR) NULL
2784 #undef ADDR 2782 #undef ADDR
2785 }; 2783 };
2786 2784
2787 2785
2788 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 2786 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
2789 } 2787 }
2790 } // namespace v8::internal 2788 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698