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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10883054: Split class and smi check from array operations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/intermediate_language_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 11380)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -202,9 +202,6 @@
ICData::ZoneHandle(comp->ic_data()->AsUnaryClassChecks());
check->set_ic_data(&unary_checks);
InsertBefore(instr, check, instr->env(), BindInstr::kUnused);
- // Detach environment from the original instruction because it can't
- // deoptimize.
- instr->set_env(NULL);
}
@@ -223,18 +220,21 @@
// Fall through.
case kArrayCid:
case kGrowableObjectArrayCid: {
+ Value* array = comp->ArgumentAt(0)->value();
+ Value* index = comp->ArgumentAt(1)->value();
+ // Insert class check and index smi checks and attach a copy of the
+ // original environment because the operation can still deoptimize.
+ AddCheckClass(instr, comp, array->CopyValue());
+ InsertBefore(instr,
+ new CheckSmiComp(index->CopyValue(), comp),
+ instr->env(),
+ BindInstr::kUnused);
Computation* array_op = NULL;
if (op_kind == Token::kINDEX) {
- array_op = new LoadIndexedComp(comp->ArgumentAt(0)->value(),
- comp->ArgumentAt(1)->value(),
- class_id,
- comp);
+ array_op = new LoadIndexedComp(array, index, class_id, comp);
} else {
- array_op = new StoreIndexedComp(comp->ArgumentAt(0)->value(),
- comp->ArgumentAt(1)->value(),
- comp->ArgumentAt(2)->value(),
- class_id,
- comp);
+ Value* value = comp->ArgumentAt(2)->value();
+ array_op = new StoreIndexedComp(array, index, value, class_id, comp);
}
array_op->set_ic_data(comp->ic_data());
instr->set_computation(array_op);
@@ -472,6 +472,9 @@
ASSERT(!field.IsNull());
AddCheckClass(instr, comp, comp->ArgumentAt(0)->value()->CopyValue());
+ // Detach environment from the original instruction because it can't
+ // deoptimize.
+ instr->set_env(NULL);
LoadInstanceFieldComp* load =
new LoadInstanceFieldComp(field,
comp->ArgumentAt(0)->value(),
@@ -669,6 +672,9 @@
ASSERT(!field.IsNull());
AddCheckClass(instr, comp, comp->ArgumentAt(0)->value()->CopyValue());
+ // Detach environment from the original instruction because it can't
+ // deoptimize.
+ instr->set_env(NULL);
StoreInstanceFieldComp* store = new StoreInstanceFieldComp(
field,
comp->ArgumentAt(0)->value(),
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698