Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 16185) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -1203,9 +1203,17 @@ |
| if ((recognized_kind == MethodRecognizer::kDoubleToInteger) && |
| (class_ids[0] == kDoubleCid)) { |
| AddCheckClass(call, call->ArgumentAt(0)->value()->Copy()); |
| - DoubleToIntegerInstr* d2int_instr = |
| - new DoubleToIntegerInstr(call->ArgumentAt(0)->value(), call); |
| - call->ReplaceWith(d2int_instr, current_iterator()); |
| + ASSERT(call->HasICData()); |
| + const ICData& ic_data = *call->ic_data(); |
| + Definition* d2i_instr = NULL; |
| + if (ic_data.deopt_reason() == kDeoptDoubleToSmi) { |
| + // Do not repeatedly deoptimize because result didn't fit into Smi. |
| + d2i_instr = new DoubleToIntegerInstr(call->ArgumentAt(0)->value(), call); |
|
Vyacheslav Egorov (Google)
2012/12/17 12:53:44
It would be great if we could test things like thi
srdjan
2012/12/18 00:12:47
I do manual tests, by tracing deoptimization. I ag
|
| + } else { |
| + // Optimistically assume result fits into Smi. |
| + d2i_instr = new DoubleToSmiInstr(call->ArgumentAt(0)->value(), call); |
| + } |
| + call->ReplaceWith(d2i_instr, current_iterator()); |
| RemovePushArguments(call); |
| return true; |
| } |
| @@ -4047,6 +4055,12 @@ |
| } |
| +void ConstantPropagator::VisitDoubleToSmi(DoubleToSmiInstr* instr) { |
| + // TODO(kmillikin): Handle conversion. |
| + SetValue(instr, non_constant_); |
|
Vyacheslav Egorov (Google)
2012/12/17 12:53:44
I think we should stop posponing this to TODOs whe
srdjan
2012/12/18 00:12:47
I think there some work needed to implement consta
Vyacheslav Egorov (Google)
2012/12/18 11:45:10
Agreed about separate CL.
I was under impression
|
| +} |
| + |
| + |
| void ConstantPropagator::VisitConstant(ConstantInstr* instr) { |
| SetValue(instr, instr->value()); |
| } |