Ensure we don't clobber the cell on ARM and MIPS
authorverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Sat, 1 Feb 2014 10:43:57 +0000 (10:43 +0000)
committerverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Sat, 1 Feb 2014 10:43:57 +0000 (10:43 +0000)
BUG=
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/151543003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19015 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/arm/code-stubs-arm.cc
src/mips/code-stubs-mips.cc

index 3a068c8..44de7aa 100644 (file)
@@ -3111,26 +3111,23 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
   if (CallAsMethod()) {
     if (NeedsChecks()) {
       // Do not transform the receiver for strict mode functions.
-      __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
-      __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset));
-      __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
+      __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
+      __ ldr(r4, FieldMemOperand(r3, SharedFunctionInfo::kCompilerHintsOffset));
+      __ tst(r4, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
                                kSmiTagSize)));
       __ b(ne, &cont);
 
       // Do not transform the receiver for native (Compilerhints already in r3).
-      __ tst(r3, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
+      __ tst(r4, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
       __ b(ne, &cont);
     }
 
     // Compute the receiver in non-strict mode.
-    __ ldr(r2, MemOperand(sp, argc_ * kPointerSize));
+    __ ldr(r3, MemOperand(sp, argc_ * kPointerSize));
 
     if (NeedsChecks()) {
-      // r0: actual number of arguments
-      // r1: function
-      // r2: first argument
-      __ JumpIfSmi(r2, &wrap);
-      __ CompareObjectType(r2, r3, r3, FIRST_SPEC_OBJECT_TYPE);
+      __ JumpIfSmi(r3, &wrap);
+      __ CompareObjectType(r3, r4, r4, FIRST_SPEC_OBJECT_TYPE);
       __ b(lt, &wrap);
     } else {
       __ jmp(&wrap);
@@ -3180,8 +3177,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
     __ bind(&wrap);
     // Wrap the receiver and patch it back onto the stack.
     { FrameScope frame_scope(masm, StackFrame::INTERNAL);
-      __ push(r1);
-      __ push(r2);
+      __ Push(r1, r3);
       __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
       __ pop(r1);
     }
index a062e99..161d73d 100644 (file)
@@ -3257,25 +3257,22 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
   if (CallAsMethod()) {
     if (NeedsChecks()) {
       // Do not transform the receiver for strict mode functions and natives.
-      __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
-      __ lw(a3, FieldMemOperand(a2, SharedFunctionInfo::kCompilerHintsOffset));
+      __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
+      __ lw(a4, FieldMemOperand(a3, SharedFunctionInfo::kCompilerHintsOffset));
       int32_t strict_mode_function_mask =
           1 <<  (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize);
       int32_t native_mask = 1 << (SharedFunctionInfo::kNative + kSmiTagSize);
-      __ And(at, a3, Operand(strict_mode_function_mask | native_mask));
+      __ And(at, a4, Operand(strict_mode_function_mask | native_mask));
       __ Branch(&cont, ne, at, Operand(zero_reg));
     }
 
     // Compute the receiver in non-strict mode.
-    __ lw(a2, MemOperand(sp, argc_ * kPointerSize));
+    __ lw(a3, MemOperand(sp, argc_ * kPointerSize));
 
     if (NeedsChecks()) {
-      // a0: actual number of arguments
-      // a1: function
-      // a2: first argument
-      __ JumpIfSmi(a2, &wrap);
-      __ GetObjectType(a2, a3, a3);
-      __ Branch(&wrap, lt, a3, Operand(FIRST_SPEC_OBJECT_TYPE));
+      __ JumpIfSmi(a3, &wrap);
+      __ GetObjectType(a3, a4, a4);
+      __ Branch(&wrap, lt, a4, Operand(FIRST_SPEC_OBJECT_TYPE));
     } else {
       __ jmp(&wrap);
     }
@@ -3323,7 +3320,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
     __ bind(&wrap);
     // Wrap the receiver and patch it back onto the stack.
     { FrameScope frame_scope(masm, StackFrame::INTERNAL);
-      __ Push(a1, a2);
+      __ Push(a1, a3);
       __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
       __ pop(a1);
     }