Index: src/mips/builtins-mips.cc |
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc |
index b7fedf9bee99017e354bb85b8970a98e8a86a4d8..537d948a87495974497ae044d820599910e6f758 100644 |
--- a/src/mips/builtins-mips.cc |
+++ b/src/mips/builtins-mips.cc |
@@ -145,6 +145,8 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
// ----------- S t a t e ------------- |
// -- a0 : number of arguments |
+ // -- a1 : function |
+ // -- cp : context |
// -- ra : return address |
// -- sp[(argc - n) * 8] : arg[n] (zero-based) |
// -- sp[(argc + 1) * 8] : receiver |
@@ -154,10 +156,10 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
: Heap::kMinusInfinityValueRootIndex; |
// Load the accumulator with the default return value (either -Infinity or |
- // +Infinity), with the tagged value in a1 and the double value in f0. |
- __ LoadRoot(a1, root_index); |
- __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); |
- __ Addu(a3, a0, Operand(1)); |
+ // +Infinity), with the tagged value in t1 and the double value in f0. |
+ __ LoadRoot(t1, root_index); |
+ __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset)); |
+ __ mov(a3, a0); |
Label done_loop, loop; |
__ bind(&loop); |
@@ -179,27 +181,32 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
__ JumpIfRoot(t0, Heap::kHeapNumberMapRootIndex, &convert_number); |
{ |
// Parameter is not a Number, use the ToNumberStub to convert it. |
- FrameScope scope(masm, StackFrame::INTERNAL); |
+ FrameScope scope(masm, StackFrame::MANUAL); |
+ __ Push(ra, fp); |
+ __ Move(fp, sp); |
+ __ Push(cp, a1); |
__ SmiTag(a0); |
__ SmiTag(a3); |
- __ Push(a0, a1, a3); |
+ __ Push(a0, t1, a3); |
__ mov(a0, a2); |
ToNumberStub stub(masm->isolate()); |
__ CallStub(&stub); |
__ mov(a2, v0); |
- __ Pop(a0, a1, a3); |
+ __ Pop(a0, t1, a3); |
{ |
// Restore the double accumulator value (f0). |
Label restore_smi, done_restore; |
- __ JumpIfSmi(a1, &restore_smi); |
- __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); |
+ __ JumpIfSmi(t1, &restore_smi); |
+ __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset)); |
__ jmp(&done_restore); |
__ bind(&restore_smi); |
- __ SmiToDoubleFPURegister(a1, f0, t0); |
+ __ SmiToDoubleFPURegister(t1, f0, t0); |
__ bind(&done_restore); |
} |
__ SmiUntag(a3); |
__ SmiUntag(a0); |
+ __ Pop(cp, a1); |
+ __ Pop(ra, fp); |
} |
__ jmp(&convert); |
__ bind(&convert_number); |
@@ -227,20 +234,21 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
__ Branch(&set_value, ne, t1, Operand(t8)); |
__ jmp(&loop); |
__ bind(&set_value); |
- __ mov(a1, a2); |
+ __ mov(t1, a2); |
__ jmp(&loop); |
// At least one side is NaN, which means that the result will be NaN too. |
__ bind(&compare_nan); |
- __ LoadRoot(a1, Heap::kNanValueRootIndex); |
- __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); |
+ __ LoadRoot(t1, Heap::kNanValueRootIndex); |
+ __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset)); |
__ jmp(&loop); |
} |
__ bind(&done_loop); |
__ Lsa(sp, sp, a3, kPointerSizeLog2); |
+ __ Addu(sp, sp, kPointerSize); |
__ Ret(USE_DELAY_SLOT); |
- __ mov(v0, a1); // In delay slot. |
+ __ mov(v0, t1); // In delay slot. |
} |
// static |