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

Unified Diff: runtime/vm/intermediate_language_arm64.cc

Issue 2487873003: Speculate on bitwise operators. (Closed)
Patch Set: git cl format Created 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_arm64.cc
diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc
index 5e4e500aaf956161cdf0cb3b24bca08103c9d64a..55ab8605bd0d04ad2ca5044d986680eeeb5a4c0b 100644
--- a/runtime/vm/intermediate_language_arm64.cc
+++ b/runtime/vm/intermediate_language_arm64.cc
@@ -2904,6 +2904,31 @@ void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
case Token::kBIT_XOR:
__ eor(result, left, Operand(right));
break;
+ case Token::kSHL:
+ ASSERT(result != left);
+ ASSERT(result != right);
+ __ CompareImmediate(right,
+ reinterpret_cast<int64_t>(Smi::New(Smi::kBits)));
+ __ b(slow_path->entry_label(), CS);
+
+ __ SmiUntag(TMP, right);
+ __ lslv(result, left, TMP);
+ __ asrv(TMP2, result, TMP);
+ __ CompareRegisters(left, TMP2);
+ __ b(slow_path->entry_label(), NE); // Overflow.
+ break;
+ case Token::kSHR:
+ ASSERT(result != left);
+ ASSERT(result != right);
+ __ CompareImmediate(right,
+ reinterpret_cast<int64_t>(Smi::New(Smi::kBits)));
+ __ b(slow_path->entry_label(), CS);
+
+ __ SmiUntag(result, right);
+ __ SmiUntag(TMP, left);
+ __ asrv(result, TMP, result);
+ __ SmiTag(result);
+ break;
default:
UNIMPLEMENTED();
}

Powered by Google App Engine
This is Rietveld 408576698