Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1260)

Unified Diff: src/arm/builtins-arm.cc

Issue 2112883002: [builtins] Fix MathMaxMin on arm and arm64 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/builtins-arm.cc
diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc
index a8e1df3b4d5dc46c21c850737bd2cfd825de330e..352844cceb55cfba89cb25ea90bf4b5b25b93d7a 100644
--- a/src/arm/builtins-arm.cc
+++ b/src/arm/builtins-arm.cc
@@ -123,12 +123,12 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
// static
void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
// ----------- S t a t e -------------
- // -- r0 : number of arguments
- // -- r1 : function
- // -- cp : context
- // -- lr : return address
- // -- sp[(argc - n) * 8] : arg[n] (zero-based)
- // -- sp[(argc + 1) * 8] : receiver
+ // -- r0 : number of arguments
+ // -- r1 : function
+ // -- cp : context
+ // -- lr : return address
+ // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
+ // -- sp[argc * 4] : receiver
// -----------------------------------
Condition const cc_done = (kind == MathMaxMinKind::kMin) ? mi : gt;
Condition const cc_swap = (kind == MathMaxMinKind::kMin) ? gt : mi;
@@ -142,18 +142,16 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
__ LoadRoot(r5, root_index);
__ vldr(d1, FieldMemOperand(r5, HeapNumber::kValueOffset));
- // Remember how many slots to drop (including the receiver).
- __ add(r4, r0, Operand(1));
-
Label done_loop, loop;
+ __ mov(r4, r0);
__ bind(&loop);
{
// Check if all parameters done.
- __ sub(r0, r0, Operand(1), SetCC);
+ __ sub(r4, r4, Operand(1), SetCC);
__ b(lt, &done_loop);
// Load the next parameter tagged value into r2.
- __ ldr(r2, MemOperand(sp, r0, LSL, kPointerSizeLog2));
+ __ ldr(r2, MemOperand(sp, r4, LSL, kPointerSizeLog2));
// Load the double value of the parameter into d2, maybe converting the
// parameter to a number first using the ToNumber builtin if necessary.
@@ -222,8 +220,10 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
}
__ bind(&done_loop);
+ // Drop all slots, including the receiver.
+ __ add(r0, r0, Operand(1));
+ __ Drop(r0);
__ mov(r0, r5);
- __ Drop(r4);
__ Ret();
}
« no previous file with comments | « no previous file | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698