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

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: v 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') | no next file with comments »
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..551b41e2e0a10b49e464788258ef64efcbe6c887 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()) &&
regis 2015/06/22 21:57:18 Parenthesis around (left.IsInteger() && right.IsIn
srdjan 2015/06/22 22:00:41 Done.
+ !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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698