| Index: runtime/vm/flow_graph_optimizer.cc
|
| diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
|
| index 8833ac305ece4a6b6142de01cbd087c395f6006d..4f8e4a6ea5b617180c94b016ec628cb5075b2a4c 100644
|
| --- a/runtime/vm/flow_graph_optimizer.cc
|
| +++ b/runtime/vm/flow_graph_optimizer.cc
|
| @@ -4049,6 +4049,26 @@ static bool CompareIntegers(Token::Kind kind,
|
| }
|
|
|
|
|
| +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()) {
|
| + const bool result = CompareIntegers(
|
| + instr->kind(),
|
| + Integer::Handle(Integer::Cast(left).BitOp(Token::kBIT_AND,
|
| + Integer::Cast(right))),
|
| + Smi::Handle(Smi::New(0)));
|
| + SetValue(instr, result ? Bool::True() : Bool::False());
|
| + } else {
|
| + SetValue(instr, non_constant_);
|
| + }
|
| + }
|
| +}
|
| +
|
| +
|
| void ConstantPropagator::VisitEqualityCompare(EqualityCompareInstr* instr) {
|
| const Object& left = instr->left()->definition()->constant_value();
|
| const Object& right = instr->right()->definition()->constant_value();
|
|
|