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

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

Issue 504057: Improve code generated for left shifts where the left side... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 } 1724 }
1725 operand->Unuse(); 1725 operand->Unuse();
1726 __ SmiTag(answer.reg()); 1726 __ SmiTag(answer.reg());
1727 deferred->BindExit(); 1727 deferred->BindExit();
1728 frame_->Push(&answer); 1728 frame_->Push(&answer);
1729 } 1729 }
1730 break; 1730 break;
1731 1731
1732 case Token::SHL: 1732 case Token::SHL:
1733 if (reversed) { 1733 if (reversed) {
1734 Result constant_operand(value); 1734 Result right;
1735 LikelySmiBinaryOperation(op, &constant_operand, operand, 1735 Result right_copy_in_ecx;
1736 overwrite_mode); 1736
1737 // Make sure to get a copy of the right operand into ecx. This
1738 // allows us to modify it without having to restore it in the
1739 // deferred code.
1740 operand->ToRegister();
1741 if (operand->reg().is(ecx)) {
1742 right = allocator()->Allocate();
1743 __ mov(right.reg(), ecx);
1744 frame_->Spill(ecx);
1745 right_copy_in_ecx = *operand;
1746 } else {
1747 right_copy_in_ecx = allocator()->Allocate(ecx);
1748 __ mov(ecx, operand->reg());
1749 right = *operand;
1750 }
1751 operand->Unuse();
1752
1753 Result answer = allocator()->Allocate();
1754 DeferredInlineSmiOperation* deferred =
1755 new DeferredInlineSmiOperation(op,
1756 answer.reg(),
1757 right.reg(),
1758 smi_value,
1759 overwrite_mode);
1760 __ mov(answer.reg(), Immediate(int_value));
1761 __ sar(ecx, kSmiTagSize);
1762 deferred->Branch(carry);
1763 __ shl_cl(answer.reg());
1764 __ cmp(answer.reg(), 0xc0000000);
1765 deferred->Branch(sign);
1766 __ SmiTag(answer.reg());
1767
1768 deferred->BindExit();
1769 frame_->Push(&answer);
1737 } else { 1770 } else {
1738 // Only the least significant 5 bits of the shift value are used. 1771 // Only the least significant 5 bits of the shift value are used.
1739 // In the slow case, this masking is done inside the runtime call. 1772 // In the slow case, this masking is done inside the runtime call.
1740 int shift_value = int_value & 0x1f; 1773 int shift_value = int_value & 0x1f;
1741 operand->ToRegister(); 1774 operand->ToRegister();
1742 if (shift_value == 0) { 1775 if (shift_value == 0) {
1743 // Spill operand so it can be overwritten in the slow case. 1776 // Spill operand so it can be overwritten in the slow case.
1744 frame_->Spill(operand->reg()); 1777 frame_->Spill(operand->reg());
1745 DeferredInlineSmiOperation* deferred = 1778 DeferredInlineSmiOperation* deferred =
1746 new DeferredInlineSmiOperation(op, 1779 new DeferredInlineSmiOperation(op,
(...skipping 7157 matching lines...) Expand 10 before | Expand all | Expand 10 after
8904 __ add(Operand(dest), Immediate(2)); 8937 __ add(Operand(dest), Immediate(2));
8905 } 8938 }
8906 __ sub(Operand(count), Immediate(1)); 8939 __ sub(Operand(count), Immediate(1));
8907 __ j(not_zero, &loop); 8940 __ j(not_zero, &loop);
8908 } 8941 }
8909 8942
8910 8943
8911 #undef __ 8944 #undef __
8912 8945
8913 } } // namespace v8::internal 8946 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698