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

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 2152683003: Revert "VM: Array bounds checks that don't deoptimize for precompiled code." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | « runtime/vm/constant_propagator.cc ('k') | runtime/vm/flow_graph_type_propagator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_inliner.cc
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index a8e27c04c676222df00f560f571e4136c9e54818..eb6389deb313a50aaef26941ccf4b4db4da8cdc0 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -2047,6 +2047,15 @@ static intptr_t PrepareInlineIndexedOp(FlowGraph* flow_graph,
Definition** array,
Definition* index,
Instruction** cursor) {
+ // Insert index smi check.
+ *cursor = flow_graph->AppendTo(
+ *cursor,
+ new(Z) CheckSmiInstr(new(Z) Value(index),
+ call->deopt_id(),
+ call->token_pos()),
+ call->env(),
+ FlowGraph::kEffect);
+
// Insert array length load and bounds check.
LoadFieldInstr* length =
new(Z) LoadFieldInstr(
@@ -2511,6 +2520,15 @@ static intptr_t PrepareInlineByteArrayBaseOp(
Definition** array,
Definition* byte_index,
Instruction** cursor) {
+ // Insert byte_index smi check.
+ *cursor = flow_graph->AppendTo(*cursor,
+ new(Z) CheckSmiInstr(
+ new(Z) Value(byte_index),
+ call->deopt_id(),
+ call->token_pos()),
+ call->env(),
+ FlowGraph::kEffect);
+
LoadFieldInstr* length =
new(Z) LoadFieldInstr(
new(Z) Value(*array),
@@ -2811,6 +2829,15 @@ static Definition* PrepareInlineStringIndexOp(
Definition* str,
Definition* index,
Instruction* cursor) {
+
+ cursor = flow_graph->AppendTo(cursor,
+ new(Z) CheckSmiInstr(
+ new(Z) Value(index),
+ call->deopt_id(),
+ call->token_pos()),
+ call->env(),
+ FlowGraph::kEffect);
+
// Load the length of the string.
// Treat length loads as mutable (i.e. affected by side effects) to avoid
// hoisting them since we can't hoist the preceding class-check. This
« no previous file with comments | « runtime/vm/constant_propagator.cc ('k') | runtime/vm/flow_graph_type_propagator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698