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

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

Issue 2728463006: Migrate Math.Min/Max to CodeStubAssembler (Closed)
Patch Set: ChangeFloat64ToTagged Created 3 years, 10 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/builtins/arm/builtins-arm.cc ('k') | src/builtins/builtins.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/arm64/builtins-arm64.cc
diff --git a/src/builtins/arm64/builtins-arm64.cc b/src/builtins/arm64/builtins-arm64.cc
index 74e6c701332cdbf7bbf522e5c1bb541b4138c29d..79184bebe176cfa9494d234bef47fc53c5e88078 100644
--- a/src/builtins/arm64/builtins-arm64.cc
+++ b/src/builtins/arm64/builtins-arm64.cc
@@ -118,100 +118,6 @@ 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 - 1) * 8] : arg[n] (zero-based)
- // -- sp[argc * 8] : receiver
- // -----------------------------------
- ASM_LOCATION("Builtins::Generate_MathMaxMin");
-
- Heap::RootListIndex const root_index =
- (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex
- : Heap::kMinusInfinityValueRootIndex;
-
- // Load the accumulator with the default return value (either -Infinity or
- // +Infinity), with the tagged value in x5 and the double value in d5.
- __ LoadRoot(x5, root_index);
- __ Ldr(d5, FieldMemOperand(x5, HeapNumber::kValueOffset));
-
- Label done_loop, loop;
- __ mov(x4, x0);
- __ Bind(&loop);
- {
- // Check if all parameters done.
- __ Subs(x4, x4, 1);
- __ B(lt, &done_loop);
-
- // Load the next parameter tagged value into x2.
- __ 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.
- Label convert_smi, convert_number, done_convert;
- __ JumpIfSmi(x2, &convert_smi);
- __ JumpIfHeapNumber(x2, &convert_number);
- {
- // Parameter is not a Number, use the ToNumber builtin to convert it.
- FrameScope scope(masm, StackFrame::MANUAL);
- __ SmiTag(x0);
- __ SmiTag(x4);
- __ EnterBuiltinFrame(cp, x1, x0);
- __ Push(x5, x4);
- __ Mov(x0, x2);
- __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
- __ Mov(x2, x0);
- __ Pop(x4, x5);
- __ LeaveBuiltinFrame(cp, x1, x0);
- __ SmiUntag(x4);
- __ SmiUntag(x0);
- {
- // Restore the double accumulator value (d5).
- Label done_restore;
- __ SmiUntagToDouble(d5, x5, kSpeculativeUntag);
- __ JumpIfSmi(x5, &done_restore);
- __ Ldr(d5, FieldMemOperand(x5, HeapNumber::kValueOffset));
- __ Bind(&done_restore);
- }
- }
- __ AssertNumber(x2);
- __ JumpIfSmi(x2, &convert_smi);
-
- __ Bind(&convert_number);
- __ Ldr(d2, FieldMemOperand(x2, HeapNumber::kValueOffset));
- __ B(&done_convert);
-
- __ Bind(&convert_smi);
- __ SmiUntagToDouble(d2, x2);
- __ Bind(&done_convert);
-
- // We can use a single fmin/fmax for the operation itself, but we then need
- // to work out which HeapNumber (or smi) the result came from.
- __ Fmov(x11, d5);
- if (kind == MathMaxMinKind::kMin) {
- __ Fmin(d5, d5, d2);
- } else {
- DCHECK(kind == MathMaxMinKind::kMax);
- __ Fmax(d5, d5, d2);
- }
- __ Fmov(x10, d5);
- __ Cmp(x10, x11);
- __ Csel(x5, x5, x2, eq);
- __ B(&loop);
- }
-
- __ Bind(&done_loop);
- // Drop all slots, including the receiver.
- __ Add(x0, x0, 1);
- __ Drop(x0);
- __ Mov(x0, x5);
- __ Ret();
-}
-
-// static
void Builtins::Generate_NumberConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- x0 : number of arguments
« no previous file with comments | « src/builtins/arm/builtins-arm.cc ('k') | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698