Index: src/builtins/x64/builtins-x64.cc |
diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc |
index 2a8de7049a58a1e708f1ac6e336609c1215f97c5..7f5dd84814bd8043e8685ec506442d38be632e58 100644 |
--- a/src/builtins/x64/builtins-x64.cc |
+++ b/src/builtins/x64/builtins-x64.cc |
@@ -1669,13 +1669,9 @@ void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
// -- rsp[8] : thisArg |
// ----------------------------------- |
- // 2. Make sure the receiver is actually callable. |
- Label receiver_not_callable; |
- __ JumpIfSmi(rdi, &receiver_not_callable, Label::kNear); |
- __ movp(rcx, FieldOperand(rdi, HeapObject::kMapOffset)); |
- __ testb(FieldOperand(rcx, Map::kBitFieldOffset), |
- Immediate(1 << Map::kIsCallable)); |
- __ j(zero, &receiver_not_callable, Label::kNear); |
+ // 2. We don't need to check explicitly for callable receiver here, |
+ // since that's the first thing the Call/CallWithArrayLike builtins |
+ // will do. |
// 3. Tail call with no arguments if argArray is null or undefined. |
Label no_arguments; |
@@ -1695,14 +1691,6 @@ void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
__ Set(rax, 0); |
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
} |
- |
- // 4c. The receiver is not callable, throw an appropriate TypeError. |
- __ bind(&receiver_not_callable); |
- { |
- StackArgumentsAccessor args(rsp, 0); |
- __ movp(args.GetReceiverOperand(), rdi); |
- __ TailCallRuntime(Runtime::kThrowApplyNonFunction); |
- } |
} |
// static |
@@ -1798,25 +1786,13 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) { |
// -- rsp[8] : thisArgument |
// ----------------------------------- |
- // 2. Make sure the target is actually callable. |
- Label target_not_callable; |
- __ JumpIfSmi(rdi, &target_not_callable, Label::kNear); |
- __ movp(rcx, FieldOperand(rdi, HeapObject::kMapOffset)); |
- __ testb(FieldOperand(rcx, Map::kBitFieldOffset), |
- Immediate(1 << Map::kIsCallable)); |
- __ j(zero, &target_not_callable, Label::kNear); |
+ // 2. We don't need to check explicitly for callable target here, |
+ // since that's the first thing the Call/CallWithArrayLike builtins |
+ // will do. |
- // 3a. Apply the target to the given argumentsList. |
+ // 3. Apply the target to the given argumentsList. |
__ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
RelocInfo::CODE_TARGET); |
- |
- // 3b. The target is not callable, throw an appropriate TypeError. |
- __ bind(&target_not_callable); |
- { |
- StackArgumentsAccessor args(rsp, 0); |
- __ movp(args.GetReceiverOperand(), rdi); |
- __ TailCallRuntime(Runtime::kThrowApplyNonFunction); |
- } |
} |
void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |