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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10867086: Implement array bounds checks explicitly in the optimized IL. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed CanDeoptimize() 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.h » ('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 11394)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -229,12 +229,20 @@
new CheckSmiComp(index->CopyValue(), comp),
instr->env(),
BindInstr::kUnused);
+ // Insert array bounds check.
+ InsertBefore(instr,
+ new CheckArrayBoundComp(array->CopyValue(),
+ index->CopyValue(),
+ class_id,
+ comp),
+ instr->env(),
+ BindInstr::kUnused);
Computation* array_op = NULL;
if (op_kind == Token::kINDEX) {
- array_op = new LoadIndexedComp(array, index, class_id, comp);
+ array_op = new LoadIndexedComp(array, index, class_id);
} else {
Value* value = comp->ArgumentAt(2)->value();
- array_op = new StoreIndexedComp(array, index, value, class_id, comp);
+ array_op = new StoreIndexedComp(array, index, value, class_id);
}
array_op->set_ic_data(comp->ic_data());
instr->set_computation(array_op);
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698