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

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

Issue 467013003: Add interceptor support for symbols (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Updated to filter out non-symbol keys from for-in enumeration Created 6 years, 3 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 | Annotate | Revision Log
« 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/codegen.h" 10 #include "src/codegen.h"
(...skipping 3049 matching lines...) Expand 10 before | Expand all | Expand 10 after
3060 3060
3061 /** 3061 /**
3062 * Attempts to load a property with an interceptor (which must be present), 3062 * Attempts to load a property with an interceptor (which must be present),
3063 * but doesn't search the prototype chain. 3063 * but doesn't search the prototype chain.
3064 * 3064 *
3065 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't 3065 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't
3066 * provide any value for the given name. 3066 * provide any value for the given name.
3067 */ 3067 */
3068 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) { 3068 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) {
3069 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); 3069 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength);
3070 Handle<Name> name_handle = 3070 Handle<Name> name =
3071 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); 3071 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex);
3072 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>( 3072 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>(
3073 NamedLoadHandlerCompiler::kInterceptorArgsInfoIndex); 3073 NamedLoadHandlerCompiler::kInterceptorArgsInfoIndex);
3074 3074
3075 // TODO(rossberg): Support symbols in the API. 3075 if (name->IsSymbol() && !interceptor_info->can_intercept_symbols())
3076 if (name_handle->IsSymbol())
3077 return isolate->heap()->no_interceptor_result_sentinel(); 3076 return isolate->heap()->no_interceptor_result_sentinel();
3078 Handle<String> name = Handle<String>::cast(name_handle);
3079 3077
3080 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); 3078 Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
3081 v8::NamedPropertyGetterCallback getter = 3079 v8::GenericNamedPropertyGetterCallback getter =
3082 FUNCTION_CAST<v8::NamedPropertyGetterCallback>(getter_address); 3080 FUNCTION_CAST<v8::GenericNamedPropertyGetterCallback>(getter_address);
3083 DCHECK(getter != NULL); 3081 DCHECK(getter != NULL);
3084 3082
3085 Handle<JSObject> receiver = 3083 Handle<JSObject> receiver =
3086 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); 3084 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex);
3087 Handle<JSObject> holder = 3085 Handle<JSObject> holder =
3088 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); 3086 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex);
3089 PropertyCallbackArguments callback_args(isolate, interceptor_info->data(), 3087 PropertyCallbackArguments callback_args(isolate, interceptor_info->data(),
3090 *receiver, *holder); 3088 *receiver, *holder);
3091 { 3089 {
3092 // Use the interceptor getter. 3090 // Use the interceptor getter.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 static const Address IC_utilities[] = { 3190 static const Address IC_utilities[] = {
3193 #define ADDR(name) FUNCTION_ADDR(name), 3191 #define ADDR(name) FUNCTION_ADDR(name),
3194 IC_UTIL_LIST(ADDR) NULL 3192 IC_UTIL_LIST(ADDR) NULL
3195 #undef ADDR 3193 #undef ADDR
3196 }; 3194 };
3197 3195
3198 3196
3199 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 3197 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
3200 } 3198 }
3201 } // namespace v8::internal 3199 } // 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