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 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1823 HLoadKeyedFastElement* instr) { | 1823 HLoadKeyedFastElement* instr) { |
1824 ASSERT(instr->representation().IsTagged()); | 1824 ASSERT(instr->representation().IsTagged()); |
1825 ASSERT(instr->key()->representation().IsInteger32()); | 1825 ASSERT(instr->key()->representation().IsInteger32()); |
1826 LOperand* obj = UseRegisterAtStart(instr->object()); | 1826 LOperand* obj = UseRegisterAtStart(instr->object()); |
1827 LOperand* key = UseRegisterAtStart(instr->key()); | 1827 LOperand* key = UseRegisterAtStart(instr->key()); |
1828 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1828 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
1829 return AssignEnvironment(DefineSameAsFirst(result)); | 1829 return AssignEnvironment(DefineSameAsFirst(result)); |
1830 } | 1830 } |
1831 | 1831 |
1832 | 1832 |
1833 LInstruction* LChunkBuilder::DoLoadPixelArrayElement( | 1833 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
1834 HLoadPixelArrayElement* instr) { | 1834 HLoadKeyedSpecializedArrayElement* instr) { |
1835 ASSERT(instr->representation().IsInteger32()); | 1835 ExternalArrayType array_type = instr->array_type(); |
1836 Representation representation(instr->representation()); | |
1837 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || | |
1838 (representation.IsDouble() && array_type == kExternalFloatArray)); | |
1836 ASSERT(instr->key()->representation().IsInteger32()); | 1839 ASSERT(instr->key()->representation().IsInteger32()); |
1837 LOperand* external_pointer = | 1840 LOperand* external_pointer = |
1838 UseRegisterAtStart(instr->external_pointer()); | 1841 UseRegisterAtStart(instr->external_pointer()); |
1839 LOperand* key = UseRegisterAtStart(instr->key()); | 1842 LOperand* key = UseRegisterAtStart(instr->key()); |
1840 LLoadPixelArrayElement* result = | 1843 LLoadKeyedSpecializedArrayElement* result = |
1841 new LLoadPixelArrayElement(external_pointer, key); | 1844 new LLoadKeyedSpecializedArrayElement(external_pointer, |
1842 return DefineSameAsFirst(result); | 1845 key, |
1846 array_type); | |
1847 LInstruction* load_instr = array_type != kExternalFloatArray ? | |
1848 DefineSameAsFirst(result) : | |
1849 DefineAsRegister(result); | |
1850 // An unsigned int array load might overflow and cause a deopt, make sure it | |
1851 // has an environment. | |
1852 return (array_type == kExternalUnsignedIntArray) ? | |
Kevin Millikin (Chromium)
2011/03/24 11:21:00
Normally we format this like:
return (array_type
danno
2011/03/24 13:18:38
Done.
| |
1853 AssignEnvironment(load_instr) : load_instr; | |
1843 } | 1854 } |
1844 | 1855 |
1845 | 1856 |
1846 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1857 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
1847 LOperand* context = UseFixed(instr->context(), esi); | 1858 LOperand* context = UseFixed(instr->context(), esi); |
1848 LOperand* object = UseFixed(instr->object(), edx); | 1859 LOperand* object = UseFixed(instr->object(), edx); |
1849 LOperand* key = UseFixed(instr->key(), eax); | 1860 LOperand* key = UseFixed(instr->key(), eax); |
1850 | 1861 |
1851 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(context, object, key); | 1862 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(context, object, key); |
1852 return MarkAsCall(DefineFixed(result, eax), instr); | 1863 return MarkAsCall(DefineFixed(result, eax), instr); |
(...skipping 12 matching lines...) Expand all Loading... | |
1865 ? UseTempRegister(instr->value()) | 1876 ? UseTempRegister(instr->value()) |
1866 : UseRegisterAtStart(instr->value()); | 1877 : UseRegisterAtStart(instr->value()); |
1867 LOperand* key = needs_write_barrier | 1878 LOperand* key = needs_write_barrier |
1868 ? UseTempRegister(instr->key()) | 1879 ? UseTempRegister(instr->key()) |
1869 : UseRegisterOrConstantAtStart(instr->key()); | 1880 : UseRegisterOrConstantAtStart(instr->key()); |
1870 | 1881 |
1871 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1882 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
1872 } | 1883 } |
1873 | 1884 |
1874 | 1885 |
1875 LInstruction* LChunkBuilder::DoStorePixelArrayElement( | 1886 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
1876 HStorePixelArrayElement* instr) { | 1887 HStoreKeyedSpecializedArrayElement* instr) { |
1877 ASSERT(instr->value()->representation().IsInteger32()); | 1888 Representation representation(instr->value()->representation()); |
1889 ExternalArrayType array_type = instr->array_type(); | |
1890 ASSERT((representation.IsInteger32() && | |
Kevin Millikin (Chromium)
2011/03/24 11:21:00
Does this fit on two lines like the one in DoLoadK
danno
2011/03/24 13:18:38
Done.
| |
1891 (array_type != kExternalFloatArray)) || | |
1892 (representation.IsDouble() && | |
1893 (array_type == kExternalFloatArray))); | |
1878 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1894 ASSERT(instr->external_pointer()->representation().IsExternal()); |
1879 ASSERT(instr->key()->representation().IsInteger32()); | 1895 ASSERT(instr->key()->representation().IsInteger32()); |
1880 | 1896 |
1881 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1897 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1882 LOperand* val = UseRegister(instr->value()); | 1898 LOperand* val = UseRegister(instr->value()); |
1883 LOperand* key = UseRegister(instr->key()); | 1899 LOperand* key = UseRegister(instr->key()); |
1884 // The generated code requires that the clamped value is in a byte | 1900 LOperand* temp = NULL; |
1885 // register. eax is an arbitrary choice to satisfy this requirement. | |
1886 LOperand* clamped = FixedTemp(eax); | |
1887 | 1901 |
1888 return new LStorePixelArrayElement(external_pointer, key, val, clamped); | 1902 if (array_type == kExternalPixelArray) { |
1903 // The generated code for pixel array stores requires that the clamped value | |
1904 // is in a byte register. eax is an arbitrary choice to satisfy this | |
1905 // requirement. | |
1906 temp = FixedTemp(eax); | |
1907 } else if (array_type == kExternalFloatArray) { | |
1908 // The floating point external array load needs an extra register for | |
1909 // converting from single precision to double. | |
1910 temp = FixedTemp(xmm1); | |
Kevin Millikin (Chromium)
2011/03/24 11:21:00
At the moment, xmm0 is never allocated and can be
danno
2011/03/24 13:18:38
Done.
| |
1911 } | |
1912 | |
1913 return new LStoreKeyedSpecializedArrayElement(external_pointer, | |
1914 key, | |
1915 val, | |
1916 temp, | |
1917 instr->array_type()); | |
1889 } | 1918 } |
1890 | 1919 |
1891 | 1920 |
1892 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1921 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
1893 LOperand* context = UseFixed(instr->context(), esi); | 1922 LOperand* context = UseFixed(instr->context(), esi); |
1894 LOperand* object = UseFixed(instr->object(), edx); | 1923 LOperand* object = UseFixed(instr->object(), edx); |
1895 LOperand* key = UseFixed(instr->key(), ecx); | 1924 LOperand* key = UseFixed(instr->key(), ecx); |
1896 LOperand* value = UseFixed(instr->value(), eax); | 1925 LOperand* value = UseFixed(instr->value(), eax); |
1897 | 1926 |
1898 ASSERT(instr->object()->representation().IsTagged()); | 1927 ASSERT(instr->object()->representation().IsTagged()); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2107 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2136 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2108 HEnvironment* outer = current_block_->last_environment()->outer(); | 2137 HEnvironment* outer = current_block_->last_environment()->outer(); |
2109 current_block_->UpdateEnvironment(outer); | 2138 current_block_->UpdateEnvironment(outer); |
2110 return NULL; | 2139 return NULL; |
2111 } | 2140 } |
2112 | 2141 |
2113 | 2142 |
2114 } } // namespace v8::internal | 2143 } } // namespace v8::internal |
2115 | 2144 |
2116 #endif // V8_TARGET_ARCH_IA32 | 2145 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |