| Index: runtime/vm/flow_graph_inliner.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_inliner.cc (revision 33059)
|
| +++ runtime/vm/flow_graph_inliner.cc (working copy)
|
| @@ -1212,37 +1212,21 @@
|
| // 1. Guard the body with a class id check.
|
| if ((i == (inlined_variants_.length() - 1)) &&
|
| non_inlined_variants_.is_empty()) {
|
| - // If it is the last variant use a check class or check smi
|
| - // instruction which can deoptimize, followed unconditionally by the
|
| - // body. Check a redefinition of the receiver, to prevent the check
|
| - // from being hoisted.
|
| - RedefinitionInstr* redefinition =
|
| - new RedefinitionInstr(new Value(receiver));
|
| - redefinition->set_ssa_temp_index(
|
| + // If it is the last variant use a check class id instruction which can
|
| + // deoptimize, followed unconditionally by the body.
|
| + const Smi& cid = Smi::ZoneHandle(Smi::New(inlined_variants_[i].cid));
|
| + ConstantInstr* cid_constant = new ConstantInstr(cid);
|
| + cid_constant->set_ssa_temp_index(
|
| owner_->caller_graph()->alloc_ssa_temp_index());
|
| - cursor = AppendInstruction(cursor, redefinition);
|
| - if (inlined_variants_[i].cid == kSmiCid) {
|
| - CheckSmiInstr* check_smi =
|
| - new CheckSmiInstr(new Value(redefinition), call_->deopt_id());
|
| - check_smi->InheritDeoptTarget(call_);
|
| - cursor = AppendInstruction(cursor, check_smi);
|
| - } else {
|
| - const ICData& old_checks = call_->ic_data();
|
| - const ICData& new_checks = ICData::ZoneHandle(
|
| - ICData::New(Function::Handle(old_checks.function()),
|
| - String::Handle(old_checks.target_name()),
|
| - Array::Handle(old_checks.arguments_descriptor()),
|
| - old_checks.deopt_id(),
|
| - 1)); // Number of args tested.
|
| - new_checks.AddReceiverCheck(inlined_variants_[i].cid,
|
| - *inlined_variants_[i].target);
|
| - CheckClassInstr* check_class =
|
| - new CheckClassInstr(new Value(redefinition),
|
| - call_->deopt_id(),
|
| - new_checks);
|
| - check_class->InheritDeoptTarget(call_);
|
| - cursor = AppendInstruction(cursor, check_class);
|
| - }
|
| + cursor = AppendInstruction(cursor, cid_constant);
|
| +
|
| + CheckClassIdInstr* check_class_id =
|
| + new CheckClassIdInstr(new Value(load_cid),
|
| + new Value(cid_constant),
|
| + call_->deopt_id());
|
| + check_class_id->InheritDeoptTarget(call_);
|
| + cursor = AppendInstruction(cursor, check_class_id);
|
| +
|
| // The next instruction is the first instruction of the inlined body.
|
| // Handle the two possible cases (unshared and shared subsequent
|
| // predecessors) separately.
|
|
|