| 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 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 return NULL; | 1670 return NULL; |
| 1671 } | 1671 } |
| 1672 | 1672 |
| 1673 | 1673 |
| 1674 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { | 1674 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
| 1675 LOperand* value = UseFixed(instr->value(), eax); | 1675 LOperand* value = UseFixed(instr->value(), eax); |
| 1676 return MarkAsCall(new LThrow(value), instr); | 1676 return MarkAsCall(new LThrow(value), instr); |
| 1677 } | 1677 } |
| 1678 | 1678 |
| 1679 | 1679 |
| 1680 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { |
| 1681 // All HForceRepresentation instructions should be eliminated in the |
| 1682 // representation change phase of Hydrogen. |
| 1683 UNREACHABLE(); |
| 1684 return NULL; |
| 1685 } |
| 1686 |
| 1687 |
| 1680 LInstruction* LChunkBuilder::DoChange(HChange* instr) { | 1688 LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
| 1681 Representation from = instr->from(); | 1689 Representation from = instr->from(); |
| 1682 Representation to = instr->to(); | 1690 Representation to = instr->to(); |
| 1683 if (from.IsTagged()) { | 1691 if (from.IsTagged()) { |
| 1684 if (to.IsDouble()) { | 1692 if (to.IsDouble()) { |
| 1685 LOperand* value = UseRegister(instr->value()); | 1693 LOperand* value = UseRegister(instr->value()); |
| 1686 LNumberUntagD* res = new LNumberUntagD(value); | 1694 LNumberUntagD* res = new LNumberUntagD(value); |
| 1687 return AssignEnvironment(DefineAsRegister(res)); | 1695 return AssignEnvironment(DefineAsRegister(res)); |
| 1688 } else { | 1696 } else { |
| 1689 ASSERT(to.IsInteger32()); | 1697 ASSERT(to.IsInteger32()); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 } | 1779 } |
| 1772 | 1780 |
| 1773 | 1781 |
| 1774 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) { | 1782 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) { |
| 1775 LOperand* value = UseRegisterAtStart(instr->value()); | 1783 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1776 LCheckMap* result = new LCheckMap(value); | 1784 LCheckMap* result = new LCheckMap(value); |
| 1777 return AssignEnvironment(result); | 1785 return AssignEnvironment(result); |
| 1778 } | 1786 } |
| 1779 | 1787 |
| 1780 | 1788 |
| 1789 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
| 1790 HValue* value = instr->value(); |
| 1791 Representation input_rep = value->representation(); |
| 1792 if (input_rep.IsDouble()) { |
| 1793 LOperand* reg = UseRegister(value); |
| 1794 return DefineAsRegister(new LClampDToUint8(reg)); |
| 1795 } else if (input_rep.IsInteger32()) { |
| 1796 LOperand* reg = UseFixed(value, eax); |
| 1797 return DefineFixed(new LClampIToUint8(reg), eax); |
| 1798 } else { |
| 1799 ASSERT(input_rep.IsTagged()); |
| 1800 LOperand* reg = UseFixed(value, eax); |
| 1801 // Register allocator doesn't (yet) support allocation of double |
| 1802 // temps. Reserve xmm1 explicitly. |
| 1803 LOperand* temp = FixedTemp(xmm1); |
| 1804 LClampTToUint8* result = new LClampTToUint8(reg, temp); |
| 1805 return AssignEnvironment(DefineFixed(result, eax)); |
| 1806 } |
| 1807 } |
| 1808 |
| 1809 |
| 1781 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1810 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
| 1782 return new LReturn(UseFixed(instr->value(), eax)); | 1811 return new LReturn(UseFixed(instr->value(), eax)); |
| 1783 } | 1812 } |
| 1784 | 1813 |
| 1785 | 1814 |
| 1786 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1815 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
| 1787 Representation r = instr->representation(); | 1816 Representation r = instr->representation(); |
| 1788 if (r.IsInteger32()) { | 1817 if (r.IsInteger32()) { |
| 1789 return DefineAsRegister(new LConstantI); | 1818 return DefineAsRegister(new LConstantI); |
| 1790 } else if (r.IsDouble()) { | 1819 } else if (r.IsDouble()) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 (representation.IsInteger32() && (array_type != kExternalFloatArray && | 2010 (representation.IsInteger32() && (array_type != kExternalFloatArray && |
| 1982 array_type != kExternalDoubleArray)) || | 2011 array_type != kExternalDoubleArray)) || |
| 1983 (representation.IsDouble() && (array_type == kExternalFloatArray || | 2012 (representation.IsDouble() && (array_type == kExternalFloatArray || |
| 1984 array_type == kExternalDoubleArray))); | 2013 array_type == kExternalDoubleArray))); |
| 1985 ASSERT(instr->external_pointer()->representation().IsExternal()); | 2014 ASSERT(instr->external_pointer()->representation().IsExternal()); |
| 1986 ASSERT(instr->key()->representation().IsInteger32()); | 2015 ASSERT(instr->key()->representation().IsInteger32()); |
| 1987 | 2016 |
| 1988 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 2017 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1989 LOperand* key = UseRegisterOrConstant(instr->key()); | 2018 LOperand* key = UseRegisterOrConstant(instr->key()); |
| 1990 LOperand* temp = NULL; | 2019 LOperand* temp = NULL; |
| 1991 | |
| 1992 if (array_type == kExternalPixelArray) { | |
| 1993 // The generated code for pixel array stores requires that the clamped value | |
| 1994 // is in a byte register. eax is an arbitrary choice to satisfy this | |
| 1995 // requirement. | |
| 1996 temp = FixedTemp(eax); | |
| 1997 } | |
| 1998 | |
| 1999 LOperand* val = NULL; | 2020 LOperand* val = NULL; |
| 2000 if (array_type == kExternalByteArray || | 2021 if (array_type == kExternalByteArray || |
| 2001 array_type == kExternalUnsignedByteArray) { | 2022 array_type == kExternalUnsignedByteArray) { |
| 2002 // We need a byte register in this case for the value. | 2023 // We need a byte register in this case for the value. |
| 2003 val = UseFixed(instr->value(), eax); | 2024 val = UseFixed(instr->value(), eax); |
| 2004 } else { | 2025 } else { |
| 2005 val = UseRegister(instr->value()); | 2026 val = UseRegister(instr->value()); |
| 2006 } | 2027 } |
| 2007 | 2028 |
| 2008 return new LStoreKeyedSpecializedArrayElement(external_pointer, | 2029 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2245 LOperand* key = UseOrConstantAtStart(instr->key()); | 2266 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2246 LOperand* object = UseOrConstantAtStart(instr->object()); | 2267 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2247 LIn* result = new LIn(key, object); | 2268 LIn* result = new LIn(key, object); |
| 2248 return MarkAsCall(DefineFixed(result, eax), instr); | 2269 return MarkAsCall(DefineFixed(result, eax), instr); |
| 2249 } | 2270 } |
| 2250 | 2271 |
| 2251 | 2272 |
| 2252 } } // namespace v8::internal | 2273 } } // namespace v8::internal |
| 2253 | 2274 |
| 2254 #endif // V8_TARGET_ARCH_IA32 | 2275 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |