Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 23361030: Smaller instruction to test negative number on ia32 (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 LOperand* right = instr->right(); 1780 LOperand* right = instr->right();
1781 ASSERT(left->Equals(instr->result())); 1781 ASSERT(left->Equals(instr->result()));
1782 ASSERT(left->IsRegister()); 1782 ASSERT(left->IsRegister());
1783 if (right->IsRegister()) { 1783 if (right->IsRegister()) {
1784 ASSERT(ToRegister(right).is(ecx)); 1784 ASSERT(ToRegister(right).is(ecx));
1785 1785
1786 switch (instr->op()) { 1786 switch (instr->op()) {
1787 case Token::ROR: 1787 case Token::ROR:
1788 __ ror_cl(ToRegister(left)); 1788 __ ror_cl(ToRegister(left));
1789 if (instr->can_deopt()) { 1789 if (instr->can_deopt()) {
1790 __ test(ToRegister(left), Immediate(0x80000000)); 1790 __ test(ToRegister(left), ToRegister(left));
1791 DeoptimizeIf(not_zero, instr->environment()); 1791 DeoptimizeIf(sign, instr->environment());
1792 } 1792 }
1793 break; 1793 break;
1794 case Token::SAR: 1794 case Token::SAR:
1795 __ sar_cl(ToRegister(left)); 1795 __ sar_cl(ToRegister(left));
1796 break; 1796 break;
1797 case Token::SHR: 1797 case Token::SHR:
1798 __ shr_cl(ToRegister(left)); 1798 __ shr_cl(ToRegister(left));
1799 if (instr->can_deopt()) { 1799 if (instr->can_deopt()) {
1800 __ test(ToRegister(left), Immediate(0x80000000)); 1800 __ test(ToRegister(left), ToRegister(left));
1801 DeoptimizeIf(not_zero, instr->environment()); 1801 DeoptimizeIf(sign, instr->environment());
1802 } 1802 }
1803 break; 1803 break;
1804 case Token::SHL: 1804 case Token::SHL:
1805 __ shl_cl(ToRegister(left)); 1805 __ shl_cl(ToRegister(left));
1806 break; 1806 break;
1807 default: 1807 default:
1808 UNREACHABLE(); 1808 UNREACHABLE();
1809 break; 1809 break;
1810 } 1810 }
1811 } else { 1811 } else {
1812 int value = ToInteger32(LConstantOperand::cast(right)); 1812 int value = ToInteger32(LConstantOperand::cast(right));
1813 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F); 1813 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F);
1814 switch (instr->op()) { 1814 switch (instr->op()) {
1815 case Token::ROR: 1815 case Token::ROR:
1816 if (shift_count == 0 && instr->can_deopt()) { 1816 if (shift_count == 0 && instr->can_deopt()) {
1817 __ test(ToRegister(left), Immediate(0x80000000)); 1817 __ test(ToRegister(left), ToRegister(left));
1818 DeoptimizeIf(not_zero, instr->environment()); 1818 DeoptimizeIf(sign, instr->environment());
1819 } else { 1819 } else {
1820 __ ror(ToRegister(left), shift_count); 1820 __ ror(ToRegister(left), shift_count);
1821 } 1821 }
1822 break; 1822 break;
1823 case Token::SAR: 1823 case Token::SAR:
1824 if (shift_count != 0) { 1824 if (shift_count != 0) {
1825 __ sar(ToRegister(left), shift_count); 1825 __ sar(ToRegister(left), shift_count);
1826 } 1826 }
1827 break; 1827 break;
1828 case Token::SHR: 1828 case Token::SHR:
1829 if (shift_count == 0 && instr->can_deopt()) { 1829 if (shift_count == 0 && instr->can_deopt()) {
1830 __ test(ToRegister(left), Immediate(0x80000000)); 1830 __ test(ToRegister(left), ToRegister(left));
1831 DeoptimizeIf(not_zero, instr->environment()); 1831 DeoptimizeIf(sign, instr->environment());
1832 } else { 1832 } else {
1833 __ shr(ToRegister(left), shift_count); 1833 __ shr(ToRegister(left), shift_count);
1834 } 1834 }
1835 break; 1835 break;
1836 case Token::SHL: 1836 case Token::SHL:
1837 if (shift_count != 0) { 1837 if (shift_count != 0) {
1838 if (instr->hydrogen_value()->representation().IsSmi() && 1838 if (instr->hydrogen_value()->representation().IsSmi() &&
1839 instr->can_deopt()) { 1839 instr->can_deopt()) {
1840 if (shift_count != 1) { 1840 if (shift_count != 1) {
1841 __ shl(ToRegister(left), shift_count - 1); 1841 __ shl(ToRegister(left), shift_count - 1);
(...skipping 4708 matching lines...) Expand 10 before | Expand all | Expand 10 after
6550 FixedArray::kHeaderSize - kPointerSize)); 6550 FixedArray::kHeaderSize - kPointerSize));
6551 __ bind(&done); 6551 __ bind(&done);
6552 } 6552 }
6553 6553
6554 6554
6555 #undef __ 6555 #undef __
6556 6556
6557 } } // namespace v8::internal 6557 } } // namespace v8::internal
6558 6558
6559 #endif // V8_TARGET_ARCH_IA32 6559 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698