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 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
11 | 11 |
12 #define KERNEL_NODES_DO(M) \ | 12 #define KERNEL_NODES_DO(M) \ |
13 M(Name) \ | 13 M(Name) \ |
14 M(InferredValue) \ | 14 M(InferredValue) \ |
15 M(DartType) \ | 15 M(DartType) \ |
16 M(InvalidType) \ | 16 M(InvalidType) \ |
17 M(DynamicType) \ | 17 M(DynamicType) \ |
18 M(VoidType) \ | 18 M(VoidType) \ |
19 M(InterfaceType) \ | 19 M(InterfaceType) \ |
20 M(FunctionType) \ | 20 M(FunctionType) \ |
21 M(TypeParameterType) | 21 M(TypeParameterType) |
22 | 22 |
23 #define KERNEL_TREE_NODES_DO(M) \ | 23 #define KERNEL_TREE_NODES_DO(M) \ |
24 M(Library) \ | 24 M(Library) \ |
25 M(Class) \ | 25 M(Class) \ |
26 M(NormalClass) \ | 26 M(NormalClass) \ |
27 M(MixinClass) \ | 27 M(MixinClass) \ |
28 M(Member) \ | 28 M(Member) \ |
29 M(Field) \ | 29 M(Field) \ |
30 M(Constructor) \ | 30 M(Constructor) \ |
31 M(Procedure) \ | 31 M(Procedure) \ |
32 M(Initializer) \ | 32 M(Initializer) \ |
33 M(InvalidInitializer) \ | 33 M(InvalidInitializer) \ |
34 M(FieldInitializer) \ | 34 M(FieldInitializer) \ |
35 M(SuperInitializer) \ | 35 M(SuperInitializer) \ |
36 M(RedirectingInitializer) \ | 36 M(RedirectingInitializer) \ |
37 M(LocalInitializer) \ | 37 M(LocalInitializer) \ |
38 M(FunctionNode) \ | 38 M(FunctionNode) \ |
39 M(Expression) \ | 39 M(Expression) \ |
40 M(InvalidExpression) \ | 40 M(InvalidExpression) \ |
41 M(VariableGet) \ | 41 M(VariableGet) \ |
42 M(VariableSet) \ | 42 M(VariableSet) \ |
43 M(PropertyGet) \ | 43 M(PropertyGet) \ |
44 M(PropertySet) \ | 44 M(PropertySet) \ |
45 M(DirectPropertyGet) \ | 45 M(DirectPropertyGet) \ |
46 M(DirectPropertySet) \ | 46 M(DirectPropertySet) \ |
47 M(StaticGet) \ | 47 M(StaticGet) \ |
48 M(StaticSet) \ | 48 M(StaticSet) \ |
49 M(Arguments) \ | 49 M(Arguments) \ |
50 M(NamedExpression) \ | 50 M(NamedExpression) \ |
51 M(MethodInvocation) \ | 51 M(MethodInvocation) \ |
52 M(DirectMethodInvocation) \ | 52 M(DirectMethodInvocation) \ |
53 M(StaticInvocation) \ | 53 M(StaticInvocation) \ |
54 M(ConstructorInvocation) \ | 54 M(ConstructorInvocation) \ |
55 M(Not) \ | 55 M(Not) \ |
56 M(LogicalExpression) \ | 56 M(LogicalExpression) \ |
57 M(ConditionalExpression) \ | 57 M(ConditionalExpression) \ |
58 M(StringConcatenation) \ | 58 M(StringConcatenation) \ |
59 M(IsExpression) \ | 59 M(IsExpression) \ |
60 M(AsExpression) \ | 60 M(AsExpression) \ |
61 M(BasicLiteral) \ | 61 M(BasicLiteral) \ |
62 M(StringLiteral) \ | 62 M(StringLiteral) \ |
63 M(BigintLiteral) \ | 63 M(BigintLiteral) \ |
64 M(IntLiteral) \ | 64 M(IntLiteral) \ |
65 M(DoubleLiteral) \ | 65 M(DoubleLiteral) \ |
66 M(BoolLiteral) \ | 66 M(BoolLiteral) \ |
67 M(NullLiteral) \ | 67 M(NullLiteral) \ |
68 M(SymbolLiteral) \ | 68 M(SymbolLiteral) \ |
69 M(TypeLiteral) \ | 69 M(TypeLiteral) \ |
70 M(ThisExpression) \ | 70 M(ThisExpression) \ |
71 M(Rethrow) \ | 71 M(Rethrow) \ |
72 M(Throw) \ | 72 M(Throw) \ |
73 M(ListLiteral) \ | 73 M(ListLiteral) \ |
74 M(MapLiteral) \ | 74 M(MapLiteral) \ |
75 M(MapEntry) \ | 75 M(MapEntry) \ |
76 M(AwaitExpression) \ | 76 M(AwaitExpression) \ |
77 M(FunctionExpression) \ | 77 M(FunctionExpression) \ |
78 M(Let) \ | 78 M(Let) \ |
79 M(BlockExpression) \ | 79 M(BlockExpression) \ |
80 M(Statement) \ | 80 M(Statement) \ |
81 M(InvalidStatement) \ | 81 M(InvalidStatement) \ |
82 M(ExpressionStatement) \ | 82 M(ExpressionStatement) \ |
83 M(Block) \ | 83 M(Block) \ |
84 M(EmptyStatement) \ | 84 M(EmptyStatement) \ |
85 M(AssertStatement) \ | 85 M(AssertStatement) \ |
86 M(LabeledStatement) \ | 86 M(LabeledStatement) \ |
87 M(BreakStatement) \ | 87 M(BreakStatement) \ |
88 M(WhileStatement) \ | 88 M(WhileStatement) \ |
89 M(DoStatement) \ | 89 M(DoStatement) \ |
90 M(ForStatement) \ | 90 M(ForStatement) \ |
91 M(ForInStatement) \ | 91 M(ForInStatement) \ |
92 M(SwitchStatement) \ | 92 M(SwitchStatement) \ |
93 M(SwitchCase) \ | 93 M(SwitchCase) \ |
94 M(ContinueSwitchStatement) \ | 94 M(ContinueSwitchStatement) \ |
95 M(IfStatement) \ | 95 M(IfStatement) \ |
96 M(ReturnStatement) \ | 96 M(ReturnStatement) \ |
97 M(TryCatch) \ | 97 M(TryCatch) \ |
98 M(Catch) \ | 98 M(Catch) \ |
99 M(TryFinally) \ | 99 M(TryFinally) \ |
100 M(YieldStatement) \ | 100 M(YieldStatement) \ |
101 M(VariableDeclaration) \ | 101 M(VariableDeclaration) \ |
102 M(FunctionDeclaration) \ | 102 M(FunctionDeclaration) \ |
103 M(TypeParameter) \ | 103 M(TypeParameter) \ |
104 M(Program) | 104 M(Program) |
105 | 105 |
106 #define KERNEL_ALL_NODES_DO(M) \ | 106 #define KERNEL_ALL_NODES_DO(M) \ |
107 M(Node) \ | 107 M(Node) \ |
108 KERNEL_NODES_DO(M) \ | 108 KERNEL_NODES_DO(M) \ |
109 M(TreeNode) \ | 109 M(TreeNode) \ |
110 KERNEL_TREE_NODES_DO(M) | 110 KERNEL_TREE_NODES_DO(M) |
111 | 111 |
112 #define KERNEL_VISITORS_DO(M) \ | 112 #define KERNEL_VISITORS_DO(M) \ |
113 M(ExpressionVisitor) \ | 113 M(ExpressionVisitor) \ |
114 M(StatementVisitor) \ | 114 M(StatementVisitor) \ |
115 M(MemberVisitor) \ | 115 M(MemberVisitor) \ |
116 M(ClassVisitor) \ | 116 M(ClassVisitor) \ |
117 M(InitializerVisitor) \ | 117 M(InitializerVisitor) \ |
118 M(DartTypeVisitor) \ | 118 M(DartTypeVisitor) \ |
119 M(ClassReferenceVisitor) \ | 119 M(ClassReferenceVisitor) \ |
120 M(MemberReferenceVisitor) \ | 120 M(MemberReferenceVisitor) \ |
121 M(TreeVisitor) \ | 121 M(TreeVisitor) \ |
122 M(Visitor) | 122 M(Visitor) |
123 | 123 |
124 namespace dart { | 124 namespace dart { |
125 | 125 |
126 namespace kernel { | 126 namespace kernel { |
127 | 127 |
128 | 128 |
129 class Reader; | 129 class Reader; |
130 class TreeNode; | 130 class TreeNode; |
131 class TypeParameter; | 131 class TypeParameter; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 DISALLOW_COPY_AND_ASSIGN(LineStartingTable); | 329 DISALLOW_COPY_AND_ASSIGN(LineStartingTable); |
330 }; | 330 }; |
331 | 331 |
332 // Forward declare all classes. | 332 // Forward declare all classes. |
333 #define DO(name) class name; | 333 #define DO(name) class name; |
334 KERNEL_ALL_NODES_DO(DO) | 334 KERNEL_ALL_NODES_DO(DO) |
335 KERNEL_VISITORS_DO(DO) | 335 KERNEL_VISITORS_DO(DO) |
336 #undef DO | 336 #undef DO |
337 | 337 |
338 | 338 |
339 #define DEFINE_CASTING_OPERATIONS(klass) \ | 339 #define DEFINE_CASTING_OPERATIONS(klass) \ |
340 virtual bool Is##klass() { return true; } \ | 340 virtual bool Is##klass() { return true; } \ |
341 \ | 341 \ |
342 static klass* Cast(Node* node) { \ | 342 static klass* Cast(Node* node) { \ |
343 ASSERT(node == NULL || node->Is##klass()); \ | 343 ASSERT(node == NULL || node->Is##klass()); \ |
344 return static_cast<klass*>(node); \ | 344 return static_cast<klass*>(node); \ |
345 } \ | 345 } \ |
346 \ | 346 \ |
347 virtual Node::NodeType Type() { return Node::kType##klass; } | 347 virtual Node::NodeType Type() { return Node::kType##klass; } |
348 | 348 |
349 #define DEFINE_IS_OPERATION(klass) \ | 349 #define DEFINE_IS_OPERATION(klass) \ |
350 virtual bool Is##klass() { return false; } | 350 virtual bool Is##klass() { return false; } |
351 | 351 |
352 #define DEFINE_ALL_IS_OPERATIONS() \ | 352 #define DEFINE_ALL_IS_OPERATIONS() \ |
353 KERNEL_NODES_DO(DEFINE_IS_OPERATION) \ | 353 KERNEL_NODES_DO(DEFINE_IS_OPERATION) \ |
354 DEFINE_IS_OPERATION(TreeNode) \ | 354 DEFINE_IS_OPERATION(TreeNode) \ |
355 KERNEL_TREE_NODES_DO(DEFINE_IS_OPERATION) | 355 KERNEL_TREE_NODES_DO(DEFINE_IS_OPERATION) |
356 | 356 |
357 | 357 |
358 class Node { | 358 class Node { |
359 public: | 359 public: |
360 virtual ~Node(); | 360 virtual ~Node(); |
361 | 361 |
362 enum NodeType { | 362 enum NodeType { |
363 #define DO(name) kType##name, | 363 #define DO(name) kType##name, |
364 KERNEL_ALL_NODES_DO(DO) | 364 KERNEL_ALL_NODES_DO(DO) |
365 #undef DO | 365 #undef DO |
366 | 366 |
367 kNumTypes | 367 kNumTypes |
368 }; | 368 }; |
369 | 369 |
370 DEFINE_ALL_IS_OPERATIONS(); | 370 DEFINE_ALL_IS_OPERATIONS(); |
371 DEFINE_CASTING_OPERATIONS(Node); | 371 DEFINE_CASTING_OPERATIONS(Node); |
372 | 372 |
373 virtual void AcceptVisitor(Visitor* visitor) = 0; | 373 virtual void AcceptVisitor(Visitor* visitor) = 0; |
374 virtual void VisitChildren(Visitor* visitor) = 0; | 374 virtual void VisitChildren(Visitor* visitor) = 0; |
375 | 375 |
376 protected: | 376 protected: |
377 Node() { } | 377 Node() {} |
378 | 378 |
379 private: | 379 private: |
380 DISALLOW_COPY_AND_ASSIGN(Node); | 380 DISALLOW_COPY_AND_ASSIGN(Node); |
381 }; | 381 }; |
382 | 382 |
383 | 383 |
384 class TreeNode : public Node { | 384 class TreeNode : public Node { |
385 public: | 385 public: |
386 virtual ~TreeNode(); | 386 virtual ~TreeNode(); |
387 | 387 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 585 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
586 virtual void AcceptMemberVisitor(MemberVisitor* visitor) = 0; | 586 virtual void AcceptMemberVisitor(MemberVisitor* visitor) = 0; |
587 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor) = 0; | 587 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor) = 0; |
588 | 588 |
589 TreeNode* parent() { return parent_; } | 589 TreeNode* parent() { return parent_; } |
590 Name* name() { return name_; } | 590 Name* name() { return name_; } |
591 List<Expression>& annotations() { return annotations_; } | 591 List<Expression>& annotations() { return annotations_; } |
592 | 592 |
593 protected: | 593 protected: |
594 Member() { } | 594 Member() {} |
595 | 595 |
596 template <typename T> | 596 template <typename T> |
597 friend class List; | 597 friend class List; |
598 | 598 |
599 Ref<TreeNode> parent_; | 599 Ref<TreeNode> parent_; |
600 Child<Name> name_; | 600 Child<Name> name_; |
601 List<Expression> annotations_; | 601 List<Expression> annotations_; |
602 | 602 |
603 private: | 603 private: |
604 DISALLOW_COPY_AND_ASSIGN(Member); | 604 DISALLOW_COPY_AND_ASSIGN(Member); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 virtual void WriteTo(Writer* writer) = 0; | 744 virtual void WriteTo(Writer* writer) = 0; |
745 | 745 |
746 virtual ~Initializer(); | 746 virtual ~Initializer(); |
747 | 747 |
748 DEFINE_CASTING_OPERATIONS(Initializer); | 748 DEFINE_CASTING_OPERATIONS(Initializer); |
749 | 749 |
750 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 750 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
751 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor) = 0; | 751 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor) = 0; |
752 | 752 |
753 protected: | 753 protected: |
754 Initializer() { } | 754 Initializer() {} |
755 | 755 |
756 private: | 756 private: |
757 DISALLOW_COPY_AND_ASSIGN(Initializer); | 757 DISALLOW_COPY_AND_ASSIGN(Initializer); |
758 }; | 758 }; |
759 | 759 |
760 | 760 |
761 class InvalidInitializer : public Initializer { | 761 class InvalidInitializer : public Initializer { |
762 public: | 762 public: |
763 static InvalidInitializer* ReadFromImpl(Reader* reader); | 763 static InvalidInitializer* ReadFromImpl(Reader* reader); |
764 virtual void WriteTo(Writer* writer); | 764 virtual void WriteTo(Writer* writer); |
765 | 765 |
766 virtual ~InvalidInitializer(); | 766 virtual ~InvalidInitializer(); |
767 | 767 |
768 DEFINE_CASTING_OPERATIONS(InvalidInitializer); | 768 DEFINE_CASTING_OPERATIONS(InvalidInitializer); |
769 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); | 769 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); |
770 virtual void VisitChildren(Visitor* visitor); | 770 virtual void VisitChildren(Visitor* visitor); |
771 | 771 |
772 private: | 772 private: |
773 InvalidInitializer() { } | 773 InvalidInitializer() {} |
774 | 774 |
775 DISALLOW_COPY_AND_ASSIGN(InvalidInitializer); | 775 DISALLOW_COPY_AND_ASSIGN(InvalidInitializer); |
776 }; | 776 }; |
777 | 777 |
778 | 778 |
779 class FieldInitializer : public Initializer { | 779 class FieldInitializer : public Initializer { |
780 public: | 780 public: |
781 static FieldInitializer* ReadFromImpl(Reader* reader); | 781 static FieldInitializer* ReadFromImpl(Reader* reader); |
782 virtual void WriteTo(Writer* writer); | 782 virtual void WriteTo(Writer* writer); |
783 | 783 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 virtual void WriteTo(Writer* writer) = 0; | 927 virtual void WriteTo(Writer* writer) = 0; |
928 | 928 |
929 virtual ~Expression(); | 929 virtual ~Expression(); |
930 | 930 |
931 DEFINE_CASTING_OPERATIONS(Expression); | 931 DEFINE_CASTING_OPERATIONS(Expression); |
932 | 932 |
933 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 933 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
934 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor) = 0; | 934 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor) = 0; |
935 | 935 |
936 protected: | 936 protected: |
937 Expression() { } | 937 Expression() {} |
938 | 938 |
939 private: | 939 private: |
940 DISALLOW_COPY_AND_ASSIGN(Expression); | 940 DISALLOW_COPY_AND_ASSIGN(Expression); |
941 }; | 941 }; |
942 | 942 |
943 | 943 |
944 class InvalidExpression : public Expression { | 944 class InvalidExpression : public Expression { |
945 public: | 945 public: |
946 static InvalidExpression* ReadFrom(Reader* reader); | 946 static InvalidExpression* ReadFrom(Reader* reader); |
947 virtual void WriteTo(Writer* writer); | 947 virtual void WriteTo(Writer* writer); |
948 | 948 |
949 virtual ~InvalidExpression(); | 949 virtual ~InvalidExpression(); |
950 virtual void VisitChildren(Visitor* visitor); | 950 virtual void VisitChildren(Visitor* visitor); |
951 | 951 |
952 DEFINE_CASTING_OPERATIONS(InvalidExpression); | 952 DEFINE_CASTING_OPERATIONS(InvalidExpression); |
953 | 953 |
954 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 954 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
955 | 955 |
956 private: | 956 private: |
957 InvalidExpression() { } | 957 InvalidExpression() {} |
958 | 958 |
959 DISALLOW_COPY_AND_ASSIGN(InvalidExpression); | 959 DISALLOW_COPY_AND_ASSIGN(InvalidExpression); |
960 }; | 960 }; |
961 | 961 |
962 | 962 |
963 class VariableGet : public Expression { | 963 class VariableGet : public Expression { |
964 public: | 964 public: |
965 static VariableGet* ReadFrom(Reader* reader); | 965 static VariableGet* ReadFrom(Reader* reader); |
966 static VariableGet* ReadFrom(Reader* reader, uint8_t payload); | 966 static VariableGet* ReadFrom(Reader* reader, uint8_t payload); |
967 virtual void WriteTo(Writer* writer); | 967 virtual void WriteTo(Writer* writer); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 | 1273 |
1274 DISALLOW_COPY_AND_ASSIGN(DirectMethodInvocation); | 1274 DISALLOW_COPY_AND_ASSIGN(DirectMethodInvocation); |
1275 }; | 1275 }; |
1276 | 1276 |
1277 | 1277 |
1278 class StaticInvocation : public Expression { | 1278 class StaticInvocation : public Expression { |
1279 public: | 1279 public: |
1280 static StaticInvocation* ReadFrom(Reader* reader, bool is_const); | 1280 static StaticInvocation* ReadFrom(Reader* reader, bool is_const); |
1281 virtual void WriteTo(Writer* writer); | 1281 virtual void WriteTo(Writer* writer); |
1282 | 1282 |
1283 explicit StaticInvocation(Procedure* procedure, Arguments* args, | 1283 explicit StaticInvocation(Procedure* procedure, |
| 1284 Arguments* args, |
1284 bool is_const) | 1285 bool is_const) |
1285 : procedure_(procedure), arguments_(args), is_const_(is_const) {} | 1286 : procedure_(procedure), arguments_(args), is_const_(is_const) {} |
1286 ~StaticInvocation(); | 1287 ~StaticInvocation(); |
1287 | 1288 |
1288 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1289 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1289 virtual void VisitChildren(Visitor* visitor); | 1290 virtual void VisitChildren(Visitor* visitor); |
1290 | 1291 |
1291 Procedure* procedure() { return procedure_; } | 1292 Procedure* procedure() { return procedure_; } |
1292 Arguments* arguments() { return arguments_; } | 1293 Arguments* arguments() { return arguments_; } |
1293 bool is_const() { return is_const_; } | 1294 bool is_const() { return is_const_; } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 static NullLiteral* ReadFrom(Reader* reader); | 1608 static NullLiteral* ReadFrom(Reader* reader); |
1608 virtual void WriteTo(Writer* writer); | 1609 virtual void WriteTo(Writer* writer); |
1609 | 1610 |
1610 virtual ~NullLiteral(); | 1611 virtual ~NullLiteral(); |
1611 | 1612 |
1612 DEFINE_CASTING_OPERATIONS(NullLiteral); | 1613 DEFINE_CASTING_OPERATIONS(NullLiteral); |
1613 | 1614 |
1614 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1615 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1615 | 1616 |
1616 private: | 1617 private: |
1617 NullLiteral() { } | 1618 NullLiteral() {} |
1618 | 1619 |
1619 DISALLOW_COPY_AND_ASSIGN(NullLiteral); | 1620 DISALLOW_COPY_AND_ASSIGN(NullLiteral); |
1620 }; | 1621 }; |
1621 | 1622 |
1622 | 1623 |
1623 class SymbolLiteral : public Expression { | 1624 class SymbolLiteral : public Expression { |
1624 public: | 1625 public: |
1625 static SymbolLiteral* ReadFrom(Reader* reader); | 1626 static SymbolLiteral* ReadFrom(Reader* reader); |
1626 virtual void WriteTo(Writer* writer); | 1627 virtual void WriteTo(Writer* writer); |
1627 | 1628 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 virtual void WriteTo(Writer* writer); | 1673 virtual void WriteTo(Writer* writer); |
1673 | 1674 |
1674 virtual ~ThisExpression(); | 1675 virtual ~ThisExpression(); |
1675 | 1676 |
1676 DEFINE_CASTING_OPERATIONS(ThisExpression); | 1677 DEFINE_CASTING_OPERATIONS(ThisExpression); |
1677 | 1678 |
1678 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1679 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1679 virtual void VisitChildren(Visitor* visitor); | 1680 virtual void VisitChildren(Visitor* visitor); |
1680 | 1681 |
1681 private: | 1682 private: |
1682 ThisExpression() { } | 1683 ThisExpression() {} |
1683 | 1684 |
1684 DISALLOW_COPY_AND_ASSIGN(ThisExpression); | 1685 DISALLOW_COPY_AND_ASSIGN(ThisExpression); |
1685 }; | 1686 }; |
1686 | 1687 |
1687 | 1688 |
1688 class Rethrow : public Expression { | 1689 class Rethrow : public Expression { |
1689 public: | 1690 public: |
1690 static Rethrow* ReadFrom(Reader* reader); | 1691 static Rethrow* ReadFrom(Reader* reader); |
1691 virtual void WriteTo(Writer* writer); | 1692 virtual void WriteTo(Writer* writer); |
1692 | 1693 |
1693 virtual ~Rethrow(); | 1694 virtual ~Rethrow(); |
1694 | 1695 |
1695 DEFINE_CASTING_OPERATIONS(Rethrow); | 1696 DEFINE_CASTING_OPERATIONS(Rethrow); |
1696 | 1697 |
1697 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1698 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1698 virtual void VisitChildren(Visitor* visitor); | 1699 virtual void VisitChildren(Visitor* visitor); |
1699 | 1700 |
1700 private: | 1701 private: |
1701 Rethrow() { } | 1702 Rethrow() {} |
1702 | 1703 |
1703 DISALLOW_COPY_AND_ASSIGN(Rethrow); | 1704 DISALLOW_COPY_AND_ASSIGN(Rethrow); |
1704 }; | 1705 }; |
1705 | 1706 |
1706 | 1707 |
1707 class Throw : public Expression { | 1708 class Throw : public Expression { |
1708 public: | 1709 public: |
1709 static Throw* ReadFrom(Reader* reader); | 1710 static Throw* ReadFrom(Reader* reader); |
1710 virtual void WriteTo(Writer* writer); | 1711 virtual void WriteTo(Writer* writer); |
1711 | 1712 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1913 virtual void WriteTo(Writer* writer) = 0; | 1914 virtual void WriteTo(Writer* writer) = 0; |
1914 | 1915 |
1915 virtual ~Statement(); | 1916 virtual ~Statement(); |
1916 | 1917 |
1917 DEFINE_CASTING_OPERATIONS(Statement); | 1918 DEFINE_CASTING_OPERATIONS(Statement); |
1918 | 1919 |
1919 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 1920 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
1920 virtual void AcceptStatementVisitor(StatementVisitor* visitor) = 0; | 1921 virtual void AcceptStatementVisitor(StatementVisitor* visitor) = 0; |
1921 | 1922 |
1922 protected: | 1923 protected: |
1923 Statement() { } | 1924 Statement() {} |
1924 | 1925 |
1925 private: | 1926 private: |
1926 DISALLOW_COPY_AND_ASSIGN(Statement); | 1927 DISALLOW_COPY_AND_ASSIGN(Statement); |
1927 }; | 1928 }; |
1928 | 1929 |
1929 | 1930 |
1930 class InvalidStatement : public Statement { | 1931 class InvalidStatement : public Statement { |
1931 public: | 1932 public: |
1932 static InvalidStatement* ReadFrom(Reader* reader); | 1933 static InvalidStatement* ReadFrom(Reader* reader); |
1933 virtual void WriteTo(Writer* writer); | 1934 virtual void WriteTo(Writer* writer); |
1934 | 1935 |
1935 virtual ~InvalidStatement(); | 1936 virtual ~InvalidStatement(); |
1936 | 1937 |
1937 DEFINE_CASTING_OPERATIONS(InvalidStatement); | 1938 DEFINE_CASTING_OPERATIONS(InvalidStatement); |
1938 | 1939 |
1939 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | 1940 virtual void AcceptStatementVisitor(StatementVisitor* visitor); |
1940 virtual void VisitChildren(Visitor* visitor); | 1941 virtual void VisitChildren(Visitor* visitor); |
1941 | 1942 |
1942 private: | 1943 private: |
1943 InvalidStatement() { } | 1944 InvalidStatement() {} |
1944 | 1945 |
1945 DISALLOW_COPY_AND_ASSIGN(InvalidStatement); | 1946 DISALLOW_COPY_AND_ASSIGN(InvalidStatement); |
1946 }; | 1947 }; |
1947 | 1948 |
1948 | 1949 |
1949 class ExpressionStatement : public Statement { | 1950 class ExpressionStatement : public Statement { |
1950 public: | 1951 public: |
1951 static ExpressionStatement* ReadFrom(Reader* reader); | 1952 static ExpressionStatement* ReadFrom(Reader* reader); |
1952 virtual void WriteTo(Writer* writer); | 1953 virtual void WriteTo(Writer* writer); |
1953 | 1954 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2000 virtual void WriteTo(Writer* writer); | 2001 virtual void WriteTo(Writer* writer); |
2001 | 2002 |
2002 virtual ~EmptyStatement(); | 2003 virtual ~EmptyStatement(); |
2003 | 2004 |
2004 DEFINE_CASTING_OPERATIONS(EmptyStatement); | 2005 DEFINE_CASTING_OPERATIONS(EmptyStatement); |
2005 | 2006 |
2006 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | 2007 virtual void AcceptStatementVisitor(StatementVisitor* visitor); |
2007 virtual void VisitChildren(Visitor* visitor); | 2008 virtual void VisitChildren(Visitor* visitor); |
2008 | 2009 |
2009 private: | 2010 private: |
2010 EmptyStatement() { } | 2011 EmptyStatement() {} |
2011 | 2012 |
2012 DISALLOW_COPY_AND_ASSIGN(EmptyStatement); | 2013 DISALLOW_COPY_AND_ASSIGN(EmptyStatement); |
2013 }; | 2014 }; |
2014 | 2015 |
2015 | 2016 |
2016 class AssertStatement : public Statement { | 2017 class AssertStatement : public Statement { |
2017 public: | 2018 public: |
2018 static AssertStatement* ReadFrom(Reader* reader); | 2019 static AssertStatement* ReadFrom(Reader* reader); |
2019 virtual void WriteTo(Writer* writer); | 2020 virtual void WriteTo(Writer* writer); |
2020 | 2021 |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 bool IsAlwaysNull() { return value_bits_ == kNull; } | 2563 bool IsAlwaysNull() { return value_bits_ == kNull; } |
2563 bool IsAlwaysInteger() { return value_bits_ == kInteger; } | 2564 bool IsAlwaysInteger() { return value_bits_ == kInteger; } |
2564 bool IsAlwaysDouble() { return value_bits_ == kDouble; } | 2565 bool IsAlwaysDouble() { return value_bits_ == kDouble; } |
2565 bool IsAlwaysString() { return value_bits_ == kString; } | 2566 bool IsAlwaysString() { return value_bits_ == kString; } |
2566 | 2567 |
2567 Class* klass() { return klass_; } | 2568 Class* klass() { return klass_; } |
2568 BaseClassKind kind() { return kind_; } | 2569 BaseClassKind kind() { return kind_; } |
2569 uint8_t value_bits() { return value_bits_; } | 2570 uint8_t value_bits() { return value_bits_; } |
2570 | 2571 |
2571 private: | 2572 private: |
2572 InferredValue() { } | 2573 InferredValue() {} |
2573 | 2574 |
2574 Ref<Class> klass_; | 2575 Ref<Class> klass_; |
2575 BaseClassKind kind_; | 2576 BaseClassKind kind_; |
2576 uint8_t value_bits_; | 2577 uint8_t value_bits_; |
2577 | 2578 |
2578 DISALLOW_COPY_AND_ASSIGN(InferredValue); | 2579 DISALLOW_COPY_AND_ASSIGN(InferredValue); |
2579 }; | 2580 }; |
2580 | 2581 |
2581 | 2582 |
2582 class DartType : public Node { | 2583 class DartType : public Node { |
2583 public: | 2584 public: |
2584 static DartType* ReadFrom(Reader* reader); | 2585 static DartType* ReadFrom(Reader* reader); |
2585 virtual void WriteTo(Writer* writer) = 0; | 2586 virtual void WriteTo(Writer* writer) = 0; |
2586 | 2587 |
2587 virtual ~DartType(); | 2588 virtual ~DartType(); |
2588 | 2589 |
2589 DEFINE_CASTING_OPERATIONS(DartType); | 2590 DEFINE_CASTING_OPERATIONS(DartType); |
2590 | 2591 |
2591 virtual void AcceptVisitor(Visitor* visitor); | 2592 virtual void AcceptVisitor(Visitor* visitor); |
2592 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor) = 0; | 2593 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor) = 0; |
2593 | 2594 |
2594 protected: | 2595 protected: |
2595 DartType() { } | 2596 DartType() {} |
2596 | 2597 |
2597 private: | 2598 private: |
2598 DISALLOW_COPY_AND_ASSIGN(DartType); | 2599 DISALLOW_COPY_AND_ASSIGN(DartType); |
2599 }; | 2600 }; |
2600 | 2601 |
2601 | 2602 |
2602 class InvalidType : public DartType { | 2603 class InvalidType : public DartType { |
2603 public: | 2604 public: |
2604 static InvalidType* ReadFrom(Reader* reader); | 2605 static InvalidType* ReadFrom(Reader* reader); |
2605 void WriteTo(Writer* writer); | 2606 void WriteTo(Writer* writer); |
2606 | 2607 |
2607 virtual ~InvalidType(); | 2608 virtual ~InvalidType(); |
2608 | 2609 |
2609 DEFINE_CASTING_OPERATIONS(InvalidType); | 2610 DEFINE_CASTING_OPERATIONS(InvalidType); |
2610 | 2611 |
2611 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2612 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2612 virtual void VisitChildren(Visitor* visitor); | 2613 virtual void VisitChildren(Visitor* visitor); |
2613 | 2614 |
2614 private: | 2615 private: |
2615 InvalidType() { } | 2616 InvalidType() {} |
2616 | 2617 |
2617 DISALLOW_COPY_AND_ASSIGN(InvalidType); | 2618 DISALLOW_COPY_AND_ASSIGN(InvalidType); |
2618 }; | 2619 }; |
2619 | 2620 |
2620 | 2621 |
2621 class DynamicType : public DartType { | 2622 class DynamicType : public DartType { |
2622 public: | 2623 public: |
2623 static DynamicType* ReadFrom(Reader* reader); | 2624 static DynamicType* ReadFrom(Reader* reader); |
2624 void WriteTo(Writer* writer); | 2625 void WriteTo(Writer* writer); |
2625 | 2626 |
2626 virtual ~DynamicType(); | 2627 virtual ~DynamicType(); |
2627 | 2628 |
2628 DEFINE_CASTING_OPERATIONS(DynamicType); | 2629 DEFINE_CASTING_OPERATIONS(DynamicType); |
2629 | 2630 |
2630 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2631 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2631 virtual void VisitChildren(Visitor* visitor); | 2632 virtual void VisitChildren(Visitor* visitor); |
2632 | 2633 |
2633 private: | 2634 private: |
2634 DynamicType() { } | 2635 DynamicType() {} |
2635 | 2636 |
2636 DISALLOW_COPY_AND_ASSIGN(DynamicType); | 2637 DISALLOW_COPY_AND_ASSIGN(DynamicType); |
2637 }; | 2638 }; |
2638 | 2639 |
2639 | 2640 |
2640 class VoidType : public DartType { | 2641 class VoidType : public DartType { |
2641 public: | 2642 public: |
2642 static VoidType* ReadFrom(Reader* reader); | 2643 static VoidType* ReadFrom(Reader* reader); |
2643 void WriteTo(Writer* writer); | 2644 void WriteTo(Writer* writer); |
2644 | 2645 |
2645 virtual ~VoidType(); | 2646 virtual ~VoidType(); |
2646 | 2647 |
2647 DEFINE_CASTING_OPERATIONS(VoidType); | 2648 DEFINE_CASTING_OPERATIONS(VoidType); |
2648 | 2649 |
2649 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2650 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2650 virtual void VisitChildren(Visitor* visitor); | 2651 virtual void VisitChildren(Visitor* visitor); |
2651 | 2652 |
2652 private: | 2653 private: |
2653 VoidType() { } | 2654 VoidType() {} |
2654 | 2655 |
2655 DISALLOW_COPY_AND_ASSIGN(VoidType); | 2656 DISALLOW_COPY_AND_ASSIGN(VoidType); |
2656 }; | 2657 }; |
2657 | 2658 |
2658 | 2659 |
2659 class InterfaceType : public DartType { | 2660 class InterfaceType : public DartType { |
2660 public: | 2661 public: |
2661 static InterfaceType* ReadFrom(Reader* reader); | 2662 static InterfaceType* ReadFrom(Reader* reader); |
2662 static InterfaceType* ReadFrom(Reader* reader, bool _without_type_arguments_); | 2663 static InterfaceType* ReadFrom(Reader* reader, bool _without_type_arguments_); |
2663 void WriteTo(Writer* writer); | 2664 void WriteTo(Writer* writer); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 Ref<Procedure> main_method_; | 2793 Ref<Procedure> main_method_; |
2793 StringTable string_table_; | 2794 StringTable string_table_; |
2794 | 2795 |
2795 DISALLOW_COPY_AND_ASSIGN(Program); | 2796 DISALLOW_COPY_AND_ASSIGN(Program); |
2796 }; | 2797 }; |
2797 | 2798 |
2798 | 2799 |
2799 class Reference : public AllStatic { | 2800 class Reference : public AllStatic { |
2800 public: | 2801 public: |
2801 static Member* ReadMemberFrom(Reader* reader, bool allow_null = false); | 2802 static Member* ReadMemberFrom(Reader* reader, bool allow_null = false); |
2802 static void WriteMemberTo(Writer* writer, Member* member, | 2803 static void WriteMemberTo(Writer* writer, |
| 2804 Member* member, |
2803 bool allow_null = false); | 2805 bool allow_null = false); |
2804 | 2806 |
2805 static Class* ReadClassFrom(Reader* reader, bool allow_null = false); | 2807 static Class* ReadClassFrom(Reader* reader, bool allow_null = false); |
2806 static void WriteClassTo(Writer* writer, Class* klass, | 2808 static void WriteClassTo(Writer* writer, |
| 2809 Class* klass, |
2807 bool allow_null = false); | 2810 bool allow_null = false); |
2808 | 2811 |
2809 static String* ReadStringFrom(Reader* reader); | 2812 static String* ReadStringFrom(Reader* reader); |
2810 static void WriteStringTo(Writer* writer, String* string); // NOLINT | 2813 static void WriteStringTo(Writer* writer, String* string); // NOLINT |
2811 }; | 2814 }; |
2812 | 2815 |
2813 | 2816 |
2814 class ExpressionVisitor { | 2817 class ExpressionVisitor { |
2815 public: | 2818 public: |
2816 virtual ~ExpressionVisitor() {} | 2819 virtual ~ExpressionVisitor() {} |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3234 virtual void WriteBytes(uint8_t* buffer, int count) = 0; | 3237 virtual void WriteBytes(uint8_t* buffer, int count) = 0; |
3235 }; | 3238 }; |
3236 | 3239 |
3237 | 3240 |
3238 void WritePrecompiledKernel(ByteWriter* out, kernel::Program* program); | 3241 void WritePrecompiledKernel(ByteWriter* out, kernel::Program* program); |
3239 | 3242 |
3240 | 3243 |
3241 } // namespace dart | 3244 } // namespace dart |
3242 | 3245 |
3243 #endif // RUNTIME_VM_KERNEL_H_ | 3246 #endif // RUNTIME_VM_KERNEL_H_ |
OLD | NEW |