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 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 } | 1771 } |
1772 | 1772 |
1773 | 1773 |
1774 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) { | 1774 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) { |
1775 LOperand* value = UseRegisterAtStart(instr->value()); | 1775 LOperand* value = UseRegisterAtStart(instr->value()); |
1776 LCheckMap* result = new LCheckMap(value); | 1776 LCheckMap* result = new LCheckMap(value); |
1777 return AssignEnvironment(result); | 1777 return AssignEnvironment(result); |
1778 } | 1778 } |
1779 | 1779 |
1780 | 1780 |
| 1781 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
| 1782 HValue* value = instr->value(); |
| 1783 Representation input_rep = value->representation(); |
| 1784 if (input_rep.IsDouble()) { |
| 1785 LOperand* reg = UseRegister(value); |
| 1786 return DefineAsRegister(new LClampDoubleToUint8(reg)); |
| 1787 } else if (input_rep.IsInteger32()) { |
| 1788 LOperand* reg = UseFixed(value, eax); |
| 1789 return DefineFixed(new LClampIToUint8(reg), eax); |
| 1790 } else { |
| 1791 ASSERT(input_rep.IsTagged()); |
| 1792 LOperand* reg = UseFixed(value, eax); |
| 1793 // Register allocator doesn't (yet) support allocation of double |
| 1794 // temps. Reserve xmm1 explicitly. |
| 1795 LOperand* temp = FixedTemp(xmm1); |
| 1796 LClampTaggedToUint8* result = new LClampTaggedToUint8(reg, temp); |
| 1797 return AssignEnvironment(DefineFixed(result, eax)); |
| 1798 } |
| 1799 } |
| 1800 |
| 1801 |
1781 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1802 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
1782 return new LReturn(UseFixed(instr->value(), eax)); | 1803 return new LReturn(UseFixed(instr->value(), eax)); |
1783 } | 1804 } |
1784 | 1805 |
1785 | 1806 |
1786 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1807 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
1787 Representation r = instr->representation(); | 1808 Representation r = instr->representation(); |
1788 if (r.IsInteger32()) { | 1809 if (r.IsInteger32()) { |
1789 return DefineAsRegister(new LConstantI); | 1810 return DefineAsRegister(new LConstantI); |
1790 } else if (r.IsDouble()) { | 1811 } else if (r.IsDouble()) { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 (representation.IsInteger32() && (array_type != kExternalFloatArray && | 2002 (representation.IsInteger32() && (array_type != kExternalFloatArray && |
1982 array_type != kExternalDoubleArray)) || | 2003 array_type != kExternalDoubleArray)) || |
1983 (representation.IsDouble() && (array_type == kExternalFloatArray || | 2004 (representation.IsDouble() && (array_type == kExternalFloatArray || |
1984 array_type == kExternalDoubleArray))); | 2005 array_type == kExternalDoubleArray))); |
1985 ASSERT(instr->external_pointer()->representation().IsExternal()); | 2006 ASSERT(instr->external_pointer()->representation().IsExternal()); |
1986 ASSERT(instr->key()->representation().IsInteger32()); | 2007 ASSERT(instr->key()->representation().IsInteger32()); |
1987 | 2008 |
1988 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 2009 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1989 LOperand* key = UseRegisterOrConstant(instr->key()); | 2010 LOperand* key = UseRegisterOrConstant(instr->key()); |
1990 LOperand* temp = NULL; | 2011 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; | 2012 LOperand* val = NULL; |
2000 if (array_type == kExternalByteArray || | 2013 if (array_type == kExternalByteArray || |
2001 array_type == kExternalUnsignedByteArray) { | 2014 array_type == kExternalUnsignedByteArray) { |
2002 // We need a byte register in this case for the value. | 2015 // We need a byte register in this case for the value. |
2003 val = UseFixed(instr->value(), eax); | 2016 val = UseFixed(instr->value(), eax); |
2004 } else { | 2017 } else { |
2005 val = UseRegister(instr->value()); | 2018 val = UseRegister(instr->value()); |
2006 } | 2019 } |
2007 | 2020 |
2008 return new LStoreKeyedSpecializedArrayElement(external_pointer, | 2021 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2245 LOperand* key = UseOrConstantAtStart(instr->key()); | 2258 LOperand* key = UseOrConstantAtStart(instr->key()); |
2246 LOperand* object = UseOrConstantAtStart(instr->object()); | 2259 LOperand* object = UseOrConstantAtStart(instr->object()); |
2247 LIn* result = new LIn(key, object); | 2260 LIn* result = new LIn(key, object); |
2248 return MarkAsCall(DefineFixed(result, eax), instr); | 2261 return MarkAsCall(DefineFixed(result, eax), instr); |
2249 } | 2262 } |
2250 | 2263 |
2251 | 2264 |
2252 } } // namespace v8::internal | 2265 } } // namespace v8::internal |
2253 | 2266 |
2254 #endif // V8_TARGET_ARCH_IA32 | 2267 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |