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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 132163005: Version 1.1.0-dev.5.7 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 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/flow_graph_optimizer.h ('k') | runtime/vm/heap.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 31662)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -538,8 +538,20 @@
void FlowGraphOptimizer::InsertConversion(Representation from,
Representation to,
Value* use,
- Instruction* insert_before,
- Instruction* deopt_target) {
+ bool is_environment_use) {
+ Instruction* insert_before;
+ Instruction* deopt_target;
+ PhiInstr* phi = use->instruction()->AsPhi();
+ if (phi != NULL) {
+ ASSERT(phi->is_alive());
+ // For phis conversions have to be inserted in the predecessor.
+ insert_before =
+ phi->block()->PredecessorAt(use->use_index())->last_instruction();
+ deopt_target = NULL;
+ } else {
+ deopt_target = insert_before = use->instruction();
+ }
+
Definition* converted = NULL;
if ((from == kTagged) && (to == kUnboxedMint)) {
ASSERT((deopt_target != NULL) ||
@@ -632,9 +644,13 @@
}
}
ASSERT(converted != NULL);
- use->BindTo(converted);
InsertBefore(insert_before, converted, use->instruction()->env(),
Definition::kValue);
+ if (is_environment_use) {
+ use->BindToEnvironment(converted);
+ } else {
+ use->BindTo(converted);
+ }
}
@@ -644,21 +660,17 @@
if (from_rep == to_rep || to_rep == kNoRepresentation) {
return;
}
+ InsertConversion(from_rep, to_rep, use, /*is_environment_use=*/ false);
+}
- Instruction* insert_before;
- Instruction* deopt_target;
- PhiInstr* phi = use->instruction()->AsPhi();
- if (phi != NULL) {
- ASSERT(phi->is_alive());
- // For phis conversions have to be inserted in the predecessor.
- insert_before =
- phi->block()->PredecessorAt(use->use_index())->last_instruction();
- deopt_target = NULL;
- } else {
- deopt_target = insert_before = use->instruction();
+
+void FlowGraphOptimizer::ConvertEnvironmentUse(Value* use,
+ Representation from_rep) {
+ const Representation to_rep = kTagged;
+ if (from_rep == to_rep || to_rep == kNoRepresentation) {
+ return;
}
-
- InsertConversion(from_rep, to_rep, use, insert_before, deopt_target);
+ InsertConversion(from_rep, to_rep, use, /*is_environment_use=*/ true);
}
@@ -670,6 +682,18 @@
it.Advance()) {
ConvertUse(it.Current(), from_rep);
}
+
+ for (Value::Iterator it(def->env_use_list());
+ !it.Done();
+ it.Advance()) {
+ Value* use = it.Current();
+ if (use->instruction()->MayThrow() &&
+ use->instruction()->GetBlock()->InsideTryBlock()) {
+ // Environment uses at calls inside try-blocks must be converted to
+ // tagged representation.
+ ConvertEnvironmentUse(it.Current(), from_rep);
+ }
+ }
}
@@ -5072,8 +5096,10 @@
use = use->next_use()) {
Instruction* instr = use->instruction();
if (instr->IsPushArgument() ||
- (instr->IsStoreVMField() && (use->use_index() != 1)) ||
- (instr->IsStoreInstanceField() && (use->use_index() != 0)) ||
+ (instr->IsStoreVMField()
+ && (use->use_index() != StoreVMFieldInstr::kObjectPos)) ||
+ (instr->IsStoreInstanceField()
+ && (use->use_index() != StoreInstanceFieldInstr::kInstancePos)) ||
instr->IsStoreStaticField() ||
instr->IsPhi() ||
instr->IsAssertAssignable() ||
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698