| 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 // Register allocator doesn't (yet) support allocation of double |
| 1801 // temps. Reserve xmm1 explicitly. |
| 1802 LOperand* xmm_temp = |
| 1803 CpuFeatures::IsSupported(SSE3) |
| 1804 ? NULL |
| 1805 : FixedTemp(xmm1); |
| 1806 LInstruction* result; |
| 1807 if (input_rep.IsDouble()) { |
| 1808 LOperand* reg = UseRegister(value); |
| 1809 // Register allocator doesn't (yet) support allocation of double |
| 1810 // temps. Reserve xmm1 explicitly. |
| 1811 result = DefineAsRegister(new LDoubleToI(reg, xmm_temp)); |
| 1812 } else if (input_rep.IsInteger32()) { |
| 1813 // Canonicalization should already have removed the hydrogen instruction in |
| 1814 // this case, since it is a noop. |
| 1815 UNREACHABLE(); |
| 1816 return NULL; |
| 1817 } else { |
| 1818 ASSERT(input_rep.IsTagged()); |
| 1819 LOperand* reg = UseRegister(value); |
| 1820 result = DefineSameAsFirst(new LTaggedToI(reg, xmm_temp)); |
| 1821 } |
| 1822 return AssignEnvironment(result); |
| 1823 } |
| 1824 |
| 1825 |
| 1796 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1826 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
| 1797 return new LReturn(UseFixed(instr->value(), eax)); | 1827 return new LReturn(UseFixed(instr->value(), eax)); |
| 1798 } | 1828 } |
| 1799 | 1829 |
| 1800 | 1830 |
| 1801 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1831 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
| 1802 Representation r = instr->representation(); | 1832 Representation r = instr->representation(); |
| 1803 if (r.IsInteger32()) { | 1833 if (r.IsInteger32()) { |
| 1804 return DefineAsRegister(new LConstantI); | 1834 return DefineAsRegister(new LConstantI); |
| 1805 } else if (r.IsDouble()) { | 1835 } else if (r.IsDouble()) { |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2252 LOperand* key = UseOrConstantAtStart(instr->key()); | 2282 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2253 LOperand* object = UseOrConstantAtStart(instr->object()); | 2283 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2254 LIn* result = new LIn(key, object); | 2284 LIn* result = new LIn(key, object); |
| 2255 return MarkAsCall(DefineFixed(result, eax), instr); | 2285 return MarkAsCall(DefineFixed(result, eax), instr); |
| 2256 } | 2286 } |
| 2257 | 2287 |
| 2258 | 2288 |
| 2259 } } // namespace v8::internal | 2289 } } // namespace v8::internal |
| 2260 | 2290 |
| 2261 #endif // V8_TARGET_ARCH_IA32 | 2291 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |