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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 __ SmiUntag(left); 1750 __ SmiUntag(left);
1751 __ sarl(left, right); 1751 __ sarl(left, right);
1752 __ SmiTag(left); 1752 __ SmiTag(left);
1753 break; 1753 break;
1754 } 1754 }
1755 case Token::kSHL: { 1755 case Token::kSHL: {
1756 Register temp = locs()->temp(0).reg(); 1756 Register temp = locs()->temp(0).reg();
1757 Label call_method, done; 1757 Label call_method, done;
1758 // Check if count too large for handling it inlined. 1758 // Check if count too large for handling it inlined.
1759 __ movl(temp, left); 1759 __ movl(temp, left);
1760 __ cmpl(right, 1760 Range* right_range = this->right()->definition()->range();
1761 const bool right_needs_check =
1762 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1));
1763 if (right_needs_check) {
1764 __ cmpl(right,
1761 Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); 1765 Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits))));
1762 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); 1766 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump);
1767 }
1763 Register right_temp = locs()->temp(1).reg(); 1768 Register right_temp = locs()->temp(1).reg();
1764 ASSERT(right_temp == ECX); // Count must be in ECX 1769 ASSERT(right_temp == ECX); // Count must be in ECX
1765 __ movl(right_temp, right); 1770 __ movl(right_temp, right);
1766 __ SmiUntag(right_temp); 1771 __ SmiUntag(right_temp);
1767 // Overflow test (preserve temp and right); 1772 // Overflow test (preserve temp and right);
1768 __ shll(left, right_temp); 1773 __ shll(left, right_temp);
1769 __ sarl(left, right_temp); 1774 __ sarl(left, right_temp);
1770 __ cmpl(left, temp); 1775 __ cmpl(left, temp);
1771 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. 1776 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow.
1772 // Shift for result now we know there is no overflow. 1777 // Shift for result now we know there is no overflow.
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. 2582 __ pcmpeqq(XMM0, XMM0); // Generate all 1's.
2578 __ pxor(value, XMM0); 2583 __ pxor(value, XMM0);
2579 } 2584 }
2580 2585
2581 2586
2582 } // namespace dart 2587 } // namespace dart
2583 2588
2584 #undef __ 2589 #undef __
2585 2590
2586 #endif // defined TARGET_ARCH_X64 2591 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698