Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 29815) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -6307,14 +6307,27 @@ |
| : instr->left()->Type()->IsNull(); |
| if (instr->kind() == Token::kNE_STRICT) result = !result; |
| SetValue(instr, Bool::Get(result)); |
| - } else { |
| - SetValue(instr, non_constant_); |
| + return; |
|
Kevin Millikin (Google)
2013/11/07 11:29:37
If you want the early return, this should be:
if
|
| } |
| - } else if (IsConstant(left) && IsConstant(right)) { |
| + } |
| + if (IsConstant(left) && IsConstant(right)) { |
| bool result = (left.raw() == right.raw()); |
| if (instr->kind() == Token::kNE_STRICT) result = !result; |
| SetValue(instr, Bool::Get(result)); |
| + return; |
| } |
| + const intptr_t left_cid = instr->left()->Type()->ToCid(); |
| + const intptr_t right_cid = instr->right()->Type()->ToCid(); |
| + if ((left_cid != kDynamicCid) && (right_cid != kDynamicCid)) { |
| + // If exact classes (cids) are known and they differ, the result |
| + // of strict compare can be computed. |
| + if (left_cid != right_cid) { |
| + const bool result = (instr->kind() == Token::kEQ_STRICT) ? false : true; |
| + SetValue(instr, Bool::Get(result)); |
| + return; |
| + } |
| + } |
| + SetValue(instr, non_constant_); |
|
Kevin Millikin (Google)
2013/11/07 11:29:37
Abbreviate non-constant by X, constant by C, unkno
|
| } |