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

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

Issue 1388473003: dart2js cps_ir: Use interceptors for is-checks. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/values.dart' as values; 7 import '../constants/values.dart' as values;
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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 Expression object; 735 Expression object;
736 Element field; 736 Element field;
737 Expression value; 737 Expression value;
738 738
739 SetField(this.object, this.field, this.value); 739 SetField(this.object, this.field, this.value);
740 740
741 accept(ExpressionVisitor visitor) => visitor.visitSetField(this); 741 accept(ExpressionVisitor visitor) => visitor.visitSetField(this);
742 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitSetField(this, arg); 742 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitSetField(this, arg);
743 } 743 }
744 744
745
746 /// Read the type test property from [object]. The value is truthy/fasly rather
747 /// than bool. [object] must not be `null`.
748 class GetTypeTestProperty extends Expression {
749 Expression object;
750 DartType dartType;
751
752 GetTypeTestProperty(this.object, this.dartType);
753
754 accept(ExpressionVisitor visitor) =>
755 visitor.visitGetTypeTestProperty(this);
756 accept1(ExpressionVisitor1 visitor, arg) =>
757 visitor.visitGetTypeTestProperty(this, arg);
758 }
759
760
745 /// Read the value of a field, possibly provoking its initializer to evaluate, 761 /// Read the value of a field, possibly provoking its initializer to evaluate,
746 /// or tear off a static method. 762 /// or tear off a static method.
747 class GetStatic extends Expression { 763 class GetStatic extends Expression {
748 Element element; 764 Element element;
749 SourceInformation sourceInformation; 765 SourceInformation sourceInformation;
750 766
751 GetStatic(this.element, this.sourceInformation); 767 GetStatic(this.element, this.sourceInformation);
752 768
753 accept(ExpressionVisitor visitor) => visitor.visitGetStatic(this); 769 accept(ExpressionVisitor visitor) => visitor.visitGetStatic(this);
754 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitGetStatic(this, arg); 770 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitGetStatic(this, arg);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 E visitLogicalOperator(LogicalOperator node); 984 E visitLogicalOperator(LogicalOperator node);
969 E visitNot(Not node); 985 E visitNot(Not node);
970 E visitLiteralList(LiteralList node); 986 E visitLiteralList(LiteralList node);
971 E visitLiteralMap(LiteralMap node); 987 E visitLiteralMap(LiteralMap node);
972 E visitTypeOperator(TypeOperator node); 988 E visitTypeOperator(TypeOperator node);
973 E visitFunctionExpression(FunctionExpression node); 989 E visitFunctionExpression(FunctionExpression node);
974 E visitGetField(GetField node); 990 E visitGetField(GetField node);
975 E visitSetField(SetField node); 991 E visitSetField(SetField node);
976 E visitGetStatic(GetStatic node); 992 E visitGetStatic(GetStatic node);
977 E visitSetStatic(SetStatic node); 993 E visitSetStatic(SetStatic node);
994 E visitGetTypeTestProperty(GetTypeTestProperty node);
978 E visitCreateBox(CreateBox node); 995 E visitCreateBox(CreateBox node);
979 E visitCreateInstance(CreateInstance node); 996 E visitCreateInstance(CreateInstance node);
980 E visitReifyRuntimeType(ReifyRuntimeType node); 997 E visitReifyRuntimeType(ReifyRuntimeType node);
981 E visitReadTypeVariable(ReadTypeVariable node); 998 E visitReadTypeVariable(ReadTypeVariable node);
982 E visitTypeExpression(TypeExpression node); 999 E visitTypeExpression(TypeExpression node);
983 E visitCreateInvocationMirror(CreateInvocationMirror node); 1000 E visitCreateInvocationMirror(CreateInvocationMirror node);
984 E visitInterceptor(Interceptor node); 1001 E visitInterceptor(Interceptor node);
985 E visitApplyBuiltinOperator(ApplyBuiltinOperator node); 1002 E visitApplyBuiltinOperator(ApplyBuiltinOperator node);
986 E visitApplyBuiltinMethod(ApplyBuiltinMethod node); 1003 E visitApplyBuiltinMethod(ApplyBuiltinMethod node);
987 E visitForeignExpression(ForeignExpression node); 1004 E visitForeignExpression(ForeignExpression node);
(...skipping 17 matching lines...) Expand all
1005 E visitLogicalOperator(LogicalOperator node, A arg); 1022 E visitLogicalOperator(LogicalOperator node, A arg);
1006 E visitNot(Not node, A arg); 1023 E visitNot(Not node, A arg);
1007 E visitLiteralList(LiteralList node, A arg); 1024 E visitLiteralList(LiteralList node, A arg);
1008 E visitLiteralMap(LiteralMap node, A arg); 1025 E visitLiteralMap(LiteralMap node, A arg);
1009 E visitTypeOperator(TypeOperator node, A arg); 1026 E visitTypeOperator(TypeOperator node, A arg);
1010 E visitFunctionExpression(FunctionExpression node, A arg); 1027 E visitFunctionExpression(FunctionExpression node, A arg);
1011 E visitGetField(GetField node, A arg); 1028 E visitGetField(GetField node, A arg);
1012 E visitSetField(SetField node, A arg); 1029 E visitSetField(SetField node, A arg);
1013 E visitGetStatic(GetStatic node, A arg); 1030 E visitGetStatic(GetStatic node, A arg);
1014 E visitSetStatic(SetStatic node, A arg); 1031 E visitSetStatic(SetStatic node, A arg);
1032 E visitGetTypeTestProperty(GetTypeTestProperty node, A arg);
1015 E visitCreateBox(CreateBox node, A arg); 1033 E visitCreateBox(CreateBox node, A arg);
1016 E visitCreateInstance(CreateInstance node, A arg); 1034 E visitCreateInstance(CreateInstance node, A arg);
1017 E visitReifyRuntimeType(ReifyRuntimeType node, A arg); 1035 E visitReifyRuntimeType(ReifyRuntimeType node, A arg);
1018 E visitReadTypeVariable(ReadTypeVariable node, A arg); 1036 E visitReadTypeVariable(ReadTypeVariable node, A arg);
1019 E visitTypeExpression(TypeExpression node, A arg); 1037 E visitTypeExpression(TypeExpression node, A arg);
1020 E visitCreateInvocationMirror(CreateInvocationMirror node, A arg); 1038 E visitCreateInvocationMirror(CreateInvocationMirror node, A arg);
1021 E visitInterceptor(Interceptor node, A arg); 1039 E visitInterceptor(Interceptor node, A arg);
1022 E visitApplyBuiltinOperator(ApplyBuiltinOperator node, A arg); 1040 E visitApplyBuiltinOperator(ApplyBuiltinOperator node, A arg);
1023 E visitApplyBuiltinMethod(ApplyBuiltinMethod node, A arg); 1041 E visitApplyBuiltinMethod(ApplyBuiltinMethod node, A arg);
1024 E visitForeignExpression(ForeignExpression node, A arg); 1042 E visitForeignExpression(ForeignExpression node, A arg);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 visitExpression(node.value); 1217 visitExpression(node.value);
1200 } 1218 }
1201 1219
1202 visitGetStatic(GetStatic node) { 1220 visitGetStatic(GetStatic node) {
1203 } 1221 }
1204 1222
1205 visitSetStatic(SetStatic node) { 1223 visitSetStatic(SetStatic node) {
1206 visitExpression(node.value); 1224 visitExpression(node.value);
1207 } 1225 }
1208 1226
1227 visitGetTypeTestProperty(GetTypeTestProperty node) {
1228 visitExpression(node.object);
1229 }
1230
1209 visitCreateBox(CreateBox node) { 1231 visitCreateBox(CreateBox node) {
1210 } 1232 }
1211 1233
1212 visitCreateInstance(CreateInstance node) { 1234 visitCreateInstance(CreateInstance node) {
1213 node.arguments.forEach(visitExpression); 1235 node.arguments.forEach(visitExpression);
1214 node.typeInformation.forEach(visitExpression); 1236 node.typeInformation.forEach(visitExpression);
1215 } 1237 }
1216 1238
1217 visitReifyRuntimeType(ReifyRuntimeType node) { 1239 visitReifyRuntimeType(ReifyRuntimeType node) {
1218 visitExpression(node.value); 1240 visitExpression(node.value);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 return node; 1466 return node;
1445 } 1467 }
1446 1468
1447 visitGetStatic(GetStatic node) => node; 1469 visitGetStatic(GetStatic node) => node;
1448 1470
1449 visitSetStatic(SetStatic node) { 1471 visitSetStatic(SetStatic node) {
1450 node.value = visitExpression(node.value); 1472 node.value = visitExpression(node.value);
1451 return node; 1473 return node;
1452 } 1474 }
1453 1475
1476 visitGetTypeTestProperty(GetTypeTestProperty node) {
1477 node.object = visitExpression(node.object);
1478 return node;
1479 }
1480
1454 visitCreateBox(CreateBox node) => node; 1481 visitCreateBox(CreateBox node) => node;
1455 1482
1456 visitCreateInstance(CreateInstance node) { 1483 visitCreateInstance(CreateInstance node) {
1457 _replaceExpressions(node.arguments); 1484 _replaceExpressions(node.arguments);
1458 _replaceExpressions(node.typeInformation); 1485 _replaceExpressions(node.typeInformation);
1459 return node; 1486 return node;
1460 } 1487 }
1461 1488
1462 visitReifyRuntimeType(ReifyRuntimeType node) { 1489 visitReifyRuntimeType(ReifyRuntimeType node) {
1463 node.value = visitExpression(node.value); 1490 node.value = visitExpression(node.value);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 1594
1568 /// Number of uses of the current fallthrough target. 1595 /// Number of uses of the current fallthrough target.
1569 int get useCount => _stack.last.useCount; 1596 int get useCount => _stack.last.useCount;
1570 1597
1571 /// Indicate that a statement will fall through to the current fallthrough 1598 /// Indicate that a statement will fall through to the current fallthrough
1572 /// target. 1599 /// target.
1573 void use() { 1600 void use() {
1574 ++_stack.last.useCount; 1601 ++_stack.last.useCount;
1575 } 1602 }
1576 } 1603 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698