Chromium Code Reviews| Index: src/x64/builtins-x64.cc |
| diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc |
| index 08cd21d41b00dbaf6a29341c80c211b17a01aec1..a3db6872a5781ab2fb14cb778a22911608d3d576 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)); |
| + __ movl(rbx, FieldOperand(rbx, SharedFunctionInfo::kCompilerHintsOffset)); |
| + __ testl(rbx, Immediate(1 << SharedFunctionInfo::kStrictModeFunction)); |
| + __ j(not_equal, &shift_arguments); |
| + |
| + // Compute the receiver in non-strict mode. |
|
Martin Maly
2011/02/15 05:14:00
Tricky ... on 64 bit the fields in SharedFunctionI
|
| __ 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)); |
| + __ movl(rdx, FieldOperand(rdx, SharedFunctionInfo::kCompilerHintsOffset)); |
| + __ testl(rdx, Immediate(1 << SharedFunctionInfo::kStrictModeFunction)); |
| + __ 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); |