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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 12086045: On Ia32 optimistically assume that results from int32 and uint32 array loads fit into Smi. Only if … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/code_generator.h ('k') | 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 17771)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -733,6 +733,8 @@
bool FlowGraphOptimizer::TryReplaceWithLoadIndexed(InstanceCallInstr* call) {
const intptr_t class_id = ReceiverClassId(call);
+ // Set deopt_id to a valid id if the LoadIndexedInstr can cause deopt.
+ intptr_t deopt_id = Isolate::kNoDeoptId;
switch (class_id) {
case kArrayCid:
case kImmutableArrayCid:
@@ -753,6 +755,17 @@
if ((kSmiBits < 32) && !FlowGraphCompiler::SupportsUnboxedMints()) {
return false;
}
+ // Set deopt_id if we can optimistically assume that the result is Smi.
+ // TODO(srdjan): Add better signal if this instruction caused
Florian Schneider 2013/01/29 19:57:58 call->ic_data().deopt_reason() should contain the
+ // deoptimization. This solution: only if no deoptimization occured in
+ // this method is it guaranteed that this instruction did not cause
+ // deoptimization.
+ if (flow_graph_->parsed_function().function().deoptimization_counter()
+ > 0) {
+ deopt_id = Isolate::kNoDeoptId;
+ } else {
+ deopt_id = call->deopt_id();
+ }
break;
default:
return false;
@@ -760,7 +773,8 @@
Value* array = NULL;
Value* index = NULL;
intptr_t array_cid = PrepareIndexedOp(call, class_id, &array, &index);
- Definition* array_op = new LoadIndexedInstr(array, index, array_cid);
+ Definition* array_op =
+ new LoadIndexedInstr(array, index, array_cid, deopt_id);
call->ReplaceWith(array_op, current_iterator());
RemovePushArguments(call);
return true;
@@ -1289,7 +1303,7 @@
call->env(),
Definition::kEffect);
}
- return new LoadIndexedInstr(str, index, cid);
+ return new LoadIndexedInstr(str, index, cid, Isolate::kNoDeoptId);
}
« no previous file with comments | « runtime/vm/code_generator.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698