| Index: src/s390/builtins-s390.cc
|
| diff --git a/src/s390/builtins-s390.cc b/src/s390/builtins-s390.cc
|
| index 8e453271b4601b2a744796f701f07df8a51358f4..75d5839a32f3775103b75d888e16449437389c77 100644
|
| --- a/src/s390/builtins-s390.cc
|
| +++ b/src/s390/builtins-s390.cc
|
| @@ -115,6 +115,8 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
|
| 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) * 8] : arg[n] (zero-based)
|
| // -- sp[(argc + 1) * 8] : receiver
|
| @@ -126,58 +128,64 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
|
| 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 r3 and the double value in d1.
|
| - __ LoadRoot(r3, root_index);
|
| - __ LoadDouble(d1, FieldMemOperand(r3, HeapNumber::kValueOffset));
|
| + // +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)
|
| - __ ShiftLeftP(r4, r2, Operand(kPointerSizeLog2));
|
| - __ AddP(r4, sp, r4);
|
| - __ AddP(r5, r2, Operand(1));
|
| + __ AddP(r6, r2, Operand(1));
|
|
|
| Label done_loop, loop;
|
| __ bind(&loop);
|
| {
|
| // Check if all parameters done.
|
| - __ CmpLogicalP(r4, sp);
|
| - __ ble(&done_loop);
|
| + __ SubP(r2, Operand(1));
|
| + __ blt(&done_loop);
|
|
|
| // Load the next parameter tagged value into r2.
|
| - __ lay(r4, MemOperand(r4, -kPointerSize));
|
| - __ LoadP(r2, MemOperand(r4));
|
| + __ ShiftLeftP(r1, r2, 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(r2, &convert_smi);
|
| - __ LoadP(r6, FieldMemOperand(r2, HeapObject::kMapOffset));
|
| - __ JumpIfRoot(r6, Heap::kHeapNumberMapRootIndex, &convert_number);
|
| + __ 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.
|
| - FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
|
| - __ SmiTag(r5);
|
| - __ Push(r3, r4, r5);
|
| + DCHECK(!FLAG_enable_embedded_constant_pool);
|
| + FrameScope scope(masm, StackFrame::MANUAL);
|
| + __ Push(r14, fp, cp, r3);
|
| + __ la(fp, MemOperand(sp, 2 * kPointerSize));
|
| + __ SmiTag(r2);
|
| + __ SmiTag(r6);
|
| + __ Push(r2, r6, r7);
|
| + __ LoadRR(r2, r4);
|
| __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
|
| - __ Pop(r3, r4, r5);
|
| - __ SmiUntag(r5);
|
| + __ LoadRR(r4, r2);
|
| + __ Pop(r2, r6, r7);
|
| {
|
| // Restore the double accumulator value (d1).
|
| Label done_restore;
|
| - __ SmiToDouble(d1, r3);
|
| - __ JumpIfSmi(r3, &done_restore);
|
| - __ LoadDouble(d1, FieldMemOperand(r3, HeapNumber::kValueOffset));
|
| + __ SmiToDouble(d1, r7);
|
| + __ JumpIfSmi(r7, &done_restore);
|
| + __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
|
| __ bind(&done_restore);
|
| }
|
| + __ SmiUntag(r6);
|
| + __ SmiUntag(r2);
|
| + __ Pop(r14, fp, cp, r3);
|
| }
|
| __ b(&convert);
|
| __ bind(&convert_number);
|
| - __ LoadDouble(d2, FieldMemOperand(r2, HeapNumber::kValueOffset));
|
| + __ LoadDouble(d2, FieldMemOperand(r4, HeapNumber::kValueOffset));
|
| __ b(&done_convert);
|
| __ bind(&convert_smi);
|
| - __ SmiToDouble(d2, r2);
|
| + __ SmiToDouble(d2, r4);
|
| __ bind(&done_convert);
|
|
|
| // Perform the actual comparison with the accumulator value on the left hand
|
| @@ -189,26 +197,26 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
|
| __ b(CommuteCondition(cond_done), &compare_swap);
|
|
|
| // Left and right hand side are equal, check for -0 vs. +0.
|
| - __ TestDoubleIsMinusZero(reg, r6, r7);
|
| + __ TestDoubleIsMinusZero(reg, r1, r0);
|
| __ bne(&loop);
|
|
|
| // Update accumulator. Result is on the right hand side.
|
| __ bind(&compare_swap);
|
| __ ldr(d1, d2);
|
| - __ LoadRR(r3, r2);
|
| + __ 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(r3, Heap::kNanValueRootIndex);
|
| - __ LoadDouble(d1, FieldMemOperand(r3, HeapNumber::kValueOffset));
|
| + __ LoadRoot(r7, Heap::kNanValueRootIndex);
|
| + __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
|
| __ b(&loop);
|
| }
|
|
|
| __ bind(&done_loop);
|
| - __ LoadRR(r2, r3);
|
| - __ Drop(r5);
|
| + __ LoadRR(r2, r7);
|
| + __ Drop(r6);
|
| __ Ret();
|
| }
|
|
|
|
|