Index: src/builtins/x64/builtins-x64.cc |
diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc |
index 703a7e7aa8e86eb41f311bf44427c47166d92821..b4f63c6a33b08dbb840e8b9895477fe53f38ddb2 100644 |
--- a/src/builtins/x64/builtins-x64.cc |
+++ b/src/builtins/x64/builtins-x64.cc |
@@ -1684,119 +1684,6 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
} |
// static |
-void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
- // ----------- S t a t e ------------- |
- // -- rax : number of arguments |
- // -- rdi : function |
- // -- rsi : context |
- // -- rsp[0] : return address |
- // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
- // -- rsp[(argc + 1) * 8] : receiver |
- // ----------------------------------- |
- Condition const cc = (kind == MathMaxMinKind::kMin) ? below : above; |
- Heap::RootListIndex const root_index = |
- (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex |
- : Heap::kMinusInfinityValueRootIndex; |
- XMMRegister const reg = (kind == MathMaxMinKind::kMin) ? xmm1 : xmm0; |
- |
- // Load the accumulator with the default return value (either -Infinity or |
- // +Infinity), with the tagged value in rdx and the double value in xmm0. |
- __ LoadRoot(rdx, root_index); |
- __ Movsd(xmm0, FieldOperand(rdx, HeapNumber::kValueOffset)); |
- __ Move(rcx, rax); |
- |
- Label done_loop, loop; |
- __ bind(&loop); |
- { |
- // Check if all parameters done. |
- __ testp(rcx, rcx); |
- __ j(zero, &done_loop); |
- |
- // Load the next parameter tagged value into rbx. |
- __ movp(rbx, Operand(rsp, rcx, times_pointer_size, 0)); |
- |
- // Load the double value of the parameter into xmm1, 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(rbx, &convert_smi); |
- __ JumpIfRoot(FieldOperand(rbx, HeapObject::kMapOffset), |
- Heap::kHeapNumberMapRootIndex, &convert_number); |
- { |
- // Parameter is not a Number, use the ToNumber builtin to convert it. |
- FrameScope scope(masm, StackFrame::MANUAL); |
- __ Integer32ToSmi(rax, rax); |
- __ Integer32ToSmi(rcx, rcx); |
- __ EnterBuiltinFrame(rsi, rdi, rax); |
- __ Push(rcx); |
- __ Push(rdx); |
- __ movp(rax, rbx); |
- __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
- __ movp(rbx, rax); |
- __ Pop(rdx); |
- __ Pop(rcx); |
- __ LeaveBuiltinFrame(rsi, rdi, rax); |
- __ SmiToInteger32(rcx, rcx); |
- __ SmiToInteger32(rax, rax); |
- { |
- // Restore the double accumulator value (xmm0). |
- Label restore_smi, done_restore; |
- __ JumpIfSmi(rdx, &restore_smi, Label::kNear); |
- __ Movsd(xmm0, FieldOperand(rdx, HeapNumber::kValueOffset)); |
- __ jmp(&done_restore, Label::kNear); |
- __ bind(&restore_smi); |
- __ SmiToDouble(xmm0, rdx); |
- __ bind(&done_restore); |
- } |
- } |
- __ jmp(&convert); |
- __ bind(&convert_number); |
- __ Movsd(xmm1, FieldOperand(rbx, HeapNumber::kValueOffset)); |
- __ jmp(&done_convert, Label::kNear); |
- __ bind(&convert_smi); |
- __ SmiToDouble(xmm1, rbx); |
- __ bind(&done_convert); |
- |
- // Perform the actual comparison with the accumulator value on the left hand |
- // side (xmm0) and the next parameter value on the right hand side (xmm1). |
- Label compare_equal, compare_nan, compare_swap, done_compare; |
- __ Ucomisd(xmm0, xmm1); |
- __ j(parity_even, &compare_nan, Label::kNear); |
- __ j(cc, &done_compare, Label::kNear); |
- __ j(equal, &compare_equal, Label::kNear); |
- |
- // Result is on the right hand side. |
- __ bind(&compare_swap); |
- __ Movaps(xmm0, xmm1); |
- __ Move(rdx, rbx); |
- __ jmp(&done_compare, Label::kNear); |
- |
- // At least one side is NaN, which means that the result will be NaN too. |
- __ bind(&compare_nan); |
- __ LoadRoot(rdx, Heap::kNanValueRootIndex); |
- __ Movsd(xmm0, FieldOperand(rdx, HeapNumber::kValueOffset)); |
- __ jmp(&done_compare, Label::kNear); |
- |
- // Left and right hand side are equal, check for -0 vs. +0. |
- __ bind(&compare_equal); |
- __ Movmskpd(kScratchRegister, reg); |
- __ testl(kScratchRegister, Immediate(1)); |
- __ j(not_zero, &compare_swap); |
- |
- __ bind(&done_compare); |
- __ decp(rcx); |
- __ jmp(&loop); |
- } |
- |
- __ bind(&done_loop); |
- __ PopReturnAddressTo(rcx); |
- __ leap(rsp, Operand(rsp, rax, times_pointer_size, kPointerSize)); |
- __ PushReturnAddressFrom(rcx); |
- __ movp(rax, rdx); |
- __ Ret(); |
-} |
- |
-// static |
void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- rax : number of arguments |