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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart

Issue 1204733002: dart2js cps: Make Identical a built-in and add Interceptor to Tree IR. (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 4
5 library tree_ir_nodes; 5 library tree_ir_nodes;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../constants/values.dart' as values; 8 import '../constants/values.dart' as values;
9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 761
762 accept(ExpressionVisitor visitor) { 762 accept(ExpressionVisitor visitor) {
763 return visitor.visitCreateInvocationMirror(this); 763 return visitor.visitCreateInvocationMirror(this);
764 } 764 }
765 765
766 accept1(ExpressionVisitor1 visitor, arg) { 766 accept1(ExpressionVisitor1 visitor, arg) {
767 return visitor.visitCreateInvocationMirror(this, arg); 767 return visitor.visitCreateInvocationMirror(this, arg);
768 } 768 }
769 } 769 }
770 770
771 class Interceptor extends Expression {
772 Expression input;
773 Set<ClassElement> interceptedClasses;
774
775 Interceptor(this.input, this.interceptedClasses);
776
777 accept(ExpressionVisitor visitor) {
778 return visitor.visitInterceptor(this);
779 }
780
781 accept1(ExpressionVisitor1 visitor, arg) {
782 return visitor.visitInterceptor(this, arg);
783 }
784 }
785
771 class ForeignCode extends Node { 786 class ForeignCode extends Node {
772 final js.Template codeTemplate; 787 final js.Template codeTemplate;
773 final types.TypeMask type; 788 final types.TypeMask type;
774 final List<Expression> arguments; 789 final List<Expression> arguments;
775 final native.NativeBehavior nativeBehavior; 790 final native.NativeBehavior nativeBehavior;
776 final Element dependency; 791 final Element dependency;
777 792
778 ForeignCode(this.codeTemplate, this.type, this.arguments, this.nativeBehavior, 793 ForeignCode(this.codeTemplate, this.type, this.arguments, this.nativeBehavior,
779 this.dependency); 794 this.dependency);
780 } 795 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 E visitGetField(GetField node); 870 E visitGetField(GetField node);
856 E visitSetField(SetField node); 871 E visitSetField(SetField node);
857 E visitGetStatic(GetStatic node); 872 E visitGetStatic(GetStatic node);
858 E visitSetStatic(SetStatic node); 873 E visitSetStatic(SetStatic node);
859 E visitCreateBox(CreateBox node); 874 E visitCreateBox(CreateBox node);
860 E visitCreateInstance(CreateInstance node); 875 E visitCreateInstance(CreateInstance node);
861 E visitReifyRuntimeType(ReifyRuntimeType node); 876 E visitReifyRuntimeType(ReifyRuntimeType node);
862 E visitReadTypeVariable(ReadTypeVariable node); 877 E visitReadTypeVariable(ReadTypeVariable node);
863 E visitTypeExpression(TypeExpression node); 878 E visitTypeExpression(TypeExpression node);
864 E visitCreateInvocationMirror(CreateInvocationMirror node); 879 E visitCreateInvocationMirror(CreateInvocationMirror node);
880 E visitInterceptor(Interceptor node);
865 E visitApplyBuiltinOperator(ApplyBuiltinOperator node); 881 E visitApplyBuiltinOperator(ApplyBuiltinOperator node);
866 E visitForeignExpression(ForeignExpression node); 882 E visitForeignExpression(ForeignExpression node);
867 } 883 }
868 884
869 abstract class ExpressionVisitor1<E, A> { 885 abstract class ExpressionVisitor1<E, A> {
870 E visitExpression(Expression node, A arg) => node.accept1(this, arg); 886 E visitExpression(Expression node, A arg) => node.accept1(this, arg);
871 E visitVariableUse(VariableUse node, A arg); 887 E visitVariableUse(VariableUse node, A arg);
872 E visitAssign(Assign node, A arg); 888 E visitAssign(Assign node, A arg);
873 E visitInvokeStatic(InvokeStatic node, A arg); 889 E visitInvokeStatic(InvokeStatic node, A arg);
874 E visitInvokeMethod(InvokeMethod node, A arg); 890 E visitInvokeMethod(InvokeMethod node, A arg);
(...skipping 11 matching lines...) Expand all
886 E visitGetField(GetField node, A arg); 902 E visitGetField(GetField node, A arg);
887 E visitSetField(SetField node, A arg); 903 E visitSetField(SetField node, A arg);
888 E visitGetStatic(GetStatic node, A arg); 904 E visitGetStatic(GetStatic node, A arg);
889 E visitSetStatic(SetStatic node, A arg); 905 E visitSetStatic(SetStatic node, A arg);
890 E visitCreateBox(CreateBox node, A arg); 906 E visitCreateBox(CreateBox node, A arg);
891 E visitCreateInstance(CreateInstance node, A arg); 907 E visitCreateInstance(CreateInstance node, A arg);
892 E visitReifyRuntimeType(ReifyRuntimeType node, A arg); 908 E visitReifyRuntimeType(ReifyRuntimeType node, A arg);
893 E visitReadTypeVariable(ReadTypeVariable node, A arg); 909 E visitReadTypeVariable(ReadTypeVariable node, A arg);
894 E visitTypeExpression(TypeExpression node, A arg); 910 E visitTypeExpression(TypeExpression node, A arg);
895 E visitCreateInvocationMirror(CreateInvocationMirror node, A arg); 911 E visitCreateInvocationMirror(CreateInvocationMirror node, A arg);
912 E visitInterceptor(Interceptor node, A arg);
896 E visitApplyBuiltinOperator(ApplyBuiltinOperator node, A arg); 913 E visitApplyBuiltinOperator(ApplyBuiltinOperator node, A arg);
897 E visitForeignExpression(ForeignExpression node, A arg); 914 E visitForeignExpression(ForeignExpression node, A arg);
898 } 915 }
899 916
900 abstract class StatementVisitor<S> { 917 abstract class StatementVisitor<S> {
901 S visitStatement(Statement node) => node.accept(this); 918 S visitStatement(Statement node) => node.accept(this);
902 S visitLabeledStatement(LabeledStatement node); 919 S visitLabeledStatement(LabeledStatement node);
903 S visitReturn(Return node); 920 S visitReturn(Return node);
904 S visitThrow(Throw node); 921 S visitThrow(Throw node);
905 S visitRethrow(Rethrow node); 922 S visitRethrow(Rethrow node);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 node.arguments.forEach(visitExpression); 1107 node.arguments.forEach(visitExpression);
1091 } 1108 }
1092 1109
1093 visitUnreachable(Unreachable node) { 1110 visitUnreachable(Unreachable node) {
1094 } 1111 }
1095 1112
1096 visitApplyBuiltinOperator(ApplyBuiltinOperator node) { 1113 visitApplyBuiltinOperator(ApplyBuiltinOperator node) {
1097 node.arguments.forEach(visitExpression); 1114 node.arguments.forEach(visitExpression);
1098 } 1115 }
1099 1116
1117 visitInterceptor(Interceptor node) {
1118 visitExpression(node.input);
1119 }
1120
1100 visitForeignCode(ForeignCode node) { 1121 visitForeignCode(ForeignCode node) {
1101 node.arguments.forEach(visitExpression); 1122 node.arguments.forEach(visitExpression);
1102 } 1123 }
1103 1124
1104 visitForeignExpression(ForeignExpression node) => visitForeignCode(node); 1125 visitForeignExpression(ForeignExpression node) => visitForeignCode(node);
1105 visitForeignStatement(ForeignStatement node) => visitForeignCode(node); 1126 visitForeignStatement(ForeignStatement node) => visitForeignCode(node);
1106 } 1127 }
1107 1128
1108 abstract class Transformer implements ExpressionVisitor<Expression>, 1129 abstract class Transformer implements ExpressionVisitor<Expression>,
1109 StatementVisitor<Statement> { 1130 StatementVisitor<Statement> {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 } 1327 }
1307 1328
1308 visitUnreachable(Unreachable node) { 1329 visitUnreachable(Unreachable node) {
1309 return node; 1330 return node;
1310 } 1331 }
1311 1332
1312 visitApplyBuiltinOperator(ApplyBuiltinOperator node) { 1333 visitApplyBuiltinOperator(ApplyBuiltinOperator node) {
1313 _replaceExpressions(node.arguments); 1334 _replaceExpressions(node.arguments);
1314 return node; 1335 return node;
1315 } 1336 }
1337
1338 visitInterceptor(Interceptor node) {
1339 node.input = visitExpression(node.input);
1340 return node;
1341 }
1316 } 1342 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698