Index: src/x64/builtins-x64.cc |
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc |
index 08cd21d41b00dbaf6a29341c80c211b17a01aec1..43ae7c37ef6b62510cc03f113c250cd04c3fa2bf 100644 |
--- a/src/x64/builtins-x64.cc |
+++ b/src/x64/builtins-x64.cc |
@@ -642,6 +642,13 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
// Change context eagerly in case we need the global receiver. |
__ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
+ // Do not transform the receiver for strict mode functions. |
+ __ movq(rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
+ __ testb(FieldOperand(rbx, SharedFunctionInfo::kStrictModeByteOffset), |
+ Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); |
+ __ j(not_equal, &shift_arguments); |
+ |
+ // Compute the receiver in non-strict mode. |
__ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); |
__ JumpIfSmi(rbx, &convert_to_object); |
@@ -798,6 +805,14 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
// Compute the receiver. |
Label call_to_object, use_global_receiver, push_receiver; |
__ movq(rbx, Operand(rbp, kReceiverOffset)); |
+ |
+ // Do not transform the receiver for strict mode functions. |
+ __ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
+ __ testb(FieldOperand(rdx, SharedFunctionInfo::kStrictModeByteOffset), |
+ Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); |
+ __ j(not_equal, &push_receiver); |
+ |
+ // Compute the receiver in non-strict mode. |
__ JumpIfSmi(rbx, &call_to_object); |
__ CompareRoot(rbx, Heap::kNullValueRootIndex); |
__ j(equal, &use_global_receiver); |