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

Unified Diff: runtime/vm/constant_propagator.cc

Issue 1197263002: Fix crash in modPow (issue 23693); various bigint knowledge missing. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: c Created 5 years, 6 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 | « no previous file | runtime/vm/intermediate_language.cc » ('j') | tests/corelib/corelib.status » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/constant_propagator.cc
diff --git a/runtime/vm/constant_propagator.cc b/runtime/vm/constant_propagator.cc
index a1abaaded7d9d3a7295b80d34bc65707ad2cf8ff..35bab84f004618cd9382b4f49737a9d7f28caa45 100644
--- a/runtime/vm/constant_propagator.cc
+++ b/runtime/vm/constant_propagator.cc
@@ -508,13 +508,17 @@ static bool CompareIntegers(Token::Kind kind,
}
+// Comparison instruction that is equivalent to the (left & right) == 0
+// comparison pattern.
void ConstantPropagator::VisitTestSmi(TestSmiInstr* instr) {
const Object& left = instr->left()->definition()->constant_value();
const Object& right = instr->right()->definition()->constant_value();
if (IsNonConstant(left) || IsNonConstant(right)) {
SetValue(instr, non_constant_);
} else if (IsConstant(left) && IsConstant(right)) {
- if (left.IsInteger() && right.IsInteger()) {
+ // BitOp does not work on Bigints.
+ if (left.IsInteger() && right.IsInteger() &&
+ !left.IsBigint() && !right.IsBigint()) {
const bool result = CompareIntegers(
instr->kind(),
Integer::Handle(I, Integer::Cast(left).BitOp(Token::kBIT_AND,
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.cc » ('j') | tests/corelib/corelib.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698