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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1195573003: dart2js cps: Refactor and optimize string concatenations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Revert doc comment change 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 library dart2js.ir_nodes; 4 library dart2js.ir_nodes;
5 5
6 import '../constants/expressions.dart'; 6 import '../constants/expressions.dart';
7 import '../constants/values.dart' as values show ConstantValue; 7 import '../constants/values.dart' as values show ConstantValue;
8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../io/source_information.dart' show SourceInformation; 10 import '../io/source_information.dart' show SourceInformation;
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 this.type, 429 this.type,
430 List<Primitive> typeArguments, 430 List<Primitive> typeArguments,
431 Continuation cont) 431 Continuation cont)
432 : this.value = new Reference<Primitive>(value), 432 : this.value = new Reference<Primitive>(value),
433 this.typeArguments = _referenceList(typeArguments), 433 this.typeArguments = _referenceList(typeArguments),
434 this.continuation = new Reference<Continuation>(cont); 434 this.continuation = new Reference<Continuation>(cont);
435 435
436 accept(Visitor visitor) => visitor.visitTypeCast(this); 436 accept(Visitor visitor) => visitor.visitTypeCast(this);
437 } 437 }
438 438
439 /// Invoke [toString] on each argument and concatenate the results.
440 class ConcatenateStrings extends Expression {
441 final List<Reference<Primitive>> arguments;
442 final Reference<Continuation> continuation;
443
444 ConcatenateStrings(List<Primitive> args, Continuation cont)
445 : arguments = _referenceList(args),
446 continuation = new Reference<Continuation>(cont);
447
448 accept(Visitor visitor) => visitor.visitConcatenateStrings(this);
449 }
450
451 /// Apply a built-in operator. 439 /// Apply a built-in operator.
452 /// 440 ///
453 /// It must be known that the arguments have the proper types. 441 /// It must be known that the arguments have the proper types.
454 class ApplyBuiltinOperator extends Primitive { 442 class ApplyBuiltinOperator extends Primitive {
455 BuiltinOperator operator; 443 BuiltinOperator operator;
456 List<Reference<Primitive>> arguments; 444 List<Reference<Primitive>> arguments;
457 445
458 ApplyBuiltinOperator(this.operator, List<Primitive> arguments) 446 ApplyBuiltinOperator(this.operator, List<Primitive> arguments)
459 : this.arguments = _referenceList(arguments); 447 : this.arguments = _referenceList(arguments);
460 448
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 ForeignCode(this.codeTemplate, this.type, List<Primitive> arguments, 750 ForeignCode(this.codeTemplate, this.type, List<Primitive> arguments,
763 this.nativeBehavior, {Continuation continuation, this.dependency}) 751 this.nativeBehavior, {Continuation continuation, this.dependency})
764 : arguments = _referenceList(arguments), 752 : arguments = _referenceList(arguments),
765 continuation = continuation == null ? null 753 continuation = continuation == null ? null
766 : new Reference<Continuation>(continuation); 754 : new Reference<Continuation>(continuation);
767 755
768 accept(Visitor visitor) => visitor.visitForeignCode(this); 756 accept(Visitor visitor) => visitor.visitForeignCode(this);
769 } 757 }
770 758
771 class Constant extends Primitive { 759 class Constant extends Primitive {
772 final ConstantExpression expression;
773 final values.ConstantValue value; 760 final values.ConstantValue value;
774 761
775 Constant(this.expression, this.value); 762 Constant(this.value);
776 763
777 accept(Visitor visitor) => visitor.visitConstant(this); 764 accept(Visitor visitor) => visitor.visitConstant(this);
778 } 765 }
779 766
780 class LiteralList extends Primitive { 767 class LiteralList extends Primitive {
781 /// The List type being created; this is not the type argument. 768 /// The List type being created; this is not the type argument.
782 final InterfaceType type; 769 final InterfaceType type;
783 final List<Reference<Primitive>> values; 770 final List<Reference<Primitive>> values;
784 771
785 LiteralList(this.type, List<Primitive> values) 772 LiteralList(this.type, List<Primitive> values)
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 // Expressions. 946 // Expressions.
960 T visitLetPrim(LetPrim node); 947 T visitLetPrim(LetPrim node);
961 T visitLetCont(LetCont node); 948 T visitLetCont(LetCont node);
962 T visitLetHandler(LetHandler node); 949 T visitLetHandler(LetHandler node);
963 T visitLetMutable(LetMutable node); 950 T visitLetMutable(LetMutable node);
964 T visitInvokeContinuation(InvokeContinuation node); 951 T visitInvokeContinuation(InvokeContinuation node);
965 T visitInvokeStatic(InvokeStatic node); 952 T visitInvokeStatic(InvokeStatic node);
966 T visitInvokeMethod(InvokeMethod node); 953 T visitInvokeMethod(InvokeMethod node);
967 T visitInvokeMethodDirectly(InvokeMethodDirectly node); 954 T visitInvokeMethodDirectly(InvokeMethodDirectly node);
968 T visitInvokeConstructor(InvokeConstructor node); 955 T visitInvokeConstructor(InvokeConstructor node);
969 T visitConcatenateStrings(ConcatenateStrings node);
970 T visitThrow(Throw node); 956 T visitThrow(Throw node);
971 T visitRethrow(Rethrow node); 957 T visitRethrow(Rethrow node);
972 T visitBranch(Branch node); 958 T visitBranch(Branch node);
973 T visitTypeCast(TypeCast node); 959 T visitTypeCast(TypeCast node);
974 T visitSetMutableVariable(SetMutableVariable node); 960 T visitSetMutableVariable(SetMutableVariable node);
975 T visitSetStatic(SetStatic node); 961 T visitSetStatic(SetStatic node);
976 T visitGetLazyStatic(GetLazyStatic node); 962 T visitGetLazyStatic(GetLazyStatic node);
977 T visitSetField(SetField node); 963 T visitSetField(SetField node);
978 T visitUnreachable(Unreachable node); 964 T visitUnreachable(Unreachable node);
979 965
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 node.arguments.forEach(processReference); 1072 node.arguments.forEach(processReference);
1087 } 1073 }
1088 1074
1089 processInvokeConstructor(InvokeConstructor node) {} 1075 processInvokeConstructor(InvokeConstructor node) {}
1090 visitInvokeConstructor(InvokeConstructor node) { 1076 visitInvokeConstructor(InvokeConstructor node) {
1091 processInvokeConstructor(node); 1077 processInvokeConstructor(node);
1092 processReference(node.continuation); 1078 processReference(node.continuation);
1093 node.arguments.forEach(processReference); 1079 node.arguments.forEach(processReference);
1094 } 1080 }
1095 1081
1096 processConcatenateStrings(ConcatenateStrings node) {}
1097 visitConcatenateStrings(ConcatenateStrings node) {
1098 processConcatenateStrings(node);
1099 processReference(node.continuation);
1100 node.arguments.forEach(processReference);
1101 }
1102
1103 processThrow(Throw node) {} 1082 processThrow(Throw node) {}
1104 visitThrow(Throw node) { 1083 visitThrow(Throw node) {
1105 processThrow(node); 1084 processThrow(node);
1106 processReference(node.value); 1085 processReference(node.value);
1107 } 1086 }
1108 1087
1109 processRethrow(Rethrow node) {} 1088 processRethrow(Rethrow node) {}
1110 visitRethrow(Rethrow node) { 1089 visitRethrow(Rethrow node) {
1111 processRethrow(node); 1090 processRethrow(node);
1112 } 1091 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 const RemovalVisitor(); 1289 const RemovalVisitor();
1311 1290
1312 processReference(Reference reference) { 1291 processReference(Reference reference) {
1313 reference.unlink(); 1292 reference.unlink();
1314 } 1293 }
1315 1294
1316 static void remove(Node node) { 1295 static void remove(Node node) {
1317 (const RemovalVisitor()).visit(node); 1296 (const RemovalVisitor()).visit(node);
1318 } 1297 }
1319 } 1298 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698