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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1677 if (from.IsTagged()) { | 1677 if (from.IsTagged()) { |
1678 if (to.IsDouble()) { | 1678 if (to.IsDouble()) { |
1679 LOperand* value = UseRegister(instr->value()); | 1679 LOperand* value = UseRegister(instr->value()); |
1680 LNumberUntagD* res = new LNumberUntagD(value); | 1680 LNumberUntagD* res = new LNumberUntagD(value); |
1681 return AssignEnvironment(DefineAsRegister(res)); | 1681 return AssignEnvironment(DefineAsRegister(res)); |
1682 } else { | 1682 } else { |
1683 ASSERT(to.IsInteger32()); | 1683 ASSERT(to.IsInteger32()); |
1684 LOperand* value = UseRegister(instr->value()); | 1684 LOperand* value = UseRegister(instr->value()); |
1685 bool needs_check = !instr->value()->type().IsSmi(); | 1685 bool needs_check = !instr->value()->type().IsSmi(); |
1686 if (needs_check) { | 1686 if (needs_check) { |
1687 bool truncating = instr->CanTruncateToInt32(); | |
1687 LOperand* xmm_temp = | 1688 LOperand* xmm_temp = |
1688 (instr->CanTruncateToInt32() && CpuFeatures::IsSupported(SSE3)) | 1689 (truncating && CpuFeatures::IsSupported(SSE3)) |
1689 ? NULL | 1690 ? NULL |
1690 : FixedTemp(xmm1); | 1691 : FixedTemp(xmm1); |
1691 LTaggedToI* res = new LTaggedToI(value, xmm_temp); | 1692 LTaggedToI* res = new LTaggedToI(value, xmm_temp); |
1692 return AssignEnvironment(DefineSameAsFirst(res)); | 1693 return AssignEnvironment(DefineSameAsFirst(res)); |
1693 } else { | 1694 } else { |
1694 return DefineSameAsFirst(new LSmiUntag(value, needs_check)); | 1695 return DefineSameAsFirst(new LSmiUntag(value, needs_check)); |
1695 } | 1696 } |
1696 } | 1697 } |
1697 } else if (from.IsDouble()) { | 1698 } else if (from.IsDouble()) { |
1698 if (to.IsTagged()) { | 1699 if (to.IsTagged()) { |
1699 LOperand* value = UseRegister(instr->value()); | 1700 LOperand* value = UseRegister(instr->value()); |
1700 LOperand* temp = TempRegister(); | 1701 LOperand* temp = TempRegister(); |
1701 | 1702 |
1702 // Make sure that temp and result_temp are different registers. | 1703 // Make sure that temp and result_temp are different registers. |
1703 LUnallocated* result_temp = TempRegister(); | 1704 LUnallocated* result_temp = TempRegister(); |
1704 LNumberTagD* result = new LNumberTagD(value, temp); | 1705 LNumberTagD* result = new LNumberTagD(value, temp); |
1705 return AssignPointerMap(Define(result, result_temp)); | 1706 return AssignPointerMap(Define(result, result_temp)); |
1706 } else { | 1707 } else { |
1707 ASSERT(to.IsInteger32()); | 1708 ASSERT(to.IsInteger32()); |
1708 bool needs_temp = instr->CanTruncateToInt32() && | 1709 bool truncating = instr->CanTruncateToInt32(); |
1709 !CpuFeatures::IsSupported(SSE3); | 1710 bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3); |
1710 LOperand* value = needs_temp ? | 1711 LOperand* value = needs_temp ? |
1711 UseTempRegister(instr->value()) : UseRegister(instr->value()); | 1712 UseTempRegister(instr->value()) : UseRegister(instr->value()); |
1712 LOperand* temp = needs_temp ? TempRegister() : NULL; | 1713 LOperand* temp = needs_temp ? TempRegister() : NULL; |
1713 return AssignEnvironment(DefineAsRegister(new LDoubleToI(value, temp))); | 1714 return AssignEnvironment(DefineAsRegister(new LDoubleToI(value, temp))); |
1714 } | 1715 } |
1715 } else if (from.IsInteger32()) { | 1716 } else if (from.IsInteger32()) { |
1716 if (to.IsTagged()) { | 1717 if (to.IsTagged()) { |
1717 HValue* val = instr->value(); | 1718 HValue* val = instr->value(); |
1718 LOperand* value = UseRegister(val); | 1719 LOperand* value = UseRegister(val); |
1719 if (val->HasRange() && val->range()->IsInSmiRange()) { | 1720 if (val->HasRange() && val->range()->IsInSmiRange()) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1786 LOperand* reg = UseFixed(value, eax); | 1787 LOperand* reg = UseFixed(value, eax); |
1787 // Register allocator doesn't (yet) support allocation of double | 1788 // Register allocator doesn't (yet) support allocation of double |
1788 // temps. Reserve xmm1 explicitly. | 1789 // temps. Reserve xmm1 explicitly. |
1789 LOperand* temp = FixedTemp(xmm1); | 1790 LOperand* temp = FixedTemp(xmm1); |
1790 LClampTToUint8* result = new LClampTToUint8(reg, temp); | 1791 LClampTToUint8* result = new LClampTToUint8(reg, temp); |
1791 return AssignEnvironment(DefineFixed(result, eax)); | 1792 return AssignEnvironment(DefineFixed(result, eax)); |
1792 } | 1793 } |
1793 } | 1794 } |
1794 | 1795 |
1795 | 1796 |
1797 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) { | |
1798 HValue* value = instr->value(); | |
1799 Representation input_rep = value->representation(); | |
1800 if (input_rep.IsDouble()) { | |
1801 LOperand* reg = UseRegister(value); | |
1802 // Register allocator doesn't (yet) support allocation of double | |
1803 // temps. Reserve xmm1 explicitly. | |
1804 LOperand* xmm_temp = | |
Kevin Millikin (Chromium)
2011/05/26 07:53:37
Some of this code can be lifted out of the if (the
danno
2011/06/01 13:14:41
Done.
| |
1805 CpuFeatures::IsSupported(SSE3) | |
1806 ? NULL | |
1807 : FixedTemp(xmm1); | |
1808 return AssignEnvironment( | |
1809 DefineAsRegister(new LDoubleToI(reg, xmm_temp))); | |
1810 } else if (input_rep.IsInteger32()) { | |
1811 // Canonicalization should already have removed the hydrogen instruction in | |
1812 // this case, since it is a noop. | |
1813 UNREACHABLE(); | |
1814 return NULL; | |
1815 } else { | |
1816 ASSERT(input_rep.IsTagged()); | |
1817 LOperand* reg = UseRegister(value); | |
1818 // Register allocator doesn't (yet) support allocation of double | |
1819 // temps. Reserve xmm1 explicitly. | |
1820 LOperand* xmm_temp = | |
1821 CpuFeatures::IsSupported(SSE3) | |
1822 ? NULL | |
1823 : FixedTemp(xmm1); | |
1824 return AssignEnvironment( | |
1825 DefineSameAsFirst(new LTaggedToI(reg, xmm_temp))); | |
1826 } | |
1827 } | |
1828 | |
1829 | |
1796 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1830 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
1797 return new LReturn(UseFixed(instr->value(), eax)); | 1831 return new LReturn(UseFixed(instr->value(), eax)); |
1798 } | 1832 } |
1799 | 1833 |
1800 | 1834 |
1801 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1835 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
1802 Representation r = instr->representation(); | 1836 Representation r = instr->representation(); |
1803 if (r.IsInteger32()) { | 1837 if (r.IsInteger32()) { |
1804 return DefineAsRegister(new LConstantI); | 1838 return DefineAsRegister(new LConstantI); |
1805 } else if (r.IsDouble()) { | 1839 } else if (r.IsDouble()) { |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2252 LOperand* key = UseOrConstantAtStart(instr->key()); | 2286 LOperand* key = UseOrConstantAtStart(instr->key()); |
2253 LOperand* object = UseOrConstantAtStart(instr->object()); | 2287 LOperand* object = UseOrConstantAtStart(instr->object()); |
2254 LIn* result = new LIn(key, object); | 2288 LIn* result = new LIn(key, object); |
2255 return MarkAsCall(DefineFixed(result, eax), instr); | 2289 return MarkAsCall(DefineFixed(result, eax), instr); |
2256 } | 2290 } |
2257 | 2291 |
2258 | 2292 |
2259 } } // namespace v8::internal | 2293 } } // namespace v8::internal |
2260 | 2294 |
2261 #endif // V8_TARGET_ARCH_IA32 | 2295 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |