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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 2974953002: Revise assertions and fix bug in the implementation of shifts (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | tests/language/bit_operations_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index b3c574a17f198351d61e03cb5343dbf35fa8d63c..dcb18e61ac1314ef982334ce524c623e49175e38 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -6072,14 +6072,14 @@ void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
ASSERT(locs()->in(1).constant().IsSmi());
const int64_t shift =
reinterpret_cast<int64_t>(locs()->in(1).constant().raw()) >> 1;
- // TODO(alexmarkov): revise and uncomment the following assertions
- // ASSERT(!has_shift_count_check());
- // ASSERT((0 <= shift) && (shift < 64));
+ ASSERT(shift >= 0);
switch (op_kind()) {
case Token::kSHR:
- __ sarq(left, Immediate(shift));
+ __ sarq(left,
+ Immediate(Utils::Minimum<int64_t>(shift, kBitsPerWord - 1)));
break;
case Token::kSHL: {
+ ASSERT(shift < 64);
if (can_overflow()) {
// Check for overflow.
Register temp = locs()->temp(0).reg();
@@ -6102,7 +6102,7 @@ void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// sarl operation masks the count to 5 bits and
// shrd is undefined with count > operand size (32)
regis 2017/07/11 18:45:55 This last comment does not look correct? shrd with
alexmarkov 2017/07/11 19:39:23 Done.
__ SmiUntag(RCX);
- if (has_shift_count_check()) {
+ if (!IsShiftCountInRange()) {
__ cmpq(RCX, Immediate(kMintShiftCountLimit));
__ j(ABOVE, deopt);
}
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | tests/language/bit_operations_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698