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

Unified Diff: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart

Issue 1201753004: Revert "dart2js cps: Refactor and optimize string concatenations." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
index 523314dff9a8ff5a42e894a276e20df42aae5f3f..41b7bcda507566afd1ae51043dc2fd654d819fc0 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
@@ -267,16 +267,31 @@ class InvokeConstructor extends Expression implements Invoke {
}
}
+/// Calls [toString] on each argument and concatenates the results.
+class ConcatenateStrings extends Expression {
+ final List<Expression> arguments;
+
+ ConcatenateStrings(this.arguments);
+
+ accept(ExpressionVisitor visitor) => visitor.visitConcatenateStrings(this);
+ accept1(ExpressionVisitor1 visitor, arg) {
+ return visitor.visitConcatenateStrings(this, arg);
+ }
+}
+
/**
* A constant.
*/
class Constant extends Expression {
+ final ConstantExpression expression;
final values.ConstantValue value;
- Constant(this.value);
+ Constant(this.expression, this.value);
Constant.bool(values.BoolConstantValue constantValue)
- : value = constantValue;
+ : expression = new BoolConstantExpression(
+ constantValue.primitiveValue),
+ value = constantValue;
accept(ExpressionVisitor visitor) => visitor.visitConstant(this);
accept1(ExpressionVisitor1 visitor, arg) => visitor.visitConstant(this, arg);
@@ -843,6 +858,7 @@ abstract class ExpressionVisitor<E> {
E visitInvokeMethod(InvokeMethod node);
E visitInvokeMethodDirectly(InvokeMethodDirectly node);
E visitInvokeConstructor(InvokeConstructor node);
+ E visitConcatenateStrings(ConcatenateStrings node);
E visitConstant(Constant node);
E visitThis(This node);
E visitConditional(Conditional node);
@@ -874,6 +890,7 @@ abstract class ExpressionVisitor1<E, A> {
E visitInvokeMethod(InvokeMethod node, A arg);
E visitInvokeMethodDirectly(InvokeMethodDirectly node, A arg);
E visitInvokeConstructor(InvokeConstructor node, A arg);
+ E visitConcatenateStrings(ConcatenateStrings node, A arg);
E visitConstant(Constant node, A arg);
E visitThis(This node, A arg);
E visitConditional(Conditional node, A arg);
@@ -966,6 +983,10 @@ abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor {
node.arguments.forEach(visitExpression);
}
+ visitConcatenateStrings(ConcatenateStrings node) {
+ node.arguments.forEach(visitExpression);
+ }
+
visitConstant(Constant node) {}
visitThis(This node) {}
@@ -1151,6 +1172,11 @@ class RecursiveTransformer extends Transformer {
return node;
}
+ visitConcatenateStrings(ConcatenateStrings node) {
+ _replaceExpressions(node.arguments);
+ return node;
+ }
+
visitConstant(Constant node) => node;
visitThis(This node) => node;
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698