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

Side by Side Diff: src/stub-cache.cc

Issue 467013003: Add interceptor support for symbols (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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
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/api.h" 7 #include "src/api.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 518
519 /** 519 /**
520 * Attempts to load a property with an interceptor (which must be present), 520 * Attempts to load a property with an interceptor (which must be present),
521 * but doesn't search the prototype chain. 521 * but doesn't search the prototype chain.
522 * 522 *
523 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't 523 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't
524 * provide any value for the given name. 524 * provide any value for the given name.
525 */ 525 */
526 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) { 526 RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) {
527 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); 527 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength);
528 Handle<Name> name_handle = 528 Handle<Name> name =
529 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); 529 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex);
530 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>( 530 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>(
531 NamedLoadHandlerCompiler::kInterceptorArgsInfoIndex); 531 NamedLoadHandlerCompiler::kInterceptorArgsInfoIndex);
532 532
533 // TODO(rossberg): Support symbols in the API. 533 if (name->IsSymbol() && !interceptor_info->can_intercept_symbols())
534 if (name_handle->IsSymbol())
535 return isolate->heap()->no_interceptor_result_sentinel(); 534 return isolate->heap()->no_interceptor_result_sentinel();
536 Handle<String> name = Handle<String>::cast(name_handle);
537 535
538 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); 536 Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
539 v8::NamedPropertyGetterCallback getter = 537 v8::GenericNamedPropertyGetterCallback getter =
540 FUNCTION_CAST<v8::NamedPropertyGetterCallback>(getter_address); 538 FUNCTION_CAST<v8::GenericNamedPropertyGetterCallback>(getter_address);
541 DCHECK(getter != NULL); 539 DCHECK(getter != NULL);
542 540
543 Handle<JSObject> receiver = 541 Handle<JSObject> receiver =
544 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); 542 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex);
545 Handle<JSObject> holder = 543 Handle<JSObject> holder =
546 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); 544 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex);
547 PropertyCallbackArguments callback_args( 545 PropertyCallbackArguments callback_args(
548 isolate, interceptor_info->data(), *receiver, *holder); 546 isolate, interceptor_info->data(), *receiver, *holder);
549 { 547 {
550 // Use the interceptor getter. 548 // Use the interceptor getter.
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 Handle<FunctionTemplateInfo>( 1278 Handle<FunctionTemplateInfo>(
1281 FunctionTemplateInfo::cast(signature->receiver())); 1279 FunctionTemplateInfo::cast(signature->receiver()));
1282 } 1280 }
1283 } 1281 }
1284 1282
1285 is_simple_api_call_ = true; 1283 is_simple_api_call_ = true;
1286 } 1284 }
1287 1285
1288 1286
1289 } } // namespace v8::internal 1287 } } // namespace v8::internal
OLDNEW
« src/objects.cc ('K') | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698