Chromium Code Reviews| Index: src/mips/builtins-mips.cc |
| diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc |
| index a93e8ab4f890dc2adf6edd93d28739826c21b9be..ae3f40ce00015a8dc110bdd3bcf7be4d14a7205a 100644 |
| --- a/src/mips/builtins-mips.cc |
| +++ b/src/mips/builtins-mips.cc |
| @@ -128,12 +128,12 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
| // static |
| 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 |
| + // -- a0 : number of arguments |
| + // -- a1 : function |
| + // -- cp : context |
| + // -- ra : return address |
| + // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
| + // -- sp[argc * 4] : receiver |
| // ----------------------------------- |
| Heap::RootListIndex const root_index = |
| (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex |
| @@ -143,17 +143,17 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
| // +Infinity), with the tagged value in t2 and the double value in f0. |
| __ LoadRoot(t2, root_index); |
| __ ldc1(f0, FieldMemOperand(t2, HeapNumber::kValueOffset)); |
| - __ Addu(a3, a0, Operand(1)); |
| Label done_loop, loop; |
| + __ mov(a3, a0); |
| __ bind(&loop); |
| { |
| // Check if all parameters done. |
| - __ Subu(a0, a0, Operand(1)); |
| - __ Branch(&done_loop, lt, a0, Operand(zero_reg)); |
| + __ Subu(a3, a3, Operand(1)); |
| + __ Branch(&done_loop, lt, a3, Operand(zero_reg)); |
|
ivica.bogosavljevic
2016/07/01 12:40:50
You could fill delay slot here, the next instructi
balazs.kilvady
2016/07/01 13:17:25
Since we support r6 I try to avoid delay slot usag
|
| // Load the next parameter tagged value into a2. |
| - __ Lsa(at, sp, a0, kPointerSizeLog2); |
| + __ Lsa(at, sp, a3, kPointerSizeLog2); |
| __ lw(a2, MemOperand(at)); |
| // Load the double value of the parameter into f2, maybe converting the |
| @@ -228,7 +228,9 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
| } |
| __ bind(&done_loop); |
| - __ Lsa(sp, sp, a3, kPointerSizeLog2); |
| + // Drop all slots, including the receiver. |
| + __ Addu(a0, a0, Operand(1)); |
| + __ Lsa(sp, sp, a0, kPointerSizeLog2); |
| __ Ret(USE_DELAY_SLOT); |
| __ mov(v0, t2); // In delay slot. |
| } |