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

Unified Diff: src/builtins/arm/builtins-arm.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 | « no previous file | src/builtins/arm64/builtins-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/arm/builtins-arm.cc
diff --git a/src/builtins/arm/builtins-arm.cc b/src/builtins/arm/builtins-arm.cc
index 72292e7ecfb1733c3b8b9715bf8e83532112b851..378dc3664230a22a1273968ce7d410cc55470c46 100644
--- a/src/builtins/arm/builtins-arm.cc
+++ b/src/builtins/arm/builtins-arm.cc
@@ -120,112 +120,6 @@ 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 - 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;
- Heap::RootListIndex const root_index =
- (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex
- : Heap::kMinusInfinityValueRootIndex;
- DoubleRegister const reg = (kind == MathMaxMinKind::kMin) ? d2 : d1;
-
- // Load the accumulator with the default return value (either -Infinity or
- // +Infinity), with the tagged value in r5 and the double value in d1.
- __ LoadRoot(r5, root_index);
- __ vldr(d1, FieldMemOperand(r5, HeapNumber::kValueOffset));
-
- Label done_loop, loop;
- __ mov(r4, r0);
- __ bind(&loop);
- {
- // Check if all parameters done.
- __ sub(r4, r4, Operand(1), SetCC);
- __ b(lt, &done_loop);
-
- // Load the next parameter tagged value into r2.
- __ 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.
- Label convert, convert_smi, convert_number, done_convert;
- __ bind(&convert);
- __ JumpIfSmi(r2, &convert_smi);
- __ ldr(r3, FieldMemOperand(r2, HeapObject::kMapOffset));
- __ JumpIfRoot(r3, Heap::kHeapNumberMapRootIndex, &convert_number);
- {
- // Parameter is not a Number, use the ToNumber builtin to convert it.
- DCHECK(!FLAG_enable_embedded_constant_pool);
- FrameScope scope(masm, StackFrame::MANUAL);
- __ SmiTag(r0);
- __ SmiTag(r4);
- __ EnterBuiltinFrame(cp, r1, r0);
- __ Push(r4, r5);
- __ mov(r0, r2);
- __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
- __ mov(r2, r0);
- __ Pop(r4, r5);
- __ LeaveBuiltinFrame(cp, r1, r0);
- __ SmiUntag(r4);
- __ SmiUntag(r0);
- {
- // Restore the double accumulator value (d1).
- Label done_restore;
- __ SmiToDouble(d1, r5);
- __ JumpIfSmi(r5, &done_restore);
- __ vldr(d1, FieldMemOperand(r5, HeapNumber::kValueOffset));
- __ bind(&done_restore);
- }
- }
- __ b(&convert);
- __ bind(&convert_number);
- __ vldr(d2, FieldMemOperand(r2, HeapNumber::kValueOffset));
- __ b(&done_convert);
- __ bind(&convert_smi);
- __ SmiToDouble(d2, r2);
- __ bind(&done_convert);
-
- // Perform the actual comparison with the accumulator value on the left hand
- // side (d1) and the next parameter value on the right hand side (d2).
- Label compare_nan, compare_swap;
- __ VFPCompareAndSetFlags(d1, d2);
- __ b(cc_done, &loop);
- __ b(cc_swap, &compare_swap);
- __ b(vs, &compare_nan);
-
- // Left and right hand side are equal, check for -0 vs. +0.
- __ VmovHigh(ip, reg);
- __ cmp(ip, Operand(0x80000000));
- __ b(ne, &loop);
-
- // Result is on the right hand side.
- __ bind(&compare_swap);
- __ vmov(d1, d2);
- __ mov(r5, r2);
- __ b(&loop);
-
- // At least one side is NaN, which means that the result will be NaN too.
- __ bind(&compare_nan);
- __ LoadRoot(r5, Heap::kNanValueRootIndex);
- __ vldr(d1, FieldMemOperand(r5, HeapNumber::kValueOffset));
- __ b(&loop);
- }
-
- __ bind(&done_loop);
- // Drop all slots, including the receiver.
- __ add(r0, r0, Operand(1));
- __ Drop(r0);
- __ mov(r0, r5);
- __ Ret();
-}
-
-// static
void Builtins::Generate_NumberConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r0 : number of arguments
« no previous file with comments | « no previous file | src/builtins/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698