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

Unified Diff: src/builtins/s390/builtins-s390.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/ppc/builtins-ppc.cc ('k') | src/builtins/x64/builtins-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/s390/builtins-s390.cc
diff --git a/src/builtins/s390/builtins-s390.cc b/src/builtins/s390/builtins-s390.cc
index 429282d69e15b1d8250b03d17c41e49c20fa52e2..d6fea3d02df3963f476339366a9754b07f373015 100644
--- a/src/builtins/s390/builtins-s390.cc
+++ b/src/builtins/s390/builtins-s390.cc
@@ -117,117 +117,6 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
}
// static
-void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
- // ----------- S t a t e -------------
- // -- r2 : number of arguments
- // -- r3 : function
- // -- cp : context
- // -- lr : return address
- // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
- // -- sp[argc * 4] : receiver
- // -----------------------------------
- Condition const cond_done = (kind == MathMaxMinKind::kMin) ? lt : gt;
- 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 r7 and the double value in d1.
- __ LoadRoot(r7, root_index);
- __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
-
- // Setup state for loop
- // r4: address of arg[0] + kPointerSize
- // r5: number of slots to drop at exit (arguments + receiver)
- __ AddP(r6, r2, Operand(1));
-
- Label done_loop, loop;
- __ LoadRR(r6, r2);
- __ bind(&loop);
- {
- // Check if all parameters done.
- __ SubP(r6, Operand(1));
- __ blt(&done_loop);
-
- // Load the next parameter tagged value into r2.
- __ ShiftLeftP(r1, r6, Operand(kPointerSizeLog2));
- __ LoadP(r4, MemOperand(sp, r1));
-
- // 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(r4, &convert_smi);
- __ LoadP(r5, FieldMemOperand(r4, HeapObject::kMapOffset));
- __ JumpIfRoot(r5, 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(r2);
- __ SmiTag(r6);
- __ EnterBuiltinFrame(cp, r3, r2);
- __ Push(r6, r7);
- __ LoadRR(r2, r4);
- __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
- __ LoadRR(r4, r2);
- __ Pop(r6, r7);
- __ LeaveBuiltinFrame(cp, r3, r2);
- __ SmiUntag(r6);
- __ SmiUntag(r2);
- {
- // Restore the double accumulator value (d1).
- Label done_restore;
- __ SmiToDouble(d1, r7);
- __ JumpIfSmi(r7, &done_restore);
- __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
- __ bind(&done_restore);
- }
- }
- __ b(&convert);
- __ bind(&convert_number);
- __ LoadDouble(d2, FieldMemOperand(r4, HeapNumber::kValueOffset));
- __ b(&done_convert);
- __ bind(&convert_smi);
- __ SmiToDouble(d2, r4);
- __ 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;
- __ cdbr(d1, d2);
- __ bunordered(&compare_nan);
- __ b(cond_done, &loop);
- __ b(CommuteCondition(cond_done), &compare_swap);
-
- // Left and right hand side are equal, check for -0 vs. +0.
- __ TestDoubleIsMinusZero(reg, r1, r0);
- __ bne(&loop);
-
- // Update accumulator. Result is on the right hand side.
- __ bind(&compare_swap);
- __ ldr(d1, d2);
- __ LoadRR(r7, r4);
- __ b(&loop);
-
- // At least one side is NaN, which means that the result will be NaN too.
- // We still need to visit the rest of the arguments.
- __ bind(&compare_nan);
- __ LoadRoot(r7, Heap::kNanValueRootIndex);
- __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
- __ b(&loop);
- }
-
- __ bind(&done_loop);
- // Drop all slots, including the receiver.
- __ AddP(r2, Operand(1));
- __ Drop(r2);
- __ LoadRR(r2, r7);
- __ Ret();
-}
-
-// static
void Builtins::Generate_NumberConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r2 : number of arguments
« no previous file with comments | « src/builtins/ppc/builtins-ppc.cc ('k') | src/builtins/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698