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

Side by Side Diff: src/x64/builtins-x64.cc

Issue 1902373002: [builtins] Introduce a proper BUILTIN frame type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex); 1613 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex);
1614 ArrayConstructorStub stub(masm->isolate()); 1614 ArrayConstructorStub stub(masm->isolate());
1615 __ TailCallStub(&stub); 1615 __ TailCallStub(&stub);
1616 } 1616 }
1617 1617
1618 1618
1619 // static 1619 // static
1620 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { 1620 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
1621 // ----------- S t a t e ------------- 1621 // ----------- S t a t e -------------
1622 // -- rax : number of arguments 1622 // -- rax : number of arguments
1623 // -- rdi : function
1624 // -- rsi : context
1623 // -- rsp[0] : return address 1625 // -- rsp[0] : return address
1624 // -- rsp[(argc - n) * 8] : arg[n] (zero-based) 1626 // -- rsp[(argc - n) * 8] : arg[n] (zero-based)
1625 // -- rsp[(argc + 1) * 8] : receiver 1627 // -- rsp[(argc + 1) * 8] : receiver
1626 // ----------------------------------- 1628 // -----------------------------------
1627 Condition const cc = (kind == MathMaxMinKind::kMin) ? below : above; 1629 Condition const cc = (kind == MathMaxMinKind::kMin) ? below : above;
1628 Heap::RootListIndex const root_index = 1630 Heap::RootListIndex const root_index =
1629 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex 1631 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex
1630 : Heap::kMinusInfinityValueRootIndex; 1632 : Heap::kMinusInfinityValueRootIndex;
1631 XMMRegister const reg = (kind == MathMaxMinKind::kMin) ? xmm1 : xmm0; 1633 XMMRegister const reg = (kind == MathMaxMinKind::kMin) ? xmm1 : xmm0;
1632 1634
(...skipping 15 matching lines...) Expand all
1648 1650
1649 // Load the double value of the parameter into xmm1, maybe converting the 1651 // Load the double value of the parameter into xmm1, maybe converting the
1650 // parameter to a number first using the ToNumberStub if necessary. 1652 // parameter to a number first using the ToNumberStub if necessary.
1651 Label convert, convert_smi, convert_number, done_convert; 1653 Label convert, convert_smi, convert_number, done_convert;
1652 __ bind(&convert); 1654 __ bind(&convert);
1653 __ JumpIfSmi(rbx, &convert_smi); 1655 __ JumpIfSmi(rbx, &convert_smi);
1654 __ JumpIfRoot(FieldOperand(rbx, HeapObject::kMapOffset), 1656 __ JumpIfRoot(FieldOperand(rbx, HeapObject::kMapOffset),
1655 Heap::kHeapNumberMapRootIndex, &convert_number); 1657 Heap::kHeapNumberMapRootIndex, &convert_number);
1656 { 1658 {
1657 // Parameter is not a Number, use the ToNumberStub to convert it. 1659 // Parameter is not a Number, use the ToNumberStub to convert it.
1658 FrameScope scope(masm, StackFrame::INTERNAL); 1660 FrameScope scope(masm, StackFrame::MANUAL);
1661 __ Push(rbp);
1662 __ Move(rbp, rsp);
1663 __ Push(rsi);
1664 __ Push(rdi);
1659 __ Integer32ToSmi(rax, rax); 1665 __ Integer32ToSmi(rax, rax);
1660 __ Integer32ToSmi(rcx, rcx); 1666 __ Integer32ToSmi(rcx, rcx);
1661 __ Push(rax); 1667 __ Push(rax);
1662 __ Push(rcx); 1668 __ Push(rcx);
1663 __ Push(rdx); 1669 __ Push(rdx);
1664 __ movp(rax, rbx); 1670 __ movp(rax, rbx);
1665 ToNumberStub stub(masm->isolate()); 1671 ToNumberStub stub(masm->isolate());
1666 __ CallStub(&stub); 1672 __ CallStub(&stub);
1667 __ movp(rbx, rax); 1673 __ movp(rbx, rax);
1668 __ Pop(rdx); 1674 __ Pop(rdx);
1669 __ Pop(rcx); 1675 __ Pop(rcx);
1670 __ Pop(rax); 1676 __ Pop(rax);
1677 __ Pop(rdi);
1678 __ Pop(rsi);
1671 { 1679 {
1672 // Restore the double accumulator value (xmm0). 1680 // Restore the double accumulator value (xmm0).
1673 Label restore_smi, done_restore; 1681 Label restore_smi, done_restore;
1674 __ JumpIfSmi(rdx, &restore_smi, Label::kNear); 1682 __ JumpIfSmi(rdx, &restore_smi, Label::kNear);
1675 __ Movsd(xmm0, FieldOperand(rdx, HeapNumber::kValueOffset)); 1683 __ Movsd(xmm0, FieldOperand(rdx, HeapNumber::kValueOffset));
1676 __ jmp(&done_restore, Label::kNear); 1684 __ jmp(&done_restore, Label::kNear);
1677 __ bind(&restore_smi); 1685 __ bind(&restore_smi);
1678 __ SmiToDouble(xmm0, rdx); 1686 __ SmiToDouble(xmm0, rdx);
1679 __ bind(&done_restore); 1687 __ bind(&done_restore);
1680 } 1688 }
1681 __ SmiToInteger32(rcx, rcx); 1689 __ SmiToInteger32(rcx, rcx);
1682 __ SmiToInteger32(rax, rax); 1690 __ SmiToInteger32(rax, rax);
1691 __ leave();
1683 } 1692 }
1684 __ jmp(&convert); 1693 __ jmp(&convert);
1685 __ bind(&convert_number); 1694 __ bind(&convert_number);
1686 __ Movsd(xmm1, FieldOperand(rbx, HeapNumber::kValueOffset)); 1695 __ Movsd(xmm1, FieldOperand(rbx, HeapNumber::kValueOffset));
1687 __ jmp(&done_convert, Label::kNear); 1696 __ jmp(&done_convert, Label::kNear);
1688 __ bind(&convert_smi); 1697 __ bind(&convert_smi);
1689 __ SmiToDouble(xmm1, rbx); 1698 __ SmiToDouble(xmm1, rbx);
1690 __ bind(&done_convert); 1699 __ bind(&done_convert);
1691 1700
1692 // Perform the actual comparison with the accumulator value on the left hand 1701 // Perform the actual comparison with the accumulator value on the left hand
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2917 __ ret(0); 2926 __ ret(0);
2918 } 2927 }
2919 2928
2920 2929
2921 #undef __ 2930 #undef __
2922 2931
2923 } // namespace internal 2932 } // namespace internal
2924 } // namespace v8 2933 } // namespace v8
2925 2934
2926 #endif // V8_TARGET_ARCH_X64 2935 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698