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

Unified Diff: src/arm64/builtins-arm64.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 | « src/arm/builtins-arm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/builtins-arm64.cc
diff --git a/src/arm64/builtins-arm64.cc b/src/arm64/builtins-arm64.cc
index 6615eb23b2629eb5f5e127695d246dcacdee0667..375b8082988a0550efbd15ba20cbfde0bb860988 100644
--- a/src/arm64/builtins-arm64.cc
+++ b/src/arm64/builtins-arm64.cc
@@ -124,12 +124,12 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
// static
void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
// ----------- S t a t e -------------
- // -- x0 : number of arguments
- // -- x1 : function
- // -- cp : context
- // -- lr : return address
- // -- sp[(argc - n) * 8] : arg[n] (zero-based)
- // -- sp[(argc + 1) * 8] : receiver
+ // -- x0 : number of arguments
+ // -- x1 : function
+ // -- cp : context
+ // -- lr : return address
+ // -- sp[(argc - n - 1) * 8] : arg[n] (zero-based)
+ // -- sp[argc * 8] : receiver
// -----------------------------------
ASM_LOCATION("Builtins::Generate_MathMaxMin");
@@ -142,18 +142,16 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
__ LoadRoot(x5, root_index);
__ Ldr(d5, FieldMemOperand(x5, HeapNumber::kValueOffset));
- // Remember how many slots to drop (including the receiver).
- __ Add(x4, x0, 1);
-
Label done_loop, loop;
+ __ mov(x4, x0);
__ Bind(&loop);
{
// Check if all parameters done.
- __ Subs(x0, x0, 1);
+ __ Subs(x4, x4, 1);
__ B(lt, &done_loop);
// Load the next parameter tagged value into x2.
- __ Peek(x2, Operand(x0, LSL, kPointerSizeLog2));
+ __ Peek(x2, Operand(x4, 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.
@@ -212,7 +210,9 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
}
__ Bind(&done_loop);
- __ Drop(x4);
+ // Drop all slots, including the receiver.
+ __ Add(x0, x0, 1);
+ __ Drop(x0);
__ Mov(x0, x5);
__ Ret();
}
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698