OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #ifndef RUNTIME_VM_KERNEL_H_ | 5 #ifndef RUNTIME_VM_KERNEL_H_ |
6 #define RUNTIME_VM_KERNEL_H_ | 6 #define RUNTIME_VM_KERNEL_H_ |
7 | 7 |
8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 virtual Node::NodeType Type() { return Node::kType##klass; } | 350 virtual Node::NodeType Type() { return Node::kType##klass; } |
351 | 351 |
352 #define DEFINE_IS_OPERATION(klass) \ | 352 #define DEFINE_IS_OPERATION(klass) \ |
353 virtual bool Is##klass() { return false; } | 353 virtual bool Is##klass() { return false; } |
354 | 354 |
355 #define DEFINE_ALL_IS_OPERATIONS() \ | 355 #define DEFINE_ALL_IS_OPERATIONS() \ |
356 KERNEL_NODES_DO(DEFINE_IS_OPERATION) \ | 356 KERNEL_NODES_DO(DEFINE_IS_OPERATION) \ |
357 DEFINE_IS_OPERATION(TreeNode) \ | 357 DEFINE_IS_OPERATION(TreeNode) \ |
358 KERNEL_TREE_NODES_DO(DEFINE_IS_OPERATION) | 358 KERNEL_TREE_NODES_DO(DEFINE_IS_OPERATION) |
359 | 359 |
| 360 class Class; |
| 361 class Constructor; |
| 362 class Field; |
| 363 class Library; |
| 364 class LinkedNode; |
| 365 class Member; |
| 366 class Procedure; |
| 367 |
| 368 class CanonicalName { |
| 369 public: |
| 370 ~CanonicalName(); |
| 371 |
| 372 String* name() { return name_; } |
| 373 CanonicalName* parent() { return parent_; } |
| 374 LinkedNode* definition() { return definition_; } |
| 375 bool is_referenced() { return is_referenced_; } |
| 376 void set_referenced(bool referenced) { is_referenced_ = referenced; } |
| 377 |
| 378 void BindTo(LinkedNode* definition); |
| 379 void Unbind(); |
| 380 CanonicalName* AddChild(String* name); |
| 381 |
| 382 Library* AsLibrary(); |
| 383 Class* AsClass(); |
| 384 Member* AsMember(); |
| 385 Field* AsField(); |
| 386 Constructor* AsConstructor(); |
| 387 Procedure* AsProcedure(); |
| 388 |
| 389 static CanonicalName* NewRoot(); |
| 390 |
| 391 private: |
| 392 CanonicalName(); |
| 393 |
| 394 bool is_referenced_; |
| 395 Ref<CanonicalName> parent_; |
| 396 Ref<String> name_; |
| 397 Ref<LinkedNode> definition_; |
| 398 MallocGrowableArray<CanonicalName*> children_; |
| 399 |
| 400 DISALLOW_COPY_AND_ASSIGN(CanonicalName); |
| 401 }; |
| 402 |
360 | 403 |
361 class Node { | 404 class Node { |
362 public: | 405 public: |
363 virtual ~Node(); | 406 virtual ~Node(); |
364 | 407 |
365 enum NodeType { | 408 enum NodeType { |
366 #define DO(name) kType##name, | 409 #define DO(name) kType##name, |
367 KERNEL_ALL_NODES_DO(DO) | 410 KERNEL_ALL_NODES_DO(DO) |
368 #undef DO | 411 #undef DO |
369 | 412 |
(...skipping 24 matching lines...) Expand all Loading... |
394 virtual void AcceptTreeVisitor(TreeVisitor* visitor) = 0; | 437 virtual void AcceptTreeVisitor(TreeVisitor* visitor) = 0; |
395 | 438 |
396 protected: | 439 protected: |
397 TreeNode() {} | 440 TreeNode() {} |
398 | 441 |
399 private: | 442 private: |
400 DISALLOW_COPY_AND_ASSIGN(TreeNode); | 443 DISALLOW_COPY_AND_ASSIGN(TreeNode); |
401 }; | 444 }; |
402 | 445 |
403 | 446 |
404 class Library : public TreeNode { | 447 class LinkedNode : public TreeNode { |
| 448 public: |
| 449 virtual ~LinkedNode(); |
| 450 |
| 451 CanonicalName* canonical_name() { return canonical_name_; } |
| 452 |
| 453 protected: |
| 454 LinkedNode() {} |
| 455 |
| 456 private: |
| 457 Ref<CanonicalName> canonical_name_; |
| 458 |
| 459 friend class CanonicalName; |
| 460 |
| 461 DISALLOW_COPY_AND_ASSIGN(LinkedNode); |
| 462 }; |
| 463 |
| 464 |
| 465 class Library : public LinkedNode { |
405 public: | 466 public: |
406 Library* ReadFrom(Reader* reader); | 467 Library* ReadFrom(Reader* reader); |
407 | 468 |
408 virtual ~Library(); | 469 virtual ~Library(); |
409 | 470 |
410 DEFINE_CASTING_OPERATIONS(Library); | 471 DEFINE_CASTING_OPERATIONS(Library); |
411 | 472 |
412 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 473 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
413 virtual void VisitChildren(Visitor* visitor); | 474 virtual void VisitChildren(Visitor* visitor); |
414 | 475 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 Ref<String> import_uri_; | 512 Ref<String> import_uri_; |
452 intptr_t source_uri_index_; | 513 intptr_t source_uri_index_; |
453 List<Class> classes_; | 514 List<Class> classes_; |
454 List<Field> fields_; | 515 List<Field> fields_; |
455 List<Procedure> procedures_; | 516 List<Procedure> procedures_; |
456 | 517 |
457 DISALLOW_COPY_AND_ASSIGN(Library); | 518 DISALLOW_COPY_AND_ASSIGN(Library); |
458 }; | 519 }; |
459 | 520 |
460 | 521 |
461 class Class : public TreeNode { | 522 class Class : public LinkedNode { |
462 public: | 523 public: |
463 Class* ReadFrom(Reader* reader); | 524 Class* ReadFrom(Reader* reader); |
464 | 525 |
465 virtual ~Class(); | 526 virtual ~Class(); |
466 | 527 |
467 DEFINE_CASTING_OPERATIONS(Class); | 528 DEFINE_CASTING_OPERATIONS(Class); |
468 | 529 |
469 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 530 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
470 virtual void AcceptClassVisitor(ClassVisitor* visitor) = 0; | 531 virtual void AcceptClassVisitor(ClassVisitor* visitor) = 0; |
471 virtual void AcceptReferenceVisitor(ClassReferenceVisitor* visitor) = 0; | 532 virtual void AcceptReferenceVisitor(ClassReferenceVisitor* visitor) = 0; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 List<Constructor> constructors_; | 635 List<Constructor> constructors_; |
575 | 636 |
576 // Dummy instances which are empty lists. | 637 // Dummy instances which are empty lists. |
577 List<Field> fields_; | 638 List<Field> fields_; |
578 List<Procedure> procedures_; | 639 List<Procedure> procedures_; |
579 | 640 |
580 DISALLOW_COPY_AND_ASSIGN(MixinClass); | 641 DISALLOW_COPY_AND_ASSIGN(MixinClass); |
581 }; | 642 }; |
582 | 643 |
583 | 644 |
584 class Member : public TreeNode { | 645 class Member : public LinkedNode { |
585 public: | 646 public: |
586 virtual ~Member(); | 647 virtual ~Member(); |
587 | 648 |
588 DEFINE_CASTING_OPERATIONS(Member); | 649 DEFINE_CASTING_OPERATIONS(Member); |
589 | 650 |
590 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 651 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
591 virtual void AcceptMemberVisitor(MemberVisitor* visitor) = 0; | 652 virtual void AcceptMemberVisitor(MemberVisitor* visitor) = 0; |
592 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor) = 0; | 653 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor) = 0; |
593 | 654 |
594 TreeNode* parent() { return parent_; } | 655 TreeNode* parent() { return parent_; } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 public: | 851 public: |
791 static FieldInitializer* ReadFromImpl(Reader* reader); | 852 static FieldInitializer* ReadFromImpl(Reader* reader); |
792 | 853 |
793 virtual ~FieldInitializer(); | 854 virtual ~FieldInitializer(); |
794 | 855 |
795 DEFINE_CASTING_OPERATIONS(FieldInitializer); | 856 DEFINE_CASTING_OPERATIONS(FieldInitializer); |
796 | 857 |
797 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); | 858 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); |
798 virtual void VisitChildren(Visitor* visitor); | 859 virtual void VisitChildren(Visitor* visitor); |
799 | 860 |
800 Field* field() { return field_; } | 861 Field* field() { return field_reference_->AsField(); } |
801 Expression* value() { return value_; } | 862 Expression* value() { return value_; } |
802 | 863 |
803 private: | 864 private: |
804 FieldInitializer() {} | 865 FieldInitializer() {} |
805 | 866 |
806 Ref<Field> field_; | 867 Ref<CanonicalName> field_reference_; |
807 Child<Expression> value_; | 868 Child<Expression> value_; |
808 | 869 |
809 DISALLOW_COPY_AND_ASSIGN(FieldInitializer); | 870 DISALLOW_COPY_AND_ASSIGN(FieldInitializer); |
810 }; | 871 }; |
811 | 872 |
812 | 873 |
813 class SuperInitializer : public Initializer { | 874 class SuperInitializer : public Initializer { |
814 public: | 875 public: |
815 static SuperInitializer* ReadFromImpl(Reader* reader); | 876 static SuperInitializer* ReadFromImpl(Reader* reader); |
816 | 877 |
817 virtual ~SuperInitializer(); | 878 virtual ~SuperInitializer(); |
818 | 879 |
819 DEFINE_CASTING_OPERATIONS(SuperInitializer); | 880 DEFINE_CASTING_OPERATIONS(SuperInitializer); |
820 | 881 |
821 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); | 882 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); |
822 virtual void VisitChildren(Visitor* visitor); | 883 virtual void VisitChildren(Visitor* visitor); |
823 | 884 |
824 Constructor* target() { return target_; } | 885 Constructor* target() { return target_reference_->AsConstructor(); } |
825 Arguments* arguments() { return arguments_; } | 886 Arguments* arguments() { return arguments_; } |
826 | 887 |
827 private: | 888 private: |
828 SuperInitializer() {} | 889 SuperInitializer() {} |
829 | 890 |
830 Ref<Constructor> target_; | 891 Ref<CanonicalName> target_reference_; |
831 Child<Arguments> arguments_; | 892 Child<Arguments> arguments_; |
832 | 893 |
833 DISALLOW_COPY_AND_ASSIGN(SuperInitializer); | 894 DISALLOW_COPY_AND_ASSIGN(SuperInitializer); |
834 }; | 895 }; |
835 | 896 |
836 | 897 |
837 class RedirectingInitializer : public Initializer { | 898 class RedirectingInitializer : public Initializer { |
838 public: | 899 public: |
839 static RedirectingInitializer* ReadFromImpl(Reader* reader); | 900 static RedirectingInitializer* ReadFromImpl(Reader* reader); |
840 | 901 |
841 virtual ~RedirectingInitializer(); | 902 virtual ~RedirectingInitializer(); |
842 | 903 |
843 DEFINE_CASTING_OPERATIONS(RedirectingInitializer); | 904 DEFINE_CASTING_OPERATIONS(RedirectingInitializer); |
844 | 905 |
845 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); | 906 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); |
846 virtual void VisitChildren(Visitor* visitor); | 907 virtual void VisitChildren(Visitor* visitor); |
847 | 908 |
848 Constructor* target() { return target_; } | 909 Constructor* target() { return target_reference_->AsConstructor(); } |
849 Arguments* arguments() { return arguments_; } | 910 Arguments* arguments() { return arguments_; } |
850 | 911 |
851 private: | 912 private: |
852 RedirectingInitializer() {} | 913 RedirectingInitializer() {} |
853 | 914 |
854 Ref<Constructor> target_; | 915 Ref<CanonicalName> target_reference_; |
855 Child<Arguments> arguments_; | 916 Child<Arguments> arguments_; |
856 | 917 |
857 DISALLOW_COPY_AND_ASSIGN(RedirectingInitializer); | 918 DISALLOW_COPY_AND_ASSIGN(RedirectingInitializer); |
858 }; | 919 }; |
859 | 920 |
860 | 921 |
861 class LocalInitializer : public Initializer { | 922 class LocalInitializer : public Initializer { |
862 public: | 923 public: |
863 static LocalInitializer* ReadFromImpl(Reader* reader); | 924 static LocalInitializer* ReadFromImpl(Reader* reader); |
864 | 925 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 virtual void VisitChildren(Visitor* visitor); | 1094 virtual void VisitChildren(Visitor* visitor); |
1034 | 1095 |
1035 Expression* receiver() { return receiver_; } | 1096 Expression* receiver() { return receiver_; } |
1036 Name* name() { return name_; } | 1097 Name* name() { return name_; } |
1037 | 1098 |
1038 private: | 1099 private: |
1039 PropertyGet() {} | 1100 PropertyGet() {} |
1040 | 1101 |
1041 Child<Expression> receiver_; | 1102 Child<Expression> receiver_; |
1042 Child<Name> name_; | 1103 Child<Name> name_; |
1043 Ref<Member> interfaceTarget_; | 1104 Ref<CanonicalName> interface_target_reference_; |
1044 | 1105 |
1045 DISALLOW_COPY_AND_ASSIGN(PropertyGet); | 1106 DISALLOW_COPY_AND_ASSIGN(PropertyGet); |
1046 }; | 1107 }; |
1047 | 1108 |
1048 | 1109 |
1049 class PropertySet : public Expression { | 1110 class PropertySet : public Expression { |
1050 public: | 1111 public: |
1051 static PropertySet* ReadFrom(Reader* reader); | 1112 static PropertySet* ReadFrom(Reader* reader); |
1052 | 1113 |
1053 virtual ~PropertySet(); | 1114 virtual ~PropertySet(); |
1054 | 1115 |
1055 DEFINE_CASTING_OPERATIONS(PropertySet); | 1116 DEFINE_CASTING_OPERATIONS(PropertySet); |
1056 | 1117 |
1057 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1118 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1058 virtual void VisitChildren(Visitor* visitor); | 1119 virtual void VisitChildren(Visitor* visitor); |
1059 | 1120 |
1060 Expression* receiver() { return receiver_; } | 1121 Expression* receiver() { return receiver_; } |
1061 Name* name() { return name_; } | 1122 Name* name() { return name_; } |
1062 Expression* value() { return value_; } | 1123 Expression* value() { return value_; } |
1063 | 1124 |
1064 private: | 1125 private: |
1065 PropertySet() {} | 1126 PropertySet() {} |
1066 | 1127 |
1067 Child<Expression> receiver_; | 1128 Child<Expression> receiver_; |
1068 Child<Name> name_; | 1129 Child<Name> name_; |
1069 Child<Expression> value_; | 1130 Child<Expression> value_; |
1070 Ref<Member> interfaceTarget_; | 1131 Ref<CanonicalName> interface_target_reference_; |
1071 | 1132 |
1072 DISALLOW_COPY_AND_ASSIGN(PropertySet); | 1133 DISALLOW_COPY_AND_ASSIGN(PropertySet); |
1073 }; | 1134 }; |
1074 | 1135 |
1075 | 1136 |
1076 class DirectPropertyGet : public Expression { | 1137 class DirectPropertyGet : public Expression { |
1077 public: | 1138 public: |
1078 static DirectPropertyGet* ReadFrom(Reader* reader); | 1139 static DirectPropertyGet* ReadFrom(Reader* reader); |
1079 | 1140 |
1080 virtual ~DirectPropertyGet(); | 1141 virtual ~DirectPropertyGet(); |
1081 | 1142 |
1082 DEFINE_CASTING_OPERATIONS(DirectPropertyGet); | 1143 DEFINE_CASTING_OPERATIONS(DirectPropertyGet); |
1083 | 1144 |
1084 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1145 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1085 virtual void VisitChildren(Visitor* visitor); | 1146 virtual void VisitChildren(Visitor* visitor); |
1086 | 1147 |
1087 Expression* receiver() { return receiver_; } | 1148 Expression* receiver() { return receiver_; } |
1088 Member* target() { return target_; } | 1149 Member* target() { return target_reference_->AsMember(); } |
1089 | 1150 |
1090 private: | 1151 private: |
1091 DirectPropertyGet() {} | 1152 DirectPropertyGet() {} |
1092 | 1153 |
1093 Child<Expression> receiver_; | 1154 Child<Expression> receiver_; |
1094 Ref<Member> target_; | 1155 Ref<CanonicalName> target_reference_; |
1095 | 1156 |
1096 DISALLOW_COPY_AND_ASSIGN(DirectPropertyGet); | 1157 DISALLOW_COPY_AND_ASSIGN(DirectPropertyGet); |
1097 }; | 1158 }; |
1098 | 1159 |
1099 | 1160 |
1100 class DirectPropertySet : public Expression { | 1161 class DirectPropertySet : public Expression { |
1101 public: | 1162 public: |
1102 static DirectPropertySet* ReadFrom(Reader* reader); | 1163 static DirectPropertySet* ReadFrom(Reader* reader); |
1103 | 1164 |
1104 virtual ~DirectPropertySet(); | 1165 virtual ~DirectPropertySet(); |
1105 | 1166 |
1106 DEFINE_CASTING_OPERATIONS(DirectPropertySet); | 1167 DEFINE_CASTING_OPERATIONS(DirectPropertySet); |
1107 | 1168 |
1108 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1169 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1109 virtual void VisitChildren(Visitor* visitor); | 1170 virtual void VisitChildren(Visitor* visitor); |
1110 | 1171 |
1111 Expression* receiver() { return receiver_; } | 1172 Expression* receiver() { return receiver_; } |
1112 Member* target() { return target_; } | 1173 Member* target() { return target_reference_->AsMember(); } |
1113 Expression* value() { return value_; } | 1174 Expression* value() { return value_; } |
1114 | 1175 |
1115 private: | 1176 private: |
1116 DirectPropertySet() {} | 1177 DirectPropertySet() {} |
1117 | 1178 |
1118 Child<Expression> receiver_; | 1179 Child<Expression> receiver_; |
1119 Ref<Member> target_; | 1180 Ref<CanonicalName> target_reference_; |
1120 Child<Expression> value_; | 1181 Child<Expression> value_; |
1121 | 1182 |
1122 DISALLOW_COPY_AND_ASSIGN(DirectPropertySet); | 1183 DISALLOW_COPY_AND_ASSIGN(DirectPropertySet); |
1123 }; | 1184 }; |
1124 | 1185 |
1125 | 1186 |
1126 class StaticGet : public Expression { | 1187 class StaticGet : public Expression { |
1127 public: | 1188 public: |
1128 static StaticGet* ReadFrom(Reader* reader); | 1189 static StaticGet* ReadFrom(Reader* reader); |
1129 | 1190 |
1130 virtual ~StaticGet(); | 1191 virtual ~StaticGet(); |
1131 | 1192 |
1132 DEFINE_CASTING_OPERATIONS(StaticGet); | 1193 DEFINE_CASTING_OPERATIONS(StaticGet); |
1133 | 1194 |
1134 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1195 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1135 virtual void VisitChildren(Visitor* visitor); | 1196 virtual void VisitChildren(Visitor* visitor); |
1136 | 1197 |
1137 Member* target() { return target_; } | 1198 Member* target() { return target_reference_->AsMember(); } |
1138 | 1199 |
1139 private: | 1200 private: |
1140 StaticGet() {} | 1201 StaticGet() {} |
1141 | 1202 |
1142 Ref<Member> target_; | 1203 Ref<CanonicalName> target_reference_; |
1143 | 1204 |
1144 DISALLOW_COPY_AND_ASSIGN(StaticGet); | 1205 DISALLOW_COPY_AND_ASSIGN(StaticGet); |
1145 }; | 1206 }; |
1146 | 1207 |
1147 | 1208 |
1148 class StaticSet : public Expression { | 1209 class StaticSet : public Expression { |
1149 public: | 1210 public: |
1150 static StaticSet* ReadFrom(Reader* reader); | 1211 static StaticSet* ReadFrom(Reader* reader); |
1151 | 1212 |
1152 virtual ~StaticSet(); | 1213 virtual ~StaticSet(); |
1153 | 1214 |
1154 DEFINE_CASTING_OPERATIONS(StaticSet); | 1215 DEFINE_CASTING_OPERATIONS(StaticSet); |
1155 | 1216 |
1156 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1217 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1157 virtual void VisitChildren(Visitor* visitor); | 1218 virtual void VisitChildren(Visitor* visitor); |
1158 | 1219 |
1159 Member* target() { return target_; } | 1220 Member* target() { return target_reference_->AsMember(); } |
1160 Expression* expression() { return expression_; } | 1221 Expression* expression() { return expression_; } |
1161 | 1222 |
1162 private: | 1223 private: |
1163 StaticSet() {} | 1224 StaticSet() {} |
1164 | 1225 |
1165 Ref<Member> target_; | 1226 Ref<CanonicalName> target_reference_; |
1166 Child<Expression> expression_; | 1227 Child<Expression> expression_; |
1167 | 1228 |
1168 DISALLOW_COPY_AND_ASSIGN(StaticSet); | 1229 DISALLOW_COPY_AND_ASSIGN(StaticSet); |
1169 }; | 1230 }; |
1170 | 1231 |
1171 | 1232 |
1172 class Arguments : public TreeNode { | 1233 class Arguments : public TreeNode { |
1173 public: | 1234 public: |
1174 static Arguments* ReadFrom(Reader* reader); | 1235 static Arguments* ReadFrom(Reader* reader); |
1175 | 1236 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 Expression* receiver() { return receiver_; } | 1298 Expression* receiver() { return receiver_; } |
1238 Name* name() { return name_; } | 1299 Name* name() { return name_; } |
1239 Arguments* arguments() { return arguments_; } | 1300 Arguments* arguments() { return arguments_; } |
1240 | 1301 |
1241 private: | 1302 private: |
1242 MethodInvocation() {} | 1303 MethodInvocation() {} |
1243 | 1304 |
1244 Child<Expression> receiver_; | 1305 Child<Expression> receiver_; |
1245 Child<Name> name_; | 1306 Child<Name> name_; |
1246 Child<Arguments> arguments_; | 1307 Child<Arguments> arguments_; |
1247 Ref<Member> interfaceTarget_; | 1308 Ref<CanonicalName> interface_target_reference_; |
1248 | 1309 |
1249 DISALLOW_COPY_AND_ASSIGN(MethodInvocation); | 1310 DISALLOW_COPY_AND_ASSIGN(MethodInvocation); |
1250 }; | 1311 }; |
1251 | 1312 |
1252 | 1313 |
1253 class DirectMethodInvocation : public Expression { | 1314 class DirectMethodInvocation : public Expression { |
1254 public: | 1315 public: |
1255 static DirectMethodInvocation* ReadFrom(Reader* reader); | 1316 static DirectMethodInvocation* ReadFrom(Reader* reader); |
1256 | 1317 |
1257 virtual ~DirectMethodInvocation(); | 1318 virtual ~DirectMethodInvocation(); |
1258 | 1319 |
1259 DEFINE_CASTING_OPERATIONS(DirectMethodInvocation); | 1320 DEFINE_CASTING_OPERATIONS(DirectMethodInvocation); |
1260 | 1321 |
1261 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1322 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1262 virtual void VisitChildren(Visitor* visitor); | 1323 virtual void VisitChildren(Visitor* visitor); |
1263 | 1324 |
1264 Expression* receiver() { return receiver_; } | 1325 Expression* receiver() { return receiver_; } |
1265 Procedure* target() { return target_; } | 1326 Procedure* target() { return target_reference_->AsProcedure(); } |
1266 Arguments* arguments() { return arguments_; } | 1327 Arguments* arguments() { return arguments_; } |
1267 | 1328 |
1268 private: | 1329 private: |
1269 DirectMethodInvocation() {} | 1330 DirectMethodInvocation() {} |
1270 | 1331 |
1271 Child<Expression> receiver_; | 1332 Child<Expression> receiver_; |
1272 Ref<Procedure> target_; | 1333 Ref<CanonicalName> target_reference_; |
1273 Child<Arguments> arguments_; | 1334 Child<Arguments> arguments_; |
1274 | 1335 |
1275 DISALLOW_COPY_AND_ASSIGN(DirectMethodInvocation); | 1336 DISALLOW_COPY_AND_ASSIGN(DirectMethodInvocation); |
1276 }; | 1337 }; |
1277 | 1338 |
1278 | 1339 |
1279 class StaticInvocation : public Expression { | 1340 class StaticInvocation : public Expression { |
1280 public: | 1341 public: |
1281 static StaticInvocation* ReadFrom(Reader* reader, bool is_const); | 1342 static StaticInvocation* ReadFrom(Reader* reader, bool is_const); |
1282 ~StaticInvocation(); | 1343 ~StaticInvocation(); |
1283 | 1344 |
1284 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1345 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1285 virtual void VisitChildren(Visitor* visitor); | 1346 virtual void VisitChildren(Visitor* visitor); |
1286 | 1347 |
1287 Procedure* procedure() { return procedure_; } | 1348 Procedure* procedure() { return procedure_reference_->AsProcedure(); } |
1288 Arguments* arguments() { return arguments_; } | 1349 Arguments* arguments() { return arguments_; } |
1289 bool is_const() { return is_const_; } | 1350 bool is_const() { return is_const_; } |
1290 | 1351 |
1291 private: | 1352 private: |
1292 StaticInvocation() {} | 1353 StaticInvocation() {} |
1293 | 1354 |
1294 Ref<Procedure> procedure_; | 1355 Ref<CanonicalName> procedure_reference_; |
1295 Child<Arguments> arguments_; | 1356 Child<Arguments> arguments_; |
1296 bool is_const_; | 1357 bool is_const_; |
1297 | 1358 |
1298 DISALLOW_COPY_AND_ASSIGN(StaticInvocation); | 1359 DISALLOW_COPY_AND_ASSIGN(StaticInvocation); |
1299 }; | 1360 }; |
1300 | 1361 |
1301 | 1362 |
1302 class ConstructorInvocation : public Expression { | 1363 class ConstructorInvocation : public Expression { |
1303 public: | 1364 public: |
1304 static ConstructorInvocation* ReadFrom(Reader* reader, bool is_const); | 1365 static ConstructorInvocation* ReadFrom(Reader* reader, bool is_const); |
1305 | 1366 |
1306 virtual ~ConstructorInvocation(); | 1367 virtual ~ConstructorInvocation(); |
1307 | 1368 |
1308 DEFINE_CASTING_OPERATIONS(ConstructorInvocation); | 1369 DEFINE_CASTING_OPERATIONS(ConstructorInvocation); |
1309 | 1370 |
1310 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1371 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1311 virtual void VisitChildren(Visitor* visitor); | 1372 virtual void VisitChildren(Visitor* visitor); |
1312 | 1373 |
1313 bool is_const() { return is_const_; } | 1374 bool is_const() { return is_const_; } |
1314 Constructor* target() { return target_; } | 1375 Constructor* target() { return target_reference_->AsConstructor(); } |
1315 Arguments* arguments() { return arguments_; } | 1376 Arguments* arguments() { return arguments_; } |
1316 | 1377 |
1317 private: | 1378 private: |
1318 ConstructorInvocation() {} | 1379 ConstructorInvocation() {} |
1319 | 1380 |
1320 bool is_const_; | 1381 bool is_const_; |
1321 Ref<Constructor> target_; | 1382 Ref<CanonicalName> target_reference_; |
1322 Child<Arguments> arguments_; | 1383 Child<Arguments> arguments_; |
1323 | 1384 |
1324 DISALLOW_COPY_AND_ASSIGN(ConstructorInvocation); | 1385 DISALLOW_COPY_AND_ASSIGN(ConstructorInvocation); |
1325 }; | 1386 }; |
1326 | 1387 |
1327 | 1388 |
1328 class Not : public Expression { | 1389 class Not : public Expression { |
1329 public: | 1390 public: |
1330 static Not* ReadFrom(Reader* reader); | 1391 static Not* ReadFrom(Reader* reader); |
1331 | 1392 |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 static Name* ReadFrom(Reader* reader); | 2518 static Name* ReadFrom(Reader* reader); |
2458 | 2519 |
2459 virtual ~Name(); | 2520 virtual ~Name(); |
2460 | 2521 |
2461 DEFINE_CASTING_OPERATIONS(Name); | 2522 DEFINE_CASTING_OPERATIONS(Name); |
2462 | 2523 |
2463 virtual void AcceptVisitor(Visitor* visitor); | 2524 virtual void AcceptVisitor(Visitor* visitor); |
2464 virtual void VisitChildren(Visitor* visitor); | 2525 virtual void VisitChildren(Visitor* visitor); |
2465 | 2526 |
2466 String* string() { return string_; } | 2527 String* string() { return string_; } |
2467 Library* library() { return library_; } | 2528 Library* library() { |
| 2529 if (library_reference_ == NULL) return NULL; |
| 2530 return library_reference_->AsLibrary(); |
| 2531 } |
2468 | 2532 |
2469 private: | 2533 private: |
2470 Name(String* string, Library* library) | 2534 Name(String* string, CanonicalName* library_reference) |
2471 : string_(string), library_(library) {} // NOLINT | 2535 : string_(string), library_reference_(library_reference) {} // NOLINT |
2472 | 2536 |
2473 Ref<String> string_; | 2537 Ref<String> string_; |
2474 Ref<Library> library_; | 2538 Ref<CanonicalName> library_reference_; |
2475 | 2539 |
2476 DISALLOW_COPY_AND_ASSIGN(Name); | 2540 DISALLOW_COPY_AND_ASSIGN(Name); |
2477 }; | 2541 }; |
2478 | 2542 |
2479 | 2543 |
2480 class InferredValue : public Node { | 2544 class InferredValue : public Node { |
2481 public: | 2545 public: |
2482 static const uint8_t kNull = 1 << 0; | 2546 static const uint8_t kNull = 1 << 0; |
2483 static const uint8_t kInteger = 1 << 1; | 2547 static const uint8_t kInteger = 1 << 1; |
2484 static const uint8_t kDouble = 1 << 2; | 2548 static const uint8_t kDouble = 1 << 2; |
(...skipping 23 matching lines...) Expand all Loading... |
2508 bool CanBeNull() { return (value_bits_ & kNull) != 0; } | 2572 bool CanBeNull() { return (value_bits_ & kNull) != 0; } |
2509 bool CanBeInteger() { return (value_bits_ & kInteger) != 0; } | 2573 bool CanBeInteger() { return (value_bits_ & kInteger) != 0; } |
2510 bool CanBeDouble() { return (value_bits_ & kDouble) != 0; } | 2574 bool CanBeDouble() { return (value_bits_ & kDouble) != 0; } |
2511 bool CanBeString() { return (value_bits_ & kString) != 0; } | 2575 bool CanBeString() { return (value_bits_ & kString) != 0; } |
2512 | 2576 |
2513 bool IsAlwaysNull() { return value_bits_ == kNull; } | 2577 bool IsAlwaysNull() { return value_bits_ == kNull; } |
2514 bool IsAlwaysInteger() { return value_bits_ == kInteger; } | 2578 bool IsAlwaysInteger() { return value_bits_ == kInteger; } |
2515 bool IsAlwaysDouble() { return value_bits_ == kDouble; } | 2579 bool IsAlwaysDouble() { return value_bits_ == kDouble; } |
2516 bool IsAlwaysString() { return value_bits_ == kString; } | 2580 bool IsAlwaysString() { return value_bits_ == kString; } |
2517 | 2581 |
2518 Class* klass() { return klass_; } | 2582 Class* klass() { return klass_reference_->AsClass(); } |
2519 BaseClassKind kind() { return kind_; } | 2583 BaseClassKind kind() { return kind_; } |
2520 uint8_t value_bits() { return value_bits_; } | 2584 uint8_t value_bits() { return value_bits_; } |
2521 | 2585 |
2522 private: | 2586 private: |
2523 InferredValue() {} | 2587 InferredValue() {} |
2524 | 2588 |
2525 Ref<Class> klass_; | 2589 Ref<CanonicalName> klass_reference_; |
2526 BaseClassKind kind_; | 2590 BaseClassKind kind_; |
2527 uint8_t value_bits_; | 2591 uint8_t value_bits_; |
2528 | 2592 |
2529 DISALLOW_COPY_AND_ASSIGN(InferredValue); | 2593 DISALLOW_COPY_AND_ASSIGN(InferredValue); |
2530 }; | 2594 }; |
2531 | 2595 |
2532 | 2596 |
2533 class DartType : public Node { | 2597 class DartType : public Node { |
2534 public: | 2598 public: |
2535 static DartType* ReadFrom(Reader* reader); | 2599 static DartType* ReadFrom(Reader* reader); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2601 | 2665 |
2602 DISALLOW_COPY_AND_ASSIGN(VoidType); | 2666 DISALLOW_COPY_AND_ASSIGN(VoidType); |
2603 }; | 2667 }; |
2604 | 2668 |
2605 | 2669 |
2606 class InterfaceType : public DartType { | 2670 class InterfaceType : public DartType { |
2607 public: | 2671 public: |
2608 static InterfaceType* ReadFrom(Reader* reader); | 2672 static InterfaceType* ReadFrom(Reader* reader); |
2609 static InterfaceType* ReadFrom(Reader* reader, bool _without_type_arguments_); | 2673 static InterfaceType* ReadFrom(Reader* reader, bool _without_type_arguments_); |
2610 | 2674 |
2611 explicit InterfaceType(Class* klass) : klass_(klass) {} | 2675 explicit InterfaceType(CanonicalName* klass_reference) |
| 2676 : klass_reference_(klass_reference) {} |
2612 virtual ~InterfaceType(); | 2677 virtual ~InterfaceType(); |
2613 | 2678 |
2614 DEFINE_CASTING_OPERATIONS(InterfaceType); | 2679 DEFINE_CASTING_OPERATIONS(InterfaceType); |
2615 | 2680 |
2616 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2681 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2617 virtual void VisitChildren(Visitor* visitor); | 2682 virtual void VisitChildren(Visitor* visitor); |
2618 | 2683 |
2619 Class* klass() { return klass_; } | 2684 Class* klass() { return klass_reference_->AsClass(); } |
2620 List<DartType>& type_arguments() { return type_arguments_; } | 2685 List<DartType>& type_arguments() { return type_arguments_; } |
2621 | 2686 |
2622 private: | 2687 private: |
2623 InterfaceType() {} | 2688 InterfaceType() {} |
2624 | 2689 |
2625 Ref<Class> klass_; | 2690 Ref<CanonicalName> klass_reference_; |
2626 List<DartType> type_arguments_; | 2691 List<DartType> type_arguments_; |
2627 | 2692 |
2628 DISALLOW_COPY_AND_ASSIGN(InterfaceType); | 2693 DISALLOW_COPY_AND_ASSIGN(InterfaceType); |
2629 }; | 2694 }; |
2630 | 2695 |
2631 | 2696 |
2632 class FunctionType : public DartType { | 2697 class FunctionType : public DartType { |
2633 public: | 2698 public: |
2634 static FunctionType* ReadFrom(Reader* reader); | 2699 static FunctionType* ReadFrom(Reader* reader); |
2635 static FunctionType* ReadFrom(Reader* reader, bool _without_type_arguments_); | 2700 static FunctionType* ReadFrom(Reader* reader, bool _without_type_arguments_); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2720 | 2785 |
2721 DEFINE_CASTING_OPERATIONS(Program); | 2786 DEFINE_CASTING_OPERATIONS(Program); |
2722 | 2787 |
2723 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 2788 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
2724 virtual void VisitChildren(Visitor* visitor); | 2789 virtual void VisitChildren(Visitor* visitor); |
2725 | 2790 |
2726 StringTable& string_table() { return string_table_; } | 2791 StringTable& string_table() { return string_table_; } |
2727 StringTable& source_uri_table() { return source_uri_table_; } | 2792 StringTable& source_uri_table() { return source_uri_table_; } |
2728 SourceTable& source_table() { return source_table_; } | 2793 SourceTable& source_table() { return source_table_; } |
2729 List<Library>& libraries() { return libraries_; } | 2794 List<Library>& libraries() { return libraries_; } |
2730 Procedure* main_method() { return main_method_; } | 2795 Procedure* main_method() { |
| 2796 if (main_method_reference_ == NULL) return NULL; |
| 2797 return main_method_reference_->AsProcedure(); |
| 2798 } |
| 2799 CanonicalName* canonical_name_root() { return canonical_name_root_; } |
2731 MallocGrowableArray<MallocGrowableArray<intptr_t>*> valid_token_positions; | 2800 MallocGrowableArray<MallocGrowableArray<intptr_t>*> valid_token_positions; |
2732 MallocGrowableArray<MallocGrowableArray<intptr_t>*> yield_token_positions; | 2801 MallocGrowableArray<MallocGrowableArray<intptr_t>*> yield_token_positions; |
2733 | 2802 |
2734 private: | 2803 private: |
2735 Program() {} | 2804 Program() {} |
2736 | 2805 |
| 2806 Child<CanonicalName> canonical_name_root_; |
2737 List<Library> libraries_; | 2807 List<Library> libraries_; |
2738 Ref<Procedure> main_method_; | 2808 Ref<CanonicalName> main_method_reference_; |
2739 StringTable string_table_; | 2809 StringTable string_table_; |
2740 StringTable source_uri_table_; | 2810 StringTable source_uri_table_; |
2741 SourceTable source_table_; | 2811 SourceTable source_table_; |
2742 | 2812 |
2743 DISALLOW_COPY_AND_ASSIGN(Program); | 2813 DISALLOW_COPY_AND_ASSIGN(Program); |
2744 }; | 2814 }; |
2745 | 2815 |
2746 | 2816 |
2747 class Reference : public AllStatic { | 2817 class Reference : public AllStatic { |
2748 public: | 2818 public: |
2749 static Member* ReadMemberFrom(Reader* reader, bool allow_null = false); | 2819 static CanonicalName* ReadMemberFrom(Reader* reader, bool allow_null = false); |
2750 | 2820 |
2751 static Class* ReadClassFrom(Reader* reader, bool allow_null = false); | 2821 static CanonicalName* ReadClassFrom(Reader* reader, bool allow_null = false); |
2752 | 2822 |
2753 static String* ReadStringFrom(Reader* reader); | 2823 static String* ReadStringFrom(Reader* reader); |
2754 }; | 2824 }; |
2755 | 2825 |
2756 | 2826 |
2757 class ExpressionVisitor { | 2827 class ExpressionVisitor { |
2758 public: | 2828 public: |
2759 virtual ~ExpressionVisitor() {} | 2829 virtual ~ExpressionVisitor() {} |
2760 | 2830 |
2761 virtual void VisitDefaultExpression(Expression* node) = 0; | 2831 virtual void VisitDefaultExpression(Expression* node) = 0; |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3167 | 3237 |
3168 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, | 3238 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, |
3169 intptr_t buffer_length); | 3239 intptr_t buffer_length); |
3170 | 3240 |
3171 | 3241 |
3172 | 3242 |
3173 } // namespace dart | 3243 } // namespace dart |
3174 | 3244 |
3175 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 3245 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
3176 #endif // RUNTIME_VM_KERNEL_H_ | 3246 #endif // RUNTIME_VM_KERNEL_H_ |
OLD | NEW |