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

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

Issue 11175013: Add range to kBIT_AND with positive constants. Use that range to eliminate compares in left shifts. (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 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 __ SmiUntag(left); 1712 __ SmiUntag(left);
1713 __ sarq(left, right); 1713 __ sarq(left, right);
1714 __ SmiTag(left); 1714 __ SmiTag(left);
1715 break; 1715 break;
1716 } 1716 }
1717 case Token::kSHL: { 1717 case Token::kSHL: {
1718 Register temp = locs()->temp(0).reg(); 1718 Register temp = locs()->temp(0).reg();
1719 Label call_method, done; 1719 Label call_method, done;
1720 // Check if count too large for handling it inlined. 1720 // Check if count too large for handling it inlined.
1721 __ movq(temp, left); 1721 __ movq(temp, left);
1722 __ cmpq(right, 1722 Range* right_range = this->right()->definition()->range();
1723 Immediate(reinterpret_cast<int64_t>(Smi::New(Smi::kBits)))); 1723 const bool right_needs_check =
1724 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); 1724 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1));
1725 if (right_needs_check) {
1726 __ cmpq(right,
1727 Immediate(reinterpret_cast<int64_t>(Smi::New(Smi::kBits))));
1728 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump);
1729 }
1725 Register right_temp = locs()->temp(1).reg(); 1730 Register right_temp = locs()->temp(1).reg();
1726 ASSERT(right_temp == RCX); // Count must be in RCX 1731 ASSERT(right_temp == RCX); // Count must be in RCX
1727 __ movq(right_temp, right); 1732 __ movq(right_temp, right);
1728 __ SmiUntag(right_temp); 1733 __ SmiUntag(right_temp);
1729 // Overflow test (preserve temp and right); 1734 // Overflow test (preserve temp and right);
1730 __ shlq(left, right_temp); 1735 __ shlq(left, right_temp);
1731 __ sarq(left, right_temp); 1736 __ sarq(left, right_temp);
1732 __ cmpq(left, temp); 1737 __ cmpq(left, temp);
1733 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. 1738 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow.
1734 // Shift for result now we know there is no overflow. 1739 // Shift for result now we know there is no overflow.
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 2304
2300 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2305 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2301 UNIMPLEMENTED(); 2306 UNIMPLEMENTED();
2302 } 2307 }
2303 2308
2304 } // namespace dart 2309 } // namespace dart
2305 2310
2306 #undef __ 2311 #undef __
2307 2312
2308 #endif // defined TARGET_ARCH_X64 2313 #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