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

Unified Diff: lib/compiler/implementation/ssa/tracer.dart

Issue 10544024: Implement constant switch as JS switch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Added to Tracer. Created 8 years, 6 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 | « lib/compiler/implementation/ssa/nodes.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/tracer.dart
diff --git a/lib/compiler/implementation/ssa/tracer.dart b/lib/compiler/implementation/ssa/tracer.dart
index a013aa159534c2f61e8c42ea51c72613fba954f3..ee3551d3122abad3b8d82760d1acf21c2856d3e0 100644
--- a/lib/compiler/implementation/ssa/tracer.dart
+++ b/lib/compiler/implementation/ssa/tracer.dart
@@ -383,6 +383,22 @@ class HInstructionStringifier implements HVisitor<String> {
String visitSubtract(HSubtract node) => visitInvokeStatic(node);
+ String visitSwitch(HSwitch node) {
+ StringBuffer buf = new StringBuffer();
+ buf.add("Switch: (");
+ buf.add(temporaryId(node.inputs[0]));
+ buf.add(") ");
+ for (int i = 1; i < node.inputs.length; i++) {
+ buf.add(temporaryId(node.inputs[i]));
+ buf.add(": B");
+ buf.add(node.block.successors[i - 1].id);
+ buf.add(", ");
+ }
+ buf.add("default: B");
+ buf.add(node.block.successors.last().id);
+ return buf.toString();
+ }
+
String visitThis(HThis node) => "this";
String visitThrow(HThrow node) => "Throw ${temporaryId(node.inputs[0])}";
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698