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

Side by Side Diff: src/x64/builtins-x64.cc

Issue 1752133004: [proxies] throw TypeError in [[Call]] if is_callable Map bit is unset (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: move bit test for MIPS/MIPS64 ports, too Created 4 years, 9 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/mips64/builtins-mips64.cc ('k') | test/mjsunit/harmony/proxies-apply.js » ('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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 2402
2403 Label non_callable, non_function, non_smi; 2403 Label non_callable, non_function, non_smi;
2404 __ JumpIfSmi(rdi, &non_callable); 2404 __ JumpIfSmi(rdi, &non_callable);
2405 __ bind(&non_smi); 2405 __ bind(&non_smi);
2406 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); 2406 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
2407 __ j(equal, masm->isolate()->builtins()->CallFunction(mode, tail_call_mode), 2407 __ j(equal, masm->isolate()->builtins()->CallFunction(mode, tail_call_mode),
2408 RelocInfo::CODE_TARGET); 2408 RelocInfo::CODE_TARGET);
2409 __ CmpInstanceType(rcx, JS_BOUND_FUNCTION_TYPE); 2409 __ CmpInstanceType(rcx, JS_BOUND_FUNCTION_TYPE);
2410 __ j(equal, masm->isolate()->builtins()->CallBoundFunction(tail_call_mode), 2410 __ j(equal, masm->isolate()->builtins()->CallBoundFunction(tail_call_mode),
2411 RelocInfo::CODE_TARGET); 2411 RelocInfo::CODE_TARGET);
2412
2413 // Check if target has a [[Call]] internal method.
2414 __ testb(FieldOperand(rcx, Map::kBitFieldOffset),
2415 Immediate(1 << Map::kIsCallable));
2416 __ j(zero, &non_callable);
2417
2412 __ CmpInstanceType(rcx, JS_PROXY_TYPE); 2418 __ CmpInstanceType(rcx, JS_PROXY_TYPE);
2413 __ j(not_equal, &non_function); 2419 __ j(not_equal, &non_function);
2414 2420
2415 // 0. Prepare for tail call if necessary. 2421 // 0. Prepare for tail call if necessary.
2416 if (tail_call_mode == TailCallMode::kAllow) { 2422 if (tail_call_mode == TailCallMode::kAllow) {
2417 PrepareForTailCall(masm, rax, rbx, rcx, r8); 2423 PrepareForTailCall(masm, rax, rbx, rcx, r8);
2418 } 2424 }
2419 2425
2420 // 1. Runtime fallback for Proxy [[Call]]. 2426 // 1. Runtime fallback for Proxy [[Call]].
2421 __ PopReturnAddressTo(kScratchRegister); 2427 __ PopReturnAddressTo(kScratchRegister);
2422 __ Push(rdi); 2428 __ Push(rdi);
2423 __ PushReturnAddressFrom(kScratchRegister); 2429 __ PushReturnAddressFrom(kScratchRegister);
2424 // Increase the arguments size to include the pushed function and the 2430 // Increase the arguments size to include the pushed function and the
2425 // existing receiver on the stack. 2431 // existing receiver on the stack.
2426 __ addp(rax, Immediate(2)); 2432 __ addp(rax, Immediate(2));
2427 // Tail-call to the runtime. 2433 // Tail-call to the runtime.
2428 __ JumpToExternalReference( 2434 __ JumpToExternalReference(
2429 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); 2435 ExternalReference(Runtime::kJSProxyCall, masm->isolate()));
2430 2436
2431 // 2. Call to something else, which might have a [[Call]] internal method (if 2437 // 2. Call to something else, which might have a [[Call]] internal method (if
2432 // not we raise an exception). 2438 // not we raise an exception).
2433 __ bind(&non_function); 2439 __ bind(&non_function);
2434 // Check if target has a [[Call]] internal method.
2435 __ testb(FieldOperand(rcx, Map::kBitFieldOffset),
2436 Immediate(1 << Map::kIsCallable));
2437 __ j(zero, &non_callable, Label::kNear);
2438 // Overwrite the original receiver with the (original) target. 2440 // Overwrite the original receiver with the (original) target.
2439 __ movp(args.GetReceiverOperand(), rdi); 2441 __ movp(args.GetReceiverOperand(), rdi);
2440 // Let the "call_as_function_delegate" take care of the rest. 2442 // Let the "call_as_function_delegate" take care of the rest.
2441 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, rdi); 2443 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, rdi);
2442 __ Jump(masm->isolate()->builtins()->CallFunction( 2444 __ Jump(masm->isolate()->builtins()->CallFunction(
2443 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode), 2445 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode),
2444 RelocInfo::CODE_TARGET); 2446 RelocInfo::CODE_TARGET);
2445 2447
2446 // 3. Call to something that is not callable. 2448 // 3. Call to something that is not callable.
2447 __ bind(&non_callable); 2449 __ bind(&non_callable);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 __ ret(0); 2743 __ ret(0);
2742 } 2744 }
2743 2745
2744 2746
2745 #undef __ 2747 #undef __
2746 2748
2747 } // namespace internal 2749 } // namespace internal
2748 } // namespace v8 2750 } // namespace v8
2749 2751
2750 #endif // V8_TARGET_ARCH_X64 2752 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | test/mjsunit/harmony/proxies-apply.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698