Index: src/ia32/builtins-ia32.cc |
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc |
index 0a3e0930560bf5f656a7c6768852bfb6157d2c80..fb0171cd2b55744427f300e6979fee4d6721a049 100644 |
--- a/src/ia32/builtins-ia32.cc |
+++ b/src/ia32/builtins-ia32.cc |
@@ -589,6 +589,14 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
// Change context eagerly in case we need the global receiver. |
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
+ // Do not transform the receiver for strict mode functions. |
+ __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
+ __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kCompilerHintsOffset)); |
+ __ test(ebx, Immediate(1 << (SharedFunctionInfo::kStrictModeFunction + |
+ kSmiTagSize))); |
+ __ j(not_equal, &shift_arguments); |
+ |
+ // Compute the receiver in non-strict mode. |
__ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument. |
__ test(ebx, Immediate(kSmiTagMask)); |
__ j(zero, &convert_to_object); |
@@ -736,6 +744,15 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
// Compute the receiver. |
Label call_to_object, use_global_receiver, push_receiver; |
__ mov(ebx, Operand(ebp, 3 * kPointerSize)); |
+ |
+ // Do not transform the receiver for strict mode functions. |
+ __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
+ __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kCompilerHintsOffset)); |
+ __ test(ecx, Immediate(1 << (SharedFunctionInfo::kStrictModeFunction + |
+ kSmiTagSize))); |
Lasse Reichstein
2011/02/15 08:46:55
You can test directly against memory, without load
Mads Ager (chromium)
2011/02/15 08:50:12
If you do use the byte version, please introduce s
Martin Maly
2011/02/15 19:18:43
Done.
|
+ __ j(not_equal, &push_receiver); |
+ |
+ // Compute the receiver in non-strict mode. |
__ test(ebx, Immediate(kSmiTagMask)); |
__ j(zero, &call_to_object); |
__ cmp(ebx, Factory::null_value()); |