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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 22991007: Cleanup conversion insertion in unboxed -> unboxed case. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 8c8df78dbe70b2b0c3c16b92adc7e0d8e6ccb479..a489982f45f06dd1e5797af0332e4dbbe47f0a65 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -400,20 +400,49 @@ void FlowGraphOptimizer::InsertConversion(Representation from,
} else if ((from == kUnboxedUint32x4) && (to == kTagged)) {
converted = new BoxUint32x4Instr(use->CopyWithType());
} else {
+ // We have failed to find a suitable conversion instruction.
+ // Insert two "dummy" conversion instructions with the correct
+ // "from" and "to" representation. The inserted instructions will
+ // trigger a deoptimization if executed. See #12417 for a discussion.
const intptr_t deopt_id = (deopt_target != NULL) ?
deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
- // We have failed to find a suitable conversion instruction.
- // Insert a "dummy" conversion instruction with the correct
- // "to" representation. The inserted instruction will trigger a
- // a deoptimization if executed. See issue #12417 for a discussion.
+ ASSERT(from != kTagged);
+ ASSERT(to != kTagged);
+ Value* to_value = NULL;
+ if (from == kUnboxedDouble) {
+ BoxDoubleInstr* boxed = new BoxDoubleInstr(use->CopyWithType());
+ use->BindTo(boxed);
+ InsertBefore(insert_before, boxed, NULL, Definition::kValue);
+ to_value = new Value(boxed);
+ } else if (from == kUnboxedUint32x4) {
+ BoxUint32x4Instr* boxed = new BoxUint32x4Instr(use->CopyWithType());
+ use->BindTo(boxed);
+ InsertBefore(insert_before, boxed, NULL, Definition::kValue);
+ to_value = new Value(boxed);
+ } else if (from == kUnboxedFloat32x4) {
+ BoxFloat32x4Instr* boxed = new BoxFloat32x4Instr(use->CopyWithType());
+ use->BindTo(boxed);
+ InsertBefore(insert_before, boxed, NULL, Definition::kValue);
+ to_value = new Value(boxed);
+ } else if (from == kUnboxedMint) {
+ BoxIntegerInstr* boxed = new BoxIntegerInstr(use->CopyWithType());
Florian Schneider 2013/08/21 08:38:51 You could share the three lines below instead of d
+ use->BindTo(boxed);
+ InsertBefore(insert_before, boxed, NULL, Definition::kValue);
+ to_value = new Value(boxed);
+ } else {
+ UNIMPLEMENTED();
+ }
+ ASSERT(to_value != NULL);
if (to == kUnboxedDouble) {
- converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id);
+ converted = new UnboxDoubleInstr(to_value, deopt_id);
} else if (to == kUnboxedUint32x4) {
- converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id);
+ converted = new UnboxUint32x4Instr(to_value, deopt_id);
} else if (to == kUnboxedFloat32x4) {
- converted = new UnboxDoubleInstr(use->CopyWithType(), deopt_id);
+ converted = new UnboxFloat32x4Instr(to_value, deopt_id);
} else if (to == kUnboxedMint) {
- converted = new UnboxIntegerInstr(use->CopyWithType(), deopt_id);
+ converted = new UnboxIntegerInstr(to_value, deopt_id);
+ } else {
+ UNIMPLEMENTED();
}
}
ASSERT(converted != NULL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698