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()); |
1727 __ test(input, Immediate(kSmiTagMask)); | 1722 Label done; |
1728 __ mov(result, factory()->true_value()); | 1723 __ mov(result, factory()->true_value()); |
1729 Label done; | 1724 __ JumpIfSmi(input, &done, Label::kNear); |
1730 __ j(zero, &done, Label::kNear); | |
1731 __ mov(result, factory()->false_value()); | 1725 __ mov(result, factory()->false_value()); |
1732 __ bind(&done); | 1726 __ bind(&done); |
1733 } | 1727 } |
1734 | 1728 |
1735 | 1729 |
1736 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { | 1730 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
1737 Operand input = ToOperand(instr->InputAt(0)); | 1731 Operand input = ToOperand(instr->InputAt(0)); |
1738 | 1732 |
1739 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1733 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1740 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1734 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1741 | 1735 |
1742 __ test(input, Immediate(kSmiTagMask)); | 1736 __ test(input, Immediate(kSmiTagMask)); |
1743 EmitBranch(true_block, false_block, zero); | 1737 EmitBranch(true_block, false_block, zero); |
1744 } | 1738 } |
1745 | 1739 |
1746 | 1740 |
1747 void LCodeGen::DoIsUndetectable(LIsUndetectable* instr) { | 1741 void LCodeGen::DoIsUndetectable(LIsUndetectable* instr) { |
1748 Register input = ToRegister(instr->InputAt(0)); | 1742 Register input = ToRegister(instr->InputAt(0)); |
1749 Register result = ToRegister(instr->result()); | 1743 Register result = ToRegister(instr->result()); |
1750 | 1744 |
1751 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1745 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
1752 Label false_label, done; | 1746 Label false_label, done; |
1753 STATIC_ASSERT(kSmiTag == 0); | 1747 STATIC_ASSERT(kSmiTag == 0); |
1754 __ test(input, Immediate(kSmiTagMask)); | 1748 __ JumpIfSmi(input, &false_label, Label::kNear); |
1755 __ j(zero, &false_label, Label::kNear); | |
1756 __ mov(result, FieldOperand(input, HeapObject::kMapOffset)); | 1749 __ mov(result, FieldOperand(input, HeapObject::kMapOffset)); |
1757 __ test_b(FieldOperand(result, Map::kBitFieldOffset), | 1750 __ test_b(FieldOperand(result, Map::kBitFieldOffset), |
1758 1 << Map::kIsUndetectable); | 1751 1 << Map::kIsUndetectable); |
1759 __ j(zero, &false_label, Label::kNear); | 1752 __ j(zero, &false_label, Label::kNear); |
1760 __ mov(result, factory()->true_value()); | 1753 __ mov(result, factory()->true_value()); |
1761 __ jmp(&done); | 1754 __ jmp(&done); |
1762 __ bind(&false_label); | 1755 __ bind(&false_label); |
1763 __ mov(result, factory()->false_value()); | 1756 __ mov(result, factory()->false_value()); |
1764 __ bind(&done); | 1757 __ bind(&done); |
1765 } | 1758 } |
1766 | 1759 |
1767 | 1760 |
1768 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { | 1761 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { |
1769 Register input = ToRegister(instr->InputAt(0)); | 1762 Register input = ToRegister(instr->InputAt(0)); |
1770 Register temp = ToRegister(instr->TempAt(0)); | 1763 Register temp = ToRegister(instr->TempAt(0)); |
1771 | 1764 |
1772 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1765 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1773 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1766 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1774 | 1767 |
1775 STATIC_ASSERT(kSmiTag == 0); | 1768 STATIC_ASSERT(kSmiTag == 0); |
1776 __ test(input, Immediate(kSmiTagMask)); | 1769 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); |
1777 __ j(zero, chunk_->GetAssemblyLabel(false_block)); | |
1778 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); | 1770 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); |
1779 __ test_b(FieldOperand(temp, Map::kBitFieldOffset), | 1771 __ test_b(FieldOperand(temp, Map::kBitFieldOffset), |
1780 1 << Map::kIsUndetectable); | 1772 1 << Map::kIsUndetectable); |
1781 EmitBranch(true_block, false_block, not_zero); | 1773 EmitBranch(true_block, false_block, not_zero); |
1782 } | 1774 } |
1783 | 1775 |
1784 | 1776 |
1785 static InstanceType TestType(HHasInstanceType* instr) { | 1777 static InstanceType TestType(HHasInstanceType* instr) { |
1786 InstanceType from = instr->from(); | 1778 InstanceType from = instr->from(); |
1787 InstanceType to = instr->to(); | 1779 InstanceType to = instr->to(); |
(...skipping 12 matching lines...) Expand all Loading... |
1800 UNREACHABLE(); | 1792 UNREACHABLE(); |
1801 return equal; | 1793 return equal; |
1802 } | 1794 } |
1803 | 1795 |
1804 | 1796 |
1805 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) { | 1797 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) { |
1806 Register input = ToRegister(instr->InputAt(0)); | 1798 Register input = ToRegister(instr->InputAt(0)); |
1807 Register result = ToRegister(instr->result()); | 1799 Register result = ToRegister(instr->result()); |
1808 | 1800 |
1809 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1801 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
1810 __ test(input, Immediate(kSmiTagMask)); | |
1811 Label done, is_false; | 1802 Label done, is_false; |
1812 __ j(zero, &is_false, Label::kNear); | 1803 __ JumpIfSmi(input, &is_false, Label::kNear); |
1813 __ CmpObjectType(input, TestType(instr->hydrogen()), result); | 1804 __ CmpObjectType(input, TestType(instr->hydrogen()), result); |
1814 __ j(NegateCondition(BranchCondition(instr->hydrogen())), | 1805 __ j(NegateCondition(BranchCondition(instr->hydrogen())), |
1815 &is_false, Label::kNear); | 1806 &is_false, Label::kNear); |
1816 __ mov(result, factory()->true_value()); | 1807 __ mov(result, factory()->true_value()); |
1817 __ jmp(&done, Label::kNear); | 1808 __ jmp(&done, Label::kNear); |
1818 __ bind(&is_false); | 1809 __ bind(&is_false); |
1819 __ mov(result, factory()->false_value()); | 1810 __ mov(result, factory()->false_value()); |
1820 __ bind(&done); | 1811 __ bind(&done); |
1821 } | 1812 } |
1822 | 1813 |
1823 | 1814 |
1824 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { | 1815 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { |
1825 Register input = ToRegister(instr->InputAt(0)); | 1816 Register input = ToRegister(instr->InputAt(0)); |
1826 Register temp = ToRegister(instr->TempAt(0)); | 1817 Register temp = ToRegister(instr->TempAt(0)); |
1827 | 1818 |
1828 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1819 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1829 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1820 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1830 | 1821 |
1831 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1822 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1832 | 1823 |
1833 __ test(input, Immediate(kSmiTagMask)); | 1824 __ JumpIfSmi(input, false_label); |
1834 __ j(zero, false_label); | |
1835 | 1825 |
1836 __ CmpObjectType(input, TestType(instr->hydrogen()), temp); | 1826 __ CmpObjectType(input, TestType(instr->hydrogen()), temp); |
1837 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); | 1827 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); |
1838 } | 1828 } |
1839 | 1829 |
1840 | 1830 |
1841 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { | 1831 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { |
1842 Register input = ToRegister(instr->InputAt(0)); | 1832 Register input = ToRegister(instr->InputAt(0)); |
1843 Register result = ToRegister(instr->result()); | 1833 Register result = ToRegister(instr->result()); |
1844 | 1834 |
(...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 | 1872 // 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. | 1873 // the temp registers, but not the input. Only input and temp2 may alias. |
1884 void LCodeGen::EmitClassOfTest(Label* is_true, | 1874 void LCodeGen::EmitClassOfTest(Label* is_true, |
1885 Label* is_false, | 1875 Label* is_false, |
1886 Handle<String>class_name, | 1876 Handle<String>class_name, |
1887 Register input, | 1877 Register input, |
1888 Register temp, | 1878 Register temp, |
1889 Register temp2) { | 1879 Register temp2) { |
1890 ASSERT(!input.is(temp)); | 1880 ASSERT(!input.is(temp)); |
1891 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. | 1881 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. |
1892 __ test(input, Immediate(kSmiTagMask)); | 1882 __ JumpIfSmi(input, is_false); |
1893 __ j(zero, is_false); | |
1894 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); | 1883 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); |
1895 __ j(below, is_false); | 1884 __ j(below, is_false); |
1896 | 1885 |
1897 // Map is now in temp. | 1886 // Map is now in temp. |
1898 // Functions have class 'Function'. | 1887 // Functions have class 'Function'. |
1899 __ CmpInstanceType(temp, FIRST_CALLABLE_SPEC_OBJECT_TYPE); | 1888 __ CmpInstanceType(temp, FIRST_CALLABLE_SPEC_OBJECT_TYPE); |
1900 if (class_name->IsEqualTo(CStrVector("Function"))) { | 1889 if (class_name->IsEqualTo(CStrVector("Function"))) { |
1901 __ j(above_equal, is_true); | 1890 __ j(above_equal, is_true); |
1902 } else { | 1891 } else { |
1903 __ j(above_equal, is_false); | 1892 __ j(above_equal, is_false); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 }; | 2018 }; |
2030 | 2019 |
2031 DeferredInstanceOfKnownGlobal* deferred; | 2020 DeferredInstanceOfKnownGlobal* deferred; |
2032 deferred = new DeferredInstanceOfKnownGlobal(this, instr); | 2021 deferred = new DeferredInstanceOfKnownGlobal(this, instr); |
2033 | 2022 |
2034 Label done, false_result; | 2023 Label done, false_result; |
2035 Register object = ToRegister(instr->InputAt(0)); | 2024 Register object = ToRegister(instr->InputAt(0)); |
2036 Register temp = ToRegister(instr->TempAt(0)); | 2025 Register temp = ToRegister(instr->TempAt(0)); |
2037 | 2026 |
2038 // A Smi is not an instance of anything. | 2027 // A Smi is not an instance of anything. |
2039 __ test(object, Immediate(kSmiTagMask)); | 2028 __ JumpIfSmi(object, &false_result); |
2040 __ j(zero, &false_result); | |
2041 | 2029 |
2042 // This is the inlined call site instanceof cache. The two occurences of the | 2030 // 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 | 2031 // hole value will be patched to the last map/result pair generated by the |
2044 // instanceof stub. | 2032 // instanceof stub. |
2045 Label cache_miss; | 2033 Label cache_miss; |
2046 Register map = ToRegister(instr->TempAt(0)); | 2034 Register map = ToRegister(instr->TempAt(0)); |
2047 __ mov(map, FieldOperand(object, HeapObject::kMapOffset)); | 2035 __ mov(map, FieldOperand(object, HeapObject::kMapOffset)); |
2048 __ bind(deferred->map_check()); // Label for calculating code patching. | 2036 __ bind(deferred->map_check()); // Label for calculating code patching. |
2049 __ cmp(map, factory()->the_hole_value()); // Patched to cached map. | 2037 __ cmp(map, factory()->the_hole_value()); // Patched to cached map. |
2050 __ j(not_equal, &cache_miss, Label::kNear); | 2038 __ j(not_equal, &cache_miss, Label::kNear); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2833 __ xorps(scratch, scratch); | 2821 __ xorps(scratch, scratch); |
2834 __ subsd(scratch, input_reg); | 2822 __ subsd(scratch, input_reg); |
2835 __ pand(input_reg, scratch); | 2823 __ pand(input_reg, scratch); |
2836 } else if (r.IsInteger32()) { | 2824 } else if (r.IsInteger32()) { |
2837 EmitIntegerMathAbs(instr); | 2825 EmitIntegerMathAbs(instr); |
2838 } else { // Tagged case. | 2826 } else { // Tagged case. |
2839 DeferredMathAbsTaggedHeapNumber* deferred = | 2827 DeferredMathAbsTaggedHeapNumber* deferred = |
2840 new DeferredMathAbsTaggedHeapNumber(this, instr); | 2828 new DeferredMathAbsTaggedHeapNumber(this, instr); |
2841 Register input_reg = ToRegister(instr->InputAt(0)); | 2829 Register input_reg = ToRegister(instr->InputAt(0)); |
2842 // Smi check. | 2830 // Smi check. |
2843 __ test(input_reg, Immediate(kSmiTagMask)); | 2831 __ JumpIfNotSmi(input_reg, deferred->entry()); |
2844 __ j(not_zero, deferred->entry()); | |
2845 EmitIntegerMathAbs(instr); | 2832 EmitIntegerMathAbs(instr); |
2846 __ bind(deferred->exit()); | 2833 __ bind(deferred->exit()); |
2847 } | 2834 } |
2848 } | 2835 } |
2849 | 2836 |
2850 | 2837 |
2851 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { | 2838 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { |
2852 XMMRegister xmm_scratch = xmm0; | 2839 XMMRegister xmm_scratch = xmm0; |
2853 Register output_reg = ToRegister(instr->result()); | 2840 Register output_reg = ToRegister(instr->result()); |
2854 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); | 2841 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)); | 2943 __ movdbl(Operand(esp, 0 * kDoubleSize), ToDoubleRegister(left)); |
2957 __ mov(Operand(esp, 1 * kDoubleSize), ToRegister(right)); | 2944 __ mov(Operand(esp, 1 * kDoubleSize), ToRegister(right)); |
2958 __ CallCFunction(ExternalReference::power_double_int_function(isolate()), | 2945 __ CallCFunction(ExternalReference::power_double_int_function(isolate()), |
2959 4); | 2946 4); |
2960 } else { | 2947 } else { |
2961 ASSERT(exponent_type.IsTagged()); | 2948 ASSERT(exponent_type.IsTagged()); |
2962 CpuFeatures::Scope scope(SSE2); | 2949 CpuFeatures::Scope scope(SSE2); |
2963 Register right_reg = ToRegister(right); | 2950 Register right_reg = ToRegister(right); |
2964 | 2951 |
2965 Label non_smi, call; | 2952 Label non_smi, call; |
2966 __ test(right_reg, Immediate(kSmiTagMask)); | 2953 __ JumpIfNotSmi(right_reg, &non_smi); |
2967 __ j(not_zero, &non_smi); | |
2968 __ SmiUntag(right_reg); | 2954 __ SmiUntag(right_reg); |
2969 __ cvtsi2sd(result_reg, Operand(right_reg)); | 2955 __ cvtsi2sd(result_reg, Operand(right_reg)); |
2970 __ jmp(&call); | 2956 __ jmp(&call); |
2971 | 2957 |
2972 __ bind(&non_smi); | 2958 __ bind(&non_smi); |
2973 // It is safe to use ebx directly since the instruction is marked | 2959 // It is safe to use ebx directly since the instruction is marked |
2974 // as a call. | 2960 // as a call. |
2975 ASSERT(!right_reg.is(ebx)); | 2961 ASSERT(!right_reg.is(ebx)); |
2976 __ CmpObjectType(right_reg, HEAP_NUMBER_TYPE , ebx); | 2962 __ CmpObjectType(right_reg, HEAP_NUMBER_TYPE , ebx); |
2977 DeoptimizeIf(not_equal, instr->environment()); | 2963 DeoptimizeIf(not_equal, instr->environment()); |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3624 } | 3610 } |
3625 | 3611 |
3626 | 3612 |
3627 void LCodeGen::EmitNumberUntagD(Register input_reg, | 3613 void LCodeGen::EmitNumberUntagD(Register input_reg, |
3628 XMMRegister result_reg, | 3614 XMMRegister result_reg, |
3629 bool deoptimize_on_undefined, | 3615 bool deoptimize_on_undefined, |
3630 LEnvironment* env) { | 3616 LEnvironment* env) { |
3631 Label load_smi, done; | 3617 Label load_smi, done; |
3632 | 3618 |
3633 // Smi check. | 3619 // Smi check. |
3634 __ test(input_reg, Immediate(kSmiTagMask)); | 3620 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); |
3635 __ j(zero, &load_smi, Label::kNear); | |
3636 | 3621 |
3637 // Heap number map check. | 3622 // Heap number map check. |
3638 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 3623 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
3639 factory()->heap_number_map()); | 3624 factory()->heap_number_map()); |
3640 if (deoptimize_on_undefined) { | 3625 if (deoptimize_on_undefined) { |
3641 DeoptimizeIf(not_equal, env); | 3626 DeoptimizeIf(not_equal, env); |
3642 } else { | 3627 } else { |
3643 Label heap_number; | 3628 Label heap_number; |
3644 __ j(equal, &heap_number, Label::kNear); | 3629 __ j(equal, &heap_number, Label::kNear); |
3645 | 3630 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3759 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 3744 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
3760 LOperand* input = instr->InputAt(0); | 3745 LOperand* input = instr->InputAt(0); |
3761 ASSERT(input->IsRegister()); | 3746 ASSERT(input->IsRegister()); |
3762 ASSERT(input->Equals(instr->result())); | 3747 ASSERT(input->Equals(instr->result())); |
3763 | 3748 |
3764 Register input_reg = ToRegister(input); | 3749 Register input_reg = ToRegister(input); |
3765 | 3750 |
3766 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr); | 3751 DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr); |
3767 | 3752 |
3768 // Smi check. | 3753 // Smi check. |
3769 __ test(input_reg, Immediate(kSmiTagMask)); | 3754 __ JumpIfNotSmi(input_reg, deferred->entry()); |
3770 __ j(not_zero, deferred->entry()); | |
3771 | 3755 |
3772 // Smi to int32 conversion | 3756 // Smi to int32 conversion |
3773 __ SmiUntag(input_reg); // Untag smi. | 3757 __ SmiUntag(input_reg); // Untag smi. |
3774 | 3758 |
3775 __ bind(deferred->exit()); | 3759 __ bind(deferred->exit()); |
3776 } | 3760 } |
3777 | 3761 |
3778 | 3762 |
3779 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { | 3763 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
3780 LOperand* input = instr->InputAt(0); | 3764 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)); | 4445 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
4462 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4446 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4463 } | 4447 } |
4464 | 4448 |
4465 | 4449 |
4466 #undef __ | 4450 #undef __ |
4467 | 4451 |
4468 } } // namespace v8::internal | 4452 } } // namespace v8::internal |
4469 | 4453 |
4470 #endif // V8_TARGET_ARCH_IA32 | 4454 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |