OLD | NEW |
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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 __ mov(ebx, masm->isolate()->factory()->undefined_value()); | 1546 __ mov(ebx, masm->isolate()->factory()->undefined_value()); |
1547 ArrayConstructorStub stub(masm->isolate()); | 1547 ArrayConstructorStub stub(masm->isolate()); |
1548 __ TailCallStub(&stub); | 1548 __ TailCallStub(&stub); |
1549 } | 1549 } |
1550 | 1550 |
1551 | 1551 |
1552 // static | 1552 // static |
1553 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { | 1553 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
1554 // ----------- S t a t e ------------- | 1554 // ----------- S t a t e ------------- |
1555 // -- eax : number of arguments | 1555 // -- eax : number of arguments |
| 1556 // -- edi : function |
| 1557 // -- esi : context |
1556 // -- esp[0] : return address | 1558 // -- esp[0] : return address |
1557 // -- esp[(argc - n) * 8] : arg[n] (zero-based) | 1559 // -- esp[(argc - n) * 8] : arg[n] (zero-based) |
1558 // -- esp[(argc + 1) * 8] : receiver | 1560 // -- esp[(argc + 1) * 8] : receiver |
1559 // ----------------------------------- | 1561 // ----------------------------------- |
1560 Condition const cc = (kind == MathMaxMinKind::kMin) ? below : above; | 1562 Condition const cc = (kind == MathMaxMinKind::kMin) ? below : above; |
1561 Heap::RootListIndex const root_index = | 1563 Heap::RootListIndex const root_index = |
1562 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex | 1564 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex |
1563 : Heap::kMinusInfinityValueRootIndex; | 1565 : Heap::kMinusInfinityValueRootIndex; |
1564 XMMRegister const reg = (kind == MathMaxMinKind::kMin) ? xmm1 : xmm0; | 1566 XMMRegister const reg = (kind == MathMaxMinKind::kMin) ? xmm1 : xmm0; |
1565 | 1567 |
(...skipping 15 matching lines...) Expand all Loading... |
1581 | 1583 |
1582 // Load the double value of the parameter into xmm1, maybe converting the | 1584 // Load the double value of the parameter into xmm1, maybe converting the |
1583 // parameter to a number first using the ToNumberStub if necessary. | 1585 // parameter to a number first using the ToNumberStub if necessary. |
1584 Label convert, convert_smi, convert_number, done_convert; | 1586 Label convert, convert_smi, convert_number, done_convert; |
1585 __ bind(&convert); | 1587 __ bind(&convert); |
1586 __ JumpIfSmi(ebx, &convert_smi); | 1588 __ JumpIfSmi(ebx, &convert_smi); |
1587 __ JumpIfRoot(FieldOperand(ebx, HeapObject::kMapOffset), | 1589 __ JumpIfRoot(FieldOperand(ebx, HeapObject::kMapOffset), |
1588 Heap::kHeapNumberMapRootIndex, &convert_number); | 1590 Heap::kHeapNumberMapRootIndex, &convert_number); |
1589 { | 1591 { |
1590 // Parameter is not a Number, use the ToNumberStub to convert it. | 1592 // Parameter is not a Number, use the ToNumberStub to convert it. |
1591 FrameScope scope(masm, StackFrame::INTERNAL); | 1593 FrameScope scope(masm, StackFrame::MANUAL); |
| 1594 __ Push(ebp); |
| 1595 __ Move(ebp, esp); |
| 1596 __ Push(esi); |
| 1597 __ Push(edi); |
1592 __ SmiTag(eax); | 1598 __ SmiTag(eax); |
1593 __ SmiTag(ecx); | 1599 __ SmiTag(ecx); |
1594 __ Push(eax); | 1600 __ Push(eax); |
1595 __ Push(ecx); | 1601 __ Push(ecx); |
1596 __ Push(edx); | 1602 __ Push(edx); |
1597 __ mov(eax, ebx); | 1603 __ mov(eax, ebx); |
1598 ToNumberStub stub(masm->isolate()); | 1604 ToNumberStub stub(masm->isolate()); |
1599 __ CallStub(&stub); | 1605 __ CallStub(&stub); |
1600 __ mov(ebx, eax); | 1606 __ mov(ebx, eax); |
1601 __ Pop(edx); | 1607 __ Pop(edx); |
1602 __ Pop(ecx); | 1608 __ Pop(ecx); |
1603 __ Pop(eax); | 1609 __ Pop(eax); |
| 1610 __ Pop(edi); |
| 1611 __ Pop(esi); |
1604 { | 1612 { |
1605 // Restore the double accumulator value (xmm0). | 1613 // Restore the double accumulator value (xmm0). |
1606 Label restore_smi, done_restore; | 1614 Label restore_smi, done_restore; |
1607 __ JumpIfSmi(edx, &restore_smi, Label::kNear); | 1615 __ JumpIfSmi(edx, &restore_smi, Label::kNear); |
1608 __ movsd(xmm0, FieldOperand(edx, HeapNumber::kValueOffset)); | 1616 __ movsd(xmm0, FieldOperand(edx, HeapNumber::kValueOffset)); |
1609 __ jmp(&done_restore, Label::kNear); | 1617 __ jmp(&done_restore, Label::kNear); |
1610 __ bind(&restore_smi); | 1618 __ bind(&restore_smi); |
1611 __ SmiUntag(edx); | 1619 __ SmiUntag(edx); |
1612 __ Cvtsi2sd(xmm0, edx); | 1620 __ Cvtsi2sd(xmm0, edx); |
1613 __ SmiTag(edx); | 1621 __ SmiTag(edx); |
1614 __ bind(&done_restore); | 1622 __ bind(&done_restore); |
1615 } | 1623 } |
1616 __ SmiUntag(ecx); | 1624 __ SmiUntag(ecx); |
1617 __ SmiUntag(eax); | 1625 __ SmiUntag(eax); |
| 1626 __ leave(); |
1618 } | 1627 } |
1619 __ jmp(&convert); | 1628 __ jmp(&convert); |
1620 __ bind(&convert_number); | 1629 __ bind(&convert_number); |
1621 __ movsd(xmm1, FieldOperand(ebx, HeapNumber::kValueOffset)); | 1630 __ movsd(xmm1, FieldOperand(ebx, HeapNumber::kValueOffset)); |
1622 __ jmp(&done_convert, Label::kNear); | 1631 __ jmp(&done_convert, Label::kNear); |
1623 __ bind(&convert_smi); | 1632 __ bind(&convert_smi); |
1624 __ SmiUntag(ebx); | 1633 __ SmiUntag(ebx); |
1625 __ Cvtsi2sd(xmm1, ebx); | 1634 __ Cvtsi2sd(xmm1, ebx); |
1626 __ SmiTag(ebx); | 1635 __ SmiTag(ebx); |
1627 __ bind(&done_convert); | 1636 __ bind(&done_convert); |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2856 // And "return" to the OSR entry point of the function. | 2865 // And "return" to the OSR entry point of the function. |
2857 __ ret(0); | 2866 __ ret(0); |
2858 } | 2867 } |
2859 | 2868 |
2860 | 2869 |
2861 #undef __ | 2870 #undef __ |
2862 } // namespace internal | 2871 } // namespace internal |
2863 } // namespace v8 | 2872 } // namespace v8 |
2864 | 2873 |
2865 #endif // V8_TARGET_ARCH_IA32 | 2874 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |