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

Side by Side Diff: runtime/vm/intermediate_language_x64.cc

Issue 11364222: Improve SHR by using range information for the shift count. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « runtime/vm/intermediate_language_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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 __ cqo(); // Sign extend RAX -> RDX:RAX. 1753 __ cqo(); // Sign extend RAX -> RDX:RAX.
1754 __ idivq(right_temp); // RAX: quotient, RDX: remainder. 1754 __ idivq(right_temp); // RAX: quotient, RDX: remainder.
1755 // Check the corner case of dividing the 'MIN_SMI' with -1, in which 1755 // Check the corner case of dividing the 'MIN_SMI' with -1, in which
1756 // case we cannot tag the result. 1756 // case we cannot tag the result.
1757 __ cmpq(result, Immediate(0x4000000000000000)); 1757 __ cmpq(result, Immediate(0x4000000000000000));
1758 __ j(EQUAL, deopt); 1758 __ j(EQUAL, deopt);
1759 __ SmiTag(result); 1759 __ SmiTag(result);
1760 break; 1760 break;
1761 } 1761 }
1762 case Token::kSHR: { 1762 case Token::kSHR: {
1763 if (CanDeoptimize()) {
1764 __ cmpq(right, Immediate(0));
1765 __ j(LESS, deopt);
1766 }
1767 __ SmiUntag(right);
1763 // sarq operation masks the count to 6 bits. 1768 // sarq operation masks the count to 6 bits.
1764 const Immediate kCountLimit = Immediate(0x3F); 1769 const intptr_t kCountLimit = 0x3F;
1765 __ cmpq(right, Immediate(0)); 1770 Range* right_range = this->right()->definition()->range();
1766 __ j(LESS, deopt); 1771 if ((right_range == NULL) ||
1767 __ SmiUntag(right); 1772 !right_range->IsWithin(RangeBoundary::kMinusInfinity, kCountLimit)) {
1768 __ cmpq(right, kCountLimit); 1773 __ cmpq(right, Immediate(kCountLimit));
1769 Label count_ok; 1774 Label count_ok;
1770 __ j(LESS, &count_ok, Assembler::kNearJump); 1775 __ j(LESS, &count_ok, Assembler::kNearJump);
1771 __ movq(right, kCountLimit); 1776 __ movq(right, Immediate(kCountLimit));
1772 __ Bind(&count_ok); 1777 __ Bind(&count_ok);
1778 }
1773 ASSERT(right == RCX); // Count must be in RCX 1779 ASSERT(right == RCX); // Count must be in RCX
1774 __ SmiUntag(left); 1780 __ SmiUntag(left);
1775 __ sarq(left, right); 1781 __ sarq(left, right);
1776 __ SmiTag(left); 1782 __ SmiTag(left);
1777 break; 1783 break;
1778 } 1784 }
1779 case Token::kSHL: { 1785 case Token::kSHL: {
1780 Register temp = locs()->temp(0).reg(); 1786 Register temp = locs()->temp(0).reg();
1781 // Check if count too large for handling it inlined. 1787 // Check if count too large for handling it inlined.
1782 __ movq(temp, left); 1788 __ movq(temp, left);
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 2339
2334 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2340 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2335 UNIMPLEMENTED(); 2341 UNIMPLEMENTED();
2336 } 2342 }
2337 2343
2338 } // namespace dart 2344 } // namespace dart
2339 2345
2340 #undef __ 2346 #undef __
2341 2347
2342 #endif // defined TARGET_ARCH_X64 2348 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698