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 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 HLoadKeyedFastElement* instr) { | 1838 HLoadKeyedFastElement* instr) { |
1839 ASSERT(instr->representation().IsTagged()); | 1839 ASSERT(instr->representation().IsTagged()); |
1840 ASSERT(instr->key()->representation().IsInteger32()); | 1840 ASSERT(instr->key()->representation().IsInteger32()); |
1841 LOperand* obj = UseRegisterAtStart(instr->object()); | 1841 LOperand* obj = UseRegisterAtStart(instr->object()); |
1842 LOperand* key = UseRegisterAtStart(instr->key()); | 1842 LOperand* key = UseRegisterAtStart(instr->key()); |
1843 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1843 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
1844 return AssignEnvironment(DefineSameAsFirst(result)); | 1844 return AssignEnvironment(DefineSameAsFirst(result)); |
1845 } | 1845 } |
1846 | 1846 |
1847 | 1847 |
1848 LInstruction* LChunkBuilder::DoLoadPixelArrayElement( | 1848 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
1849 HLoadPixelArrayElement* instr) { | 1849 HLoadKeyedSpecializedArrayElement* instr) { |
1850 ASSERT(instr->representation().IsInteger32()); | 1850 ExternalArrayType array_type = instr->array_type(); |
| 1851 Representation representation(instr->representation()); |
| 1852 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
| 1853 (representation.IsDouble() && array_type == kExternalFloatArray)); |
1851 ASSERT(instr->key()->representation().IsInteger32()); | 1854 ASSERT(instr->key()->representation().IsInteger32()); |
1852 LOperand* external_pointer = | 1855 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1853 UseRegisterAtStart(instr->external_pointer()); | 1856 LOperand* key = UseRegister(instr->key()); |
1854 LOperand* key = UseRegisterAtStart(instr->key()); | 1857 LLoadKeyedSpecializedArrayElement* result = |
1855 LLoadPixelArrayElement* result = | 1858 new LLoadKeyedSpecializedArrayElement(external_pointer, |
1856 new LLoadPixelArrayElement(external_pointer, key); | 1859 key); |
1857 return DefineSameAsFirst(result); | 1860 LInstruction* load_instr = DefineAsRegister(result); |
| 1861 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1862 // has an environment. |
| 1863 return (array_type == kExternalUnsignedIntArray) |
| 1864 ? AssignEnvironment(load_instr) |
| 1865 : load_instr; |
1858 } | 1866 } |
1859 | 1867 |
1860 | 1868 |
1861 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1869 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
1862 LOperand* context = UseFixed(instr->context(), esi); | 1870 LOperand* context = UseFixed(instr->context(), esi); |
1863 LOperand* object = UseFixed(instr->object(), edx); | 1871 LOperand* object = UseFixed(instr->object(), edx); |
1864 LOperand* key = UseFixed(instr->key(), eax); | 1872 LOperand* key = UseFixed(instr->key(), eax); |
1865 | 1873 |
1866 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(context, object, key); | 1874 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(context, object, key); |
1867 return MarkAsCall(DefineFixed(result, eax), instr); | 1875 return MarkAsCall(DefineFixed(result, eax), instr); |
(...skipping 12 matching lines...) Expand all Loading... |
1880 ? UseTempRegister(instr->value()) | 1888 ? UseTempRegister(instr->value()) |
1881 : UseRegisterAtStart(instr->value()); | 1889 : UseRegisterAtStart(instr->value()); |
1882 LOperand* key = needs_write_barrier | 1890 LOperand* key = needs_write_barrier |
1883 ? UseTempRegister(instr->key()) | 1891 ? UseTempRegister(instr->key()) |
1884 : UseRegisterOrConstantAtStart(instr->key()); | 1892 : UseRegisterOrConstantAtStart(instr->key()); |
1885 | 1893 |
1886 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1894 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
1887 } | 1895 } |
1888 | 1896 |
1889 | 1897 |
1890 LInstruction* LChunkBuilder::DoStorePixelArrayElement( | 1898 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
1891 HStorePixelArrayElement* instr) { | 1899 HStoreKeyedSpecializedArrayElement* instr) { |
1892 ASSERT(instr->value()->representation().IsInteger32()); | 1900 Representation representation(instr->value()->representation()); |
| 1901 ExternalArrayType array_type = instr->array_type(); |
| 1902 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
| 1903 (representation.IsDouble() && array_type == kExternalFloatArray)); |
1893 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1904 ASSERT(instr->external_pointer()->representation().IsExternal()); |
1894 ASSERT(instr->key()->representation().IsInteger32()); | 1905 ASSERT(instr->key()->representation().IsInteger32()); |
1895 | 1906 |
1896 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1907 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1897 LOperand* val = UseRegister(instr->value()); | 1908 LOperand* val = UseRegister(instr->value()); |
1898 LOperand* key = UseRegister(instr->key()); | 1909 LOperand* key = UseRegister(instr->key()); |
1899 // The generated code requires that the clamped value is in a byte | 1910 LOperand* temp = NULL; |
1900 // register. eax is an arbitrary choice to satisfy this requirement. | |
1901 LOperand* clamped = FixedTemp(eax); | |
1902 | 1911 |
1903 return new LStorePixelArrayElement(external_pointer, key, val, clamped); | 1912 if (array_type == kExternalPixelArray) { |
| 1913 // The generated code for pixel array stores requires that the clamped value |
| 1914 // is in a byte register. eax is an arbitrary choice to satisfy this |
| 1915 // requirement. |
| 1916 temp = FixedTemp(eax); |
| 1917 } |
| 1918 |
| 1919 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
| 1920 key, |
| 1921 val, |
| 1922 temp); |
1904 } | 1923 } |
1905 | 1924 |
1906 | 1925 |
1907 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1926 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
1908 LOperand* context = UseFixed(instr->context(), esi); | 1927 LOperand* context = UseFixed(instr->context(), esi); |
1909 LOperand* object = UseFixed(instr->object(), edx); | 1928 LOperand* object = UseFixed(instr->object(), edx); |
1910 LOperand* key = UseFixed(instr->key(), ecx); | 1929 LOperand* key = UseFixed(instr->key(), ecx); |
1911 LOperand* value = UseFixed(instr->value(), eax); | 1930 LOperand* value = UseFixed(instr->value(), eax); |
1912 | 1931 |
1913 ASSERT(instr->object()->representation().IsTagged()); | 1932 ASSERT(instr->object()->representation().IsTagged()); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2141 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2123 HEnvironment* outer = current_block_->last_environment()->outer(); | 2142 HEnvironment* outer = current_block_->last_environment()->outer(); |
2124 current_block_->UpdateEnvironment(outer); | 2143 current_block_->UpdateEnvironment(outer); |
2125 return NULL; | 2144 return NULL; |
2126 } | 2145 } |
2127 | 2146 |
2128 | 2147 |
2129 } } // namespace v8::internal | 2148 } } // namespace v8::internal |
2130 | 2149 |
2131 #endif // V8_TARGET_ARCH_IA32 | 2150 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |