| 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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 ASSERT(instr->representation().IsTagged()); | 1340 ASSERT(instr->representation().IsTagged()); |
| 1341 return DoArithmeticT(Token::DIV, instr); | 1341 return DoArithmeticT(Token::DIV, instr); |
| 1342 } | 1342 } |
| 1343 } | 1343 } |
| 1344 | 1344 |
| 1345 | 1345 |
| 1346 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1346 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
| 1347 if (instr->representation().IsInteger32()) { | 1347 if (instr->representation().IsInteger32()) { |
| 1348 ASSERT(instr->left()->representation().IsInteger32()); | 1348 ASSERT(instr->left()->representation().IsInteger32()); |
| 1349 ASSERT(instr->right()->representation().IsInteger32()); | 1349 ASSERT(instr->right()->representation().IsInteger32()); |
| 1350 // The temporary operand is necessary to ensure that right is not allocated | 1350 |
| 1351 // into edx. | 1351 LInstruction* result; |
| 1352 LOperand* temp = FixedTemp(rdx); | 1352 if (instr->HasPowerOf2Divisor()) { |
| 1353 LOperand* value = UseFixed(instr->left(), rax); | 1353 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1354 LOperand* divisor = UseRegister(instr->right()); | 1354 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1355 LModI* mod = new LModI(value, divisor, temp); | 1355 LModI* mod = new LModI(value, UseOrConstant(instr->right()), NULL); |
| 1356 LInstruction* result = DefineFixed(mod, rdx); | 1356 result = DefineSameAsFirst(mod); |
| 1357 } else { |
| 1358 // The temporary operand is necessary to ensure that right is not |
| 1359 // allocated into edx. |
| 1360 LOperand* temp = FixedTemp(rdx); |
| 1361 LOperand* value = UseFixed(instr->left(), rax); |
| 1362 LOperand* divisor = UseRegister(instr->right()); |
| 1363 LModI* mod = new LModI(value, divisor, temp); |
| 1364 result = DefineFixed(mod, rdx); |
| 1365 } |
| 1366 |
| 1357 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) || | 1367 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
| 1358 instr->CheckFlag(HValue::kCanBeDivByZero)) | 1368 instr->CheckFlag(HValue::kCanBeDivByZero)) |
| 1359 ? AssignEnvironment(result) | 1369 ? AssignEnvironment(result) |
| 1360 : result; | 1370 : result; |
| 1361 } else if (instr->representation().IsTagged()) { | 1371 } else if (instr->representation().IsTagged()) { |
| 1362 return DoArithmeticT(Token::MOD, instr); | 1372 return DoArithmeticT(Token::MOD, instr); |
| 1363 } else { | 1373 } else { |
| 1364 ASSERT(instr->representation().IsDouble()); | 1374 ASSERT(instr->representation().IsDouble()); |
| 1365 // We call a C function for double modulo. It can't trigger a GC. | 1375 // We call a C function for double modulo. It can't trigger a GC. |
| 1366 // We need to use fixed result register for the call. | 1376 // We need to use fixed result register for the call. |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 ASSERT(instr->key()->representation().IsInteger32()); | 1794 ASSERT(instr->key()->representation().IsInteger32()); |
| 1785 LOperand* obj = UseRegisterAtStart(instr->object()); | 1795 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1786 LOperand* key = UseRegisterAtStart(instr->key()); | 1796 LOperand* key = UseRegisterAtStart(instr->key()); |
| 1787 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1797 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
| 1788 return AssignEnvironment(DefineSameAsFirst(result)); | 1798 return AssignEnvironment(DefineSameAsFirst(result)); |
| 1789 } | 1799 } |
| 1790 | 1800 |
| 1791 | 1801 |
| 1792 LInstruction* LChunkBuilder::DoLoadPixelArrayElement( | 1802 LInstruction* LChunkBuilder::DoLoadPixelArrayElement( |
| 1793 HLoadPixelArrayElement* instr) { | 1803 HLoadPixelArrayElement* instr) { |
| 1794 Abort("Pixel array loads in generated code cause segfaults (danno)"); | |
| 1795 ASSERT(instr->representation().IsInteger32()); | 1804 ASSERT(instr->representation().IsInteger32()); |
| 1796 ASSERT(instr->key()->representation().IsInteger32()); | 1805 ASSERT(instr->key()->representation().IsInteger32()); |
| 1797 LOperand* external_pointer = | 1806 LOperand* external_pointer = |
| 1798 UseRegisterAtStart(instr->external_pointer()); | 1807 UseRegisterAtStart(instr->external_pointer()); |
| 1799 LOperand* key = UseRegisterAtStart(instr->key()); | 1808 LOperand* key = UseRegisterAtStart(instr->key()); |
| 1800 LLoadPixelArrayElement* result = | 1809 LLoadPixelArrayElement* result = |
| 1801 new LLoadPixelArrayElement(external_pointer, key); | 1810 new LLoadPixelArrayElement(external_pointer, key); |
| 1802 return DefineSameAsFirst(result); | 1811 return DefineSameAsFirst(result); |
| 1803 } | 1812 } |
| 1804 | 1813 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1826 LOperand* key = needs_write_barrier | 1835 LOperand* key = needs_write_barrier |
| 1827 ? UseTempRegister(instr->key()) | 1836 ? UseTempRegister(instr->key()) |
| 1828 : UseRegisterOrConstantAtStart(instr->key()); | 1837 : UseRegisterOrConstantAtStart(instr->key()); |
| 1829 | 1838 |
| 1830 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1839 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
| 1831 } | 1840 } |
| 1832 | 1841 |
| 1833 | 1842 |
| 1834 LInstruction* LChunkBuilder::DoStorePixelArrayElement( | 1843 LInstruction* LChunkBuilder::DoStorePixelArrayElement( |
| 1835 HStorePixelArrayElement* instr) { | 1844 HStorePixelArrayElement* instr) { |
| 1836 Abort("Pixel array stores in generated code sometimes segfaults (danno)"); | |
| 1837 ASSERT(instr->value()->representation().IsInteger32()); | 1845 ASSERT(instr->value()->representation().IsInteger32()); |
| 1838 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1846 ASSERT(instr->external_pointer()->representation().IsExternal()); |
| 1839 ASSERT(instr->key()->representation().IsInteger32()); | 1847 ASSERT(instr->key()->representation().IsInteger32()); |
| 1840 | 1848 |
| 1841 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1849 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1842 LOperand* val = UseTempRegister(instr->value()); | 1850 LOperand* val = UseTempRegister(instr->value()); |
| 1843 LOperand* key = UseRegister(instr->key()); | 1851 LOperand* key = UseRegister(instr->key()); |
| 1844 | 1852 |
| 1845 return new LStorePixelArrayElement(external_pointer, key, val); | 1853 return new LStorePixelArrayElement(external_pointer, key, val); |
| 1846 } | 1854 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 | 1898 |
| 1891 | 1899 |
| 1892 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 1900 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 1893 LOperand* string = UseRegister(instr->string()); | 1901 LOperand* string = UseRegister(instr->string()); |
| 1894 LOperand* index = UseRegisterOrConstant(instr->index()); | 1902 LOperand* index = UseRegisterOrConstant(instr->index()); |
| 1895 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); | 1903 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); |
| 1896 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1904 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1897 } | 1905 } |
| 1898 | 1906 |
| 1899 | 1907 |
| 1908 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
| 1909 LOperand* char_code = UseRegister(instr->value()); |
| 1910 LStringCharFromCode* result = new LStringCharFromCode(char_code); |
| 1911 return AssignPointerMap(DefineAsRegister(result)); |
| 1912 } |
| 1913 |
| 1914 |
| 1900 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | 1915 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { |
| 1901 LOperand* string = UseRegisterAtStart(instr->value()); | 1916 LOperand* string = UseRegisterAtStart(instr->value()); |
| 1902 return DefineAsRegister(new LStringLength(string)); | 1917 return DefineAsRegister(new LStringLength(string)); |
| 1903 } | 1918 } |
| 1904 | 1919 |
| 1905 | 1920 |
| 1906 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { | 1921 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { |
| 1907 return MarkAsCall(DefineFixed(new LArrayLiteral, rax), instr); | 1922 return MarkAsCall(DefineFixed(new LArrayLiteral, rax), instr); |
| 1908 } | 1923 } |
| 1909 | 1924 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 | 2056 |
| 2042 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2057 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2043 HEnvironment* outer = current_block_->last_environment()->outer(); | 2058 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2044 current_block_->UpdateEnvironment(outer); | 2059 current_block_->UpdateEnvironment(outer); |
| 2045 return NULL; | 2060 return NULL; |
| 2046 } | 2061 } |
| 2047 | 2062 |
| 2048 } } // namespace v8::internal | 2063 } } // namespace v8::internal |
| 2049 | 2064 |
| 2050 #endif // V8_TARGET_ARCH_X64 | 2065 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |