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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart

Issue 1234753003: dart2js cps: Rewrite mutable variables to continuation parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add tests and fix an assertion Created 5 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 | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/mutable_ssa.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
index e20007188ea40389cbfc4b6e67e0917be91ca588..8383af08dcac576f9382aef117f84b1294d5f130 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
@@ -7,6 +7,7 @@ library dart2js.ir_nodes_sexpr;
import '../constants/values.dart';
import '../util/util.dart';
import 'cps_ir_nodes.dart';
+import '../universe/universe.dart' show Selector, CallStructure;
/// A [Decorator] is a function used by [SExpressionStringifier] to augment the
/// output produced for a node or reference. It can be provided to the
@@ -115,14 +116,15 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
return '$indentation(LetMutable ($name $value)\n$body)';
}
- String formatArguments(Invoke node) {
- int positionalArgumentCount = node.selector.positionalArgumentCount;
+ String formatArguments(CallStructure call,
+ List<Reference<Primitive>> arguments) {
+ int positionalArgumentCount = call.positionalArgumentCount;
List<String> args = new List<String>();
- args.addAll(
- node.arguments.getRange(0, positionalArgumentCount).map(access));
- for (int i = 0; i < node.selector.namedArgumentCount; ++i) {
- String name = node.selector.namedArguments[i];
- String arg = access(node.arguments[positionalArgumentCount + i]);
+ args.addAll(arguments.getRange(0, positionalArgumentCount).map(access));
+ List<String> argumentNames = call.getOrderedNamedArguments();
+ for (int i = 0; i < argumentNames.length; ++i) {
+ String name = argumentNames[i];
+ String arg = access(arguments[positionalArgumentCount + i]);
args.add("($name: $arg)");
}
return '(${args.join(' ')})';
@@ -131,7 +133,7 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
String visitInvokeStatic(InvokeStatic node) {
String name = node.target.name;
String cont = access(node.continuation);
- String args = formatArguments(node);
+ String args = formatArguments(node.selector.callStructure, node.arguments);
return '$indentation(InvokeStatic $name $args $cont)';
}
@@ -139,7 +141,7 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
String name = node.selector.name;
String rcv = access(node.receiver);
String cont = access(node.continuation);
- String args = formatArguments(node);
+ String args = formatArguments(node.selector.callStructure, node.arguments);
return '$indentation(InvokeMethod $rcv $name $args $cont)';
}
@@ -147,7 +149,7 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
String receiver = access(node.receiver);
String name = node.selector.name;
String cont = access(node.continuation);
- String args = formatArguments(node);
+ String args = formatArguments(node.selector.callStructure, node.arguments);
return '$indentation(InvokeMethodDirectly $receiver $name $args $cont)';
}
@@ -169,7 +171,7 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
callName = '${className}.${node.target.name}';
}
String cont = access(node.continuation);
- String args = formatArguments(node);
+ String args = formatArguments(node.selector.callStructure, node.arguments);
return '$indentation(InvokeConstructor $callName $args $cont)';
}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/mutable_ssa.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698