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

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 181183004: VM: Improve receiver class check in polymorphic inlining. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: improved polymorphic ClassCheck ia32 Created 6 years, 10 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/flow_graph_optimizer.cc » ('j') | runtime/vm/intermediate_language.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.cc » ('j') | runtime/vm/intermediate_language.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698