OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1215 } | 1215 } |
1216 | 1216 |
1217 | 1217 |
1218 void LCodeGen::DoValueOf(LValueOf* instr) { | 1218 void LCodeGen::DoValueOf(LValueOf* instr) { |
1219 Register input = ToRegister(instr->InputAt(0)); | 1219 Register input = ToRegister(instr->InputAt(0)); |
1220 Register result = ToRegister(instr->result()); | 1220 Register result = ToRegister(instr->result()); |
1221 Register map = ToRegister(instr->TempAt(0)); | 1221 Register map = ToRegister(instr->TempAt(0)); |
1222 ASSERT(input.is(result)); | 1222 ASSERT(input.is(result)); |
1223 Label done; | 1223 Label done; |
1224 // If the object is a smi return the object. | 1224 // If the object is a smi return the object. |
1225 __ test(input, Immediate(kSmiTagMask)); | 1225 __ JumpIfSmi(input, &done, Label::kNear); |
1226 __ j(zero, &done, Label::kNear); | |
1227 | 1226 |
1228 // If the object is not a value type, return the object. | 1227 // If the object is not a value type, return the object. |
1229 __ CmpObjectType(input, JS_VALUE_TYPE, map); | 1228 __ CmpObjectType(input, JS_VALUE_TYPE, map); |
1230 __ j(not_equal, &done, Label::kNear); | 1229 __ j(not_equal, &done, Label::kNear); |
1231 __ mov(result, FieldOperand(input, JSValue::kValueOffset)); | 1230 __ mov(result, FieldOperand(input, JSValue::kValueOffset)); |
1232 | 1231 |
1233 __ bind(&done); | 1232 __ bind(&done); |
1234 } | 1233 } |
1235 | 1234 |
1236 | 1235 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1374 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1373 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1375 | 1374 |
1376 __ cmp(reg, factory()->undefined_value()); | 1375 __ cmp(reg, factory()->undefined_value()); |
1377 __ j(equal, false_label); | 1376 __ j(equal, false_label); |
1378 __ cmp(reg, factory()->true_value()); | 1377 __ cmp(reg, factory()->true_value()); |
1379 __ j(equal, true_label); | 1378 __ j(equal, true_label); |
1380 __ cmp(reg, factory()->false_value()); | 1379 __ cmp(reg, factory()->false_value()); |
1381 __ j(equal, false_label); | 1380 __ j(equal, false_label); |
1382 __ test(reg, Operand(reg)); | 1381 __ test(reg, Operand(reg)); |
1383 __ j(equal, false_label); | 1382 __ j(equal, false_label); |
1384 __ test(reg, Immediate(kSmiTagMask)); | 1383 __ JumpIfSmi(reg, true_label); |
1385 __ j(zero, true_label); | |
1386 | 1384 |
1387 // Test for double values. Zero is false. | 1385 // Test for double values. Zero is false. |
1388 Label call_stub; | 1386 Label call_stub; |
1389 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 1387 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
1390 factory()->heap_number_map()); | 1388 factory()->heap_number_map()); |
1391 __ j(not_equal, &call_stub, Label::kNear); | 1389 __ j(not_equal, &call_stub, Label::kNear); |
1392 __ fldz(); | 1390 __ fldz(); |
1393 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); | 1391 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
1394 __ FCmp(); | 1392 __ FCmp(); |
1395 __ j(zero, false_label); | 1393 __ j(zero, false_label); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1597 __ mov(result, factory()->true_value()); | 1595 __ mov(result, factory()->true_value()); |
1598 Label done; | 1596 Label done; |
1599 __ j(equal, &done, Label::kNear); | 1597 __ j(equal, &done, Label::kNear); |
1600 __ mov(result, factory()->false_value()); | 1598 __ mov(result, factory()->false_value()); |
1601 __ bind(&done); | 1599 __ bind(&done); |
1602 } else { | 1600 } else { |
1603 Label true_value, false_value, done; | 1601 Label true_value, false_value, done; |
1604 __ j(equal, &true_value, Label::kNear); | 1602 __ j(equal, &true_value, Label::kNear); |
1605 __ cmp(reg, factory()->undefined_value()); | 1603 __ cmp(reg, factory()->undefined_value()); |
1606 __ j(equal, &true_value, Label::kNear); | 1604 __ j(equal, &true_value, Label::kNear); |
1607 __ test(reg, Immediate(kSmiTagMask)); | 1605 __ JumpIfSmi(reg, &false_value, Label::kNear); |
1608 __ j(zero, &false_value, Label::kNear); | |
1609 // Check for undetectable objects by looking in the bit field in | 1606 // Check for undetectable objects by looking in the bit field in |
1610 // the map. The object has already been smi checked. | 1607 // the map. The object has already been smi checked. |
1611 Register scratch = result; | 1608 Register scratch = result; |
1612 __ mov(scratch, FieldOperand(reg, HeapObject::kMapOffset)); | 1609 __ mov(scratch, FieldOperand(reg, HeapObject::kMapOffset)); |
1613 __ movzx_b(scratch, FieldOperand(scratch, Map::kBitFieldOffset)); | 1610 __ movzx_b(scratch, FieldOperand(scratch, Map::kBitFieldOffset)); |
1614 __ test(scratch, Immediate(1 << Map::kIsUndetectable)); | 1611 __ test(scratch, Immediate(1 << Map::kIsUndetectable)); |
1615 __ j(not_zero, &true_value, Label::kNear); | 1612 __ j(not_zero, &true_value, Label::kNear); |
1616 __ bind(&false_value); | 1613 __ bind(&false_value); |
1617 __ mov(result, factory()->false_value()); | 1614 __ mov(result, factory()->false_value()); |
1618 __ jmp(&done, Label::kNear); | 1615 __ jmp(&done, Label::kNear); |
(...skipping 15 matching lines...) Expand all Loading... | |
1634 | 1631 |
1635 __ cmp(reg, factory()->null_value()); | 1632 __ cmp(reg, factory()->null_value()); |
1636 if (instr->is_strict()) { | 1633 if (instr->is_strict()) { |
1637 EmitBranch(true_block, false_block, equal); | 1634 EmitBranch(true_block, false_block, equal); |
1638 } else { | 1635 } else { |
1639 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1636 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
1640 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1637 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1641 __ j(equal, true_label); | 1638 __ j(equal, true_label); |
1642 __ cmp(reg, factory()->undefined_value()); | 1639 __ cmp(reg, factory()->undefined_value()); |
1643 __ j(equal, true_label); | 1640 __ j(equal, true_label); |
1644 __ test(reg, Immediate(kSmiTagMask)); | 1641 __ JumpIfSmi(reg, false_label); |
1645 __ j(zero, false_label); | |
1646 // Check for undetectable objects by looking in the bit field in | 1642 // Check for undetectable objects by looking in the bit field in |
1647 // the map. The object has already been smi checked. | 1643 // the map. The object has already been smi checked. |
1648 Register scratch = ToRegister(instr->TempAt(0)); | 1644 Register scratch = ToRegister(instr->TempAt(0)); |
1649 __ mov(scratch, FieldOperand(reg, HeapObject::kMapOffset)); | 1645 __ mov(scratch, FieldOperand(reg, HeapObject::kMapOffset)); |
1650 __ movzx_b(scratch, FieldOperand(scratch, Map::kBitFieldOffset)); | 1646 __ movzx_b(scratch, FieldOperand(scratch, Map::kBitFieldOffset)); |
1651 __ test(scratch, Immediate(1 << Map::kIsUndetectable)); | 1647 __ test(scratch, Immediate(1 << Map::kIsUndetectable)); |
1652 EmitBranch(true_block, false_block, not_zero); | 1648 EmitBranch(true_block, false_block, not_zero); |
1653 } | 1649 } |
1654 } | 1650 } |
1655 | 1651 |
1656 | 1652 |
1657 Condition LCodeGen::EmitIsObject(Register input, | 1653 Condition LCodeGen::EmitIsObject(Register input, |
1658 Register temp1, | 1654 Register temp1, |
1659 Register temp2, | 1655 Register temp2, |
1660 Label* is_not_object, | 1656 Label* is_not_object, |
1661 Label* is_object) { | 1657 Label* is_object) { |
1662 ASSERT(!input.is(temp1)); | 1658 ASSERT(!input.is(temp1)); |
1663 ASSERT(!input.is(temp2)); | 1659 ASSERT(!input.is(temp2)); |
1664 ASSERT(!temp1.is(temp2)); | 1660 ASSERT(!temp1.is(temp2)); |
1665 | 1661 |
1666 __ test(input, Immediate(kSmiTagMask)); | 1662 __ JumpIfSmi(input, is_not_object); |
1667 __ j(equal, is_not_object); | |
1668 | 1663 |
1669 __ cmp(input, isolate()->factory()->null_value()); | 1664 __ cmp(input, isolate()->factory()->null_value()); |
1670 __ j(equal, is_object); | 1665 __ j(equal, is_object); |
1671 | 1666 |
1672 __ mov(temp1, FieldOperand(input, HeapObject::kMapOffset)); | 1667 __ mov(temp1, FieldOperand(input, HeapObject::kMapOffset)); |
1673 // Undetectable objects behave like undefined. | 1668 // Undetectable objects behave like undefined. |
1674 __ movzx_b(temp2, FieldOperand(temp1, Map::kBitFieldOffset)); | 1669 __ movzx_b(temp2, FieldOperand(temp1, Map::kBitFieldOffset)); |
1675 __ test(temp2, Immediate(1 << Map::kIsUndetectable)); | 1670 __ test(temp2, Immediate(1 << Map::kIsUndetectable)); |
1676 __ j(not_zero, is_not_object); | 1671 __ j(not_zero, is_not_object); |
1677 | 1672 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1717 | 1712 |
1718 EmitBranch(true_block, false_block, true_cond); | 1713 EmitBranch(true_block, false_block, true_cond); |
1719 } | 1714 } |
1720 | 1715 |
1721 | 1716 |
1722 void LCodeGen::DoIsSmi(LIsSmi* instr) { | 1717 void LCodeGen::DoIsSmi(LIsSmi* instr) { |
1723 Operand input = ToOperand(instr->InputAt(0)); | 1718 Operand input = ToOperand(instr->InputAt(0)); |
1724 Register result = ToRegister(instr->result()); | 1719 Register result = ToRegister(instr->result()); |
1725 | 1720 |
1726 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1721 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
1722 Label done; | |
1723 __ mov(result, factory()->true_value()); | |
1727 __ test(input, Immediate(kSmiTagMask)); | 1724 __ test(input, Immediate(kSmiTagMask)); |
Jakob Kummerow
2011/06/16 10:02:19
Can't replace this because |input| is an Operand r
Lasse Reichstein
2011/06/16 11:50:19
In such cases, the recommended approach is to add
Jakob Kummerow
2011/06/16 12:26:31
Done.
CheckSmi() is only defined for the x64 macro
Lasse Reichstein
2011/06/17 11:54:50
Fine with me.
I'm really only pedantic about X64 c
| |
1728 __ mov(result, factory()->true_value()); | |
1729 Label done; | |
1730 __ j(zero, &done, Label::kNear); | 1725 __ j(zero, &done, Label::kNear); |
1731 __ mov(result, factory()->false_value()); | 1726 __ mov(result, factory()->false_value()); |
1732 __ bind(&done); | 1727 __ bind(&done); |
1733 } | 1728 } |
1734 | 1729 |
1735 | 1730 |
1736 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { | 1731 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
1737 Operand input = ToOperand(instr->InputAt(0)); | 1732 Operand input = ToOperand(instr->InputAt(0)); |
1738 | 1733 |
1739 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1734 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1740 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1735 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1741 | 1736 |
1742 __ test(input, Immediate(kSmiTagMask)); | 1737 __ test(input, Immediate(kSmiTagMask)); |
1743 EmitBranch(true_block, false_block, zero); | 1738 EmitBranch(true_block, false_block, zero); |
1744 } | 1739 } |
1745 | 1740 |
1746 | 1741 |
1747 void LCodeGen::DoIsUndetectable(LIsUndetectable* instr) { | 1742 void LCodeGen::DoIsUndetectable(LIsUndetectable* instr) { |
1748 Register input = ToRegister(instr->InputAt(0)); | 1743 Register input = ToRegister(instr->InputAt(0)); |
1749 Register result = ToRegister(instr->result()); | 1744 Register result = ToRegister(instr->result()); |
1750 | 1745 |
1751 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1746 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
1752 Label false_label, done; | 1747 Label false_label, done; |
1753 STATIC_ASSERT(kSmiTag == 0); | 1748 STATIC_ASSERT(kSmiTag == 0); |
1754 __ test(input, Immediate(kSmiTagMask)); | 1749 __ JumpIfSmi(input, &false_label, Label::kNear); |
1755 __ j(zero, &false_label, Label::kNear); | |
1756 __ mov(result, FieldOperand(input, HeapObject::kMapOffset)); | 1750 __ mov(result, FieldOperand(input, HeapObject::kMapOffset)); |
1757 __ test_b(FieldOperand(result, Map::kBitFieldOffset), | 1751 __ test_b(FieldOperand(result, Map::kBitFieldOffset), |
1758 1 << Map::kIsUndetectable); | 1752 1 << Map::kIsUndetectable); |
1759 __ j(zero, &false_label, Label::kNear); | 1753 __ j(zero, &false_label, Label::kNear); |
1760 __ mov(result, factory()->true_value()); | 1754 __ mov(result, factory()->true_value()); |
1761 __ jmp(&done); | 1755 __ jmp(&done); |
1762 __ bind(&false_label); | 1756 __ bind(&false_label); |
1763 __ mov(result, factory()->false_value()); | 1757 __ mov(result, factory()->false_value()); |
1764 __ bind(&done); | 1758 __ bind(&done); |
1765 } | 1759 } |
1766 | 1760 |
1767 | 1761 |
1768 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { | 1762 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { |
1769 Register input = ToRegister(instr->InputAt(0)); | 1763 Register input = ToRegister(instr->InputAt(0)); |
1770 Register temp = ToRegister(instr->TempAt(0)); | 1764 Register temp = ToRegister(instr->TempAt(0)); |
1771 | 1765 |
1772 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1766 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1773 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1767 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1774 | 1768 |
1775 STATIC_ASSERT(kSmiTag == 0); | 1769 STATIC_ASSERT(kSmiTag == 0); |
1776 __ test(input, Immediate(kSmiTagMask)); | 1770 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); |
1777 __ j(zero, chunk_->GetAssemblyLabel(false_block)); | |
1778 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); | 1771 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); |
1779 __ test_b(FieldOperand(temp, Map::kBitFieldOffset), | 1772 __ test_b(FieldOperand(temp, Map::kBitFieldOffset), |
1780 1 << Map::kIsUndetectable); | 1773 1 << Map::kIsUndetectable); |
1781 EmitBranch(true_block, false_block, not_zero); | 1774 EmitBranch(true_block, false_block, not_zero); |
1782 } | 1775 } |
1783 | 1776 |
1784 | 1777 |
1785 static InstanceType TestType(HHasInstanceType* instr) { | 1778 static InstanceType TestType(HHasInstanceType* instr) { |
1786 InstanceType from = instr->from(); | 1779 InstanceType from = instr->from(); |
1787 InstanceType to = instr->to(); | 1780 InstanceType to = instr->to(); |
(...skipping 12 matching lines...) Expand all Loading... | |
1800 UNREACHABLE(); | 1793 UNREACHABLE(); |
1801 return equal; | 1794 return equal; |
1802 } | 1795 } |
1803 | 1796 |
1804 | 1797 |
1805 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) { | 1798 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) { |
1806 Register input = ToRegister(instr->InputAt(0)); | 1799 Register input = ToRegister(instr->InputAt(0)); |
1807 Register result = ToRegister(instr->result()); | 1800 Register result = ToRegister(instr->result()); |
1808 | 1801 |
1809 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1802 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
1810 __ test(input, Immediate(kSmiTagMask)); | |
1811 Label done, is_false; | 1803 Label done, is_false; |
1812 __ j(zero, &is_false, Label::kNear); | 1804 __ JumpIfSmi(input, &is_false, Label::kNear); |
1813 __ CmpObjectType(input, TestType(instr->hydrogen()), result); | 1805 __ CmpObjectType(input, TestType(instr->hydrogen()), result); |
1814 __ j(NegateCondition(BranchCondition(instr->hydrogen())), | 1806 __ j(NegateCondition(BranchCondition(instr->hydrogen())), |
1815 &is_false, Label::kNear); | 1807 &is_false, Label::kNear); |
1816 __ mov(result, factory()->true_value()); | 1808 __ mov(result, factory()->true_value()); |
1817 __ jmp(&done, Label::kNear); | 1809 __ jmp(&done, Label::kNear); |
1818 __ bind(&is_false); | 1810 __ bind(&is_false); |
1819 __ mov(result, factory()->false_value()); | 1811 __ mov(result, factory()->false_value()); |
1820 __ bind(&done); | 1812 __ bind(&done); |
1821 } | 1813 } |
1822 | 1814 |
1823 | 1815 |
1824 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { | 1816 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { |
1825 Register input = ToRegister(instr->InputAt(0)); | 1817 Register input = ToRegister(instr->InputAt(0)); |
1826 Register temp = ToRegister(instr->TempAt(0)); | 1818 Register temp = ToRegister(instr->TempAt(0)); |
1827 | 1819 |
1828 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1820 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1829 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1821 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1830 | 1822 |
1831 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1823 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1832 | 1824 |
1833 __ test(input, Immediate(kSmiTagMask)); | 1825 __ JumpIfSmi(input, false_label); |
1834 __ j(zero, false_label); | |
1835 | 1826 |
1836 __ CmpObjectType(input, TestType(instr->hydrogen()), temp); | 1827 __ CmpObjectType(input, TestType(instr->hydrogen()), temp); |
1837 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); | 1828 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); |
1838 } | 1829 } |
1839 | 1830 |
1840 | 1831 |
1841 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { | 1832 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { |
1842 Register input = ToRegister(instr->InputAt(0)); | 1833 Register input = ToRegister(instr->InputAt(0)); |
1843 Register result = ToRegister(instr->result()); | 1834 Register result = ToRegister(instr->result()); |
1844 | 1835 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1882 // Branches to a label or falls through with the answer in the z flag. Trashes | 1873 // Branches to a label or falls through with the answer in the z flag. Trashes |
1883 // the temp registers, but not the input. Only input and temp2 may alias. | 1874 // the temp registers, but not the input. Only input and temp2 may alias. |
1884 void LCodeGen::EmitClassOfTest(Label* is_true, | 1875 void LCodeGen::EmitClassOfTest(Label* is_true, |
1885 Label* is_false, | 1876 Label* is_false, |
1886 Handle<String>class_name, | 1877 Handle<String>class_name, |
1887 Register input, | 1878 Register input, |
1888 Register temp, | 1879 Register temp, |
1889 Register temp2) { | 1880 Register temp2) { |
1890 ASSERT(!input.is(temp)); | 1881 ASSERT(!input.is(temp)); |
1891 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. | 1882 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. |
1892 __ test(input, Immediate(kSmiTagMask)); | 1883 __ JumpIfSmi(input, is_false); |
1893 __ j(zero, is_false); | |
1894 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); | 1884 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); |
1895 __ j(below, is_false); | 1885 __ j(below, is_false); |
1896 | 1886 |
1897 // Map is now in temp. | 1887 // Map is now in temp. |
1898 // Functions have class 'Function'. | 1888 // Functions have class 'Function'. |
1899 __ CmpInstanceType(temp, FIRST_CALLABLE_SPEC_OBJECT_TYPE); | 1889 __ CmpInstanceType(temp, FIRST_CALLABLE_SPEC_OBJECT_TYPE); |
1900 if (class_name->IsEqualTo(CStrVector("Function"))) { | 1890 if (class_name->IsEqualTo(CStrVector("Function"))) { |
1901 __ j(above_equal, is_true); | 1891 __ j(above_equal, is_true); |
1902 } else { | 1892 } else { |
1903 __ j(above_equal, is_false); | 1893 __ j(above_equal, is_false); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2029 }; | 2019 }; |
2030 | 2020 |
2031 DeferredInstanceOfKnownGlobal* deferred; | 2021 DeferredInstanceOfKnownGlobal* deferred; |
2032 deferred = new DeferredInstanceOfKnownGlobal(this, instr); | 2022 deferred = new DeferredInstanceOfKnownGlobal(this, instr); |
2033 | 2023 |
2034 Label done, false_result; | 2024 Label done, false_result; |
2035 Register object = ToRegister(instr->InputAt(0)); | 2025 Register object = ToRegister(instr->InputAt(0)); |
2036 Register temp = ToRegister(instr->TempAt(0)); | 2026 Register temp = ToRegister(instr->TempAt(0)); |
2037 | 2027 |
2038 // A Smi is not an instance of anything. | 2028 // A Smi is not an instance of anything. |
2039 __ test(object, Immediate(kSmiTagMask)); | 2029 __ JumpIfSmi(object, &false_result); |
2040 __ j(zero, &false_result); | |
2041 | 2030 |
2042 // This is the inlined call site instanceof cache. The two occurences of the | 2031 // This is the inlined call site instanceof cache. The two occurences of the |
2043 // hole value will be patched to the last map/result pair generated by the | 2032 // hole value will be patched to the last map/result pair generated by the |
2044 // instanceof stub. | 2033 // instanceof stub. |
2045 Label cache_miss; | 2034 Label cache_miss; |
2046 Register map = ToRegister(instr->TempAt(0)); | 2035 Register map = ToRegister(instr->TempAt(0)); |
2047 __ mov(map, FieldOperand(object, HeapObject::kMapOffset)); | 2036 __ mov(map, FieldOperand(object, HeapObject::kMapOffset)); |
2048 __ bind(deferred->map_check()); // Label for calculating code patching. | 2037 __ bind(deferred->map_check()); // Label for calculating code patching. |
2049 __ cmp(map, factory()->the_hole_value()); // Patched to cached map. | 2038 __ cmp(map, factory()->the_hole_value()); // Patched to cached map. |
2050 __ j(not_equal, &cache_miss, Label::kNear); | 2039 __ j(not_equal, &cache_miss, Label::kNear); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2833 __ xorps(scratch, scratch); | 2822 __ xorps(scratch, scratch); |
2834 __ subsd(scratch, input_reg); | 2823 __ subsd(scratch, input_reg); |
2835 __ pand(input_reg, scratch); | 2824 __ pand(input_reg, scratch); |
2836 } else if (r.IsInteger32()) { | 2825 } else if (r.IsInteger32()) { |
2837 EmitIntegerMathAbs(instr); | 2826 EmitIntegerMathAbs(instr); |
2838 } else { // Tagged case. | 2827 } else { // Tagged case. |
2839 DeferredMathAbsTaggedHeapNumber* deferred = | 2828 DeferredMathAbsTaggedHeapNumber* deferred = |
2840 new DeferredMathAbsTaggedHeapNumber(this, instr); | 2829 new DeferredMathAbsTaggedHeapNumber(this, instr); |
2841 Register input_reg = ToRegister(instr->InputAt(0)); | 2830 Register input_reg = ToRegister(instr->InputAt(0)); |
2842 // Smi check. | 2831 // Smi check. |
2843 __ test(input_reg, Immediate(kSmiTagMask)); | 2832 __ JumpIfNotSmi(input_reg, deferred->entry()); |
2844 __ j(not_zero, deferred->entry()); | |
2845 EmitIntegerMathAbs(instr); | 2833 EmitIntegerMathAbs(instr); |
2846 __ bind(deferred->exit()); | 2834 __ bind(deferred->exit()); |
2847 } | 2835 } |
2848 } | 2836 } |
2849 | 2837 |
2850 | 2838 |
2851 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { | 2839 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { |
2852 XMMRegister xmm_scratch = xmm0; | 2840 XMMRegister xmm_scratch = xmm0; |
2853 Register output_reg = ToRegister(instr->result()); | 2841 Register output_reg = ToRegister(instr->result()); |
2854 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); | 2842 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2956 __ movdbl(Operand(esp, 0 * kDoubleSize), ToDoubleRegister(left)); | 2944 __ movdbl(Operand(esp, 0 * kDoubleSize), ToDoubleRegister(left)); |
2957 __ mov(Operand(esp, 1 * kDoubleSize), ToRegister(right)); | 2945 __ mov(Operand(esp, 1 * kDoubleSize), ToRegister(right)); |
2958 __ CallCFunction(ExternalReference::power_double_int_function(isolate()), | 2946 __ CallCFunction(ExternalReference::power_double_int_function(isolate()), |
2959 4); | 2947 4); |
2960 } else { | 2948 } else { |
2961 ASSERT(exponent_type.IsTagged()); | 2949 ASSERT(exponent_type.IsTagged()); |
2962 CpuFeatures::Scope scope(SSE2); | 2950 CpuFeatures::Scope scope(SSE2); |
2963 Register right_reg = ToRegister(right); | 2951 Register right_reg = ToRegister(right); |
2964 | 2952 |
2965 Label non_smi, call; | 2953 Label non_smi, call; |
2966 __ test(right_reg, Immediate(kSmiTagMask)); | 2954 __ JumpIfNotSmi(right_reg, &non_smi); |
2967 __ j(not_zero, &non_smi); | |
2968 __ SmiUntag(right_reg); | 2955 __ SmiUntag(right_reg); |
2969 __ cvtsi2sd(result_reg, Operand(right_reg)); | 2956 __ cvtsi2sd(result_reg, Operand(right_reg)); |
2970 __ jmp(&call); | 2957 __ jmp(&call); |
2971 | 2958 |
2972 __ bind(&non_smi); | 2959 __ bind(&non_smi); |
2973 // It is safe to use ebx directly since the instruction is marked | 2960 // It is safe to use ebx directly since the instruction is marked |
2974 // as a call. | 2961 // as a call. |
2975 ASSERT(!right_reg.is(ebx)); | 2962 ASSERT(!right_reg.is(ebx)); |
2976 __ CmpObjectType(right_reg, HEAP_NUMBER_TYPE , ebx); | 2963 __ CmpObjectType(right_reg, HEAP_NUMBER_TYPE , ebx); |
2977 DeoptimizeIf(not_equal, instr->environment()); | 2964 DeoptimizeIf(not_equal, instr->environment()); |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3624 } | 3611 } |
3625 | 3612 |
3626 | 3613 |
3627 void LCodeGen::EmitNumberUntagD(Register input_reg, | 3614 void LCodeGen::EmitNumberUntagD(Register input_reg, |
3628 XMMRegister result_reg, | 3615 XMMRegister result_reg, |
3629 bool deoptimize_on_undefined, | 3616 bool deoptimize_on_undefined, |
3630 LEnvironment* env) { | 3617 LEnvironment* env) { |
3631 Label load_smi, done; | 3618 Label load_smi, done; |
3632 | 3619 |
3633 // Smi check. | 3620 // Smi check. |
3634 __ test(input_reg, Immediate(kSmiTagMask)); | 3621 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); |
3635 __ j(zero, &load_smi, Label::kNear); | |
3636 | 3622 |
3637 // Heap number map check. | 3623 // Heap number map check. |
3638 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 3624 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
3639 factory()->heap_number_map()); | 3625 factory()->heap_number_map()); |
3640 if (deoptimize_on_undefined) { | 3626 if (deoptimize_on_undefined) { |
3641 DeoptimizeIf(not_equal, env); | 3627 DeoptimizeIf(not_equal, env); |
3642 } else { | 3628 } else { |
3643 Label heap_number; | 3629 Label heap_number; |
3644 __ j(equal, &heap_number, Label::kNear); | 3630 __ j(equal, &heap_number, Label::kNear); |
3645 | 3631 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3759 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 3745 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
3760 LOperand* input = instr->InputAt(0); | 3746 LOperand* input = instr->InputAt(0); |
3761 ASSERT(input->IsRegister()); | 3747 ASSERT(input->IsRegister()); |
3762 ASSERT(input->Equals(instr->result())); | 3748 ASSERT(input->Equals(instr->result())); |
3763 | 3749 |
3764 Register input_reg = ToRegister(input); | 3750 Register input_reg = ToRegister(input); |
3765 | 3751 |
3766 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr); | 3752 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr); |
3767 | 3753 |
3768 // Smi check. | 3754 // Smi check. |
3769 __ test(input_reg, Immediate(kSmiTagMask)); | 3755 __ JumpIfNotSmi(input_reg, deferred->entry()); |
3770 __ j(not_zero, deferred->entry()); | |
3771 | 3756 |
3772 // Smi to int32 conversion | 3757 // Smi to int32 conversion |
3773 __ SmiUntag(input_reg); // Untag smi. | 3758 __ SmiUntag(input_reg); // Untag smi. |
3774 | 3759 |
3775 __ bind(deferred->exit()); | 3760 __ bind(deferred->exit()); |
3776 } | 3761 } |
3777 | 3762 |
3778 | 3763 |
3779 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { | 3764 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
3780 LOperand* input = instr->InputAt(0); | 3765 LOperand* input = instr->InputAt(0); |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4461 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 4446 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
4462 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4447 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4463 } | 4448 } |
4464 | 4449 |
4465 | 4450 |
4466 #undef __ | 4451 #undef __ |
4467 | 4452 |
4468 } } // namespace v8::internal | 4453 } } // namespace v8::internal |
4469 | 4454 |
4470 #endif // V8_TARGET_ARCH_IA32 | 4455 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |