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

Side by Side Diff: runtime/vm/ast.h

Issue 10832126: Store pointer instead of reference to LocalVariable in ast and flow graph. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | runtime/vm/object.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 VM_AST_H_ 5 #ifndef VM_AST_H_
6 #define VM_AST_H_ 6 #define VM_AST_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/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 class AstNode : public ZoneAllocated { 93 class AstNode : public ZoneAllocated {
94 public: 94 public:
95 static const int kNoId = -1; 95 static const int kNoId = -1;
96 96
97 explicit AstNode(intptr_t token_pos) 97 explicit AstNode(intptr_t token_pos)
98 : token_pos_(token_pos), 98 : token_pos_(token_pos),
99 id_(GetNextId()), 99 id_(GetNextId()),
100 ic_data_(ICData::ZoneHandle()), 100 ic_data_(ICData::ZoneHandle()),
101 info_(NULL) { 101 info_(NULL) {
102 ASSERT(token_pos >= 0); 102 ASSERT(token_pos_ >= 0);
103 } 103 }
104 104
105 intptr_t token_pos() const { return token_pos_; } 105 intptr_t token_pos() const { return token_pos_; }
106 106
107 107
108 const ICData& ic_data() const { return ic_data_; } 108 const ICData& ic_data() const { return ic_data_; }
109 void set_ic_data(const ICData& value) { 109 void set_ic_data(const ICData& value) {
110 ic_data_ = value.raw(); 110 ic_data_ = value.raw();
111 } 111 }
112 112
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 public: 462 public:
463 // Return from a void function returns the null object. 463 // Return from a void function returns the null object.
464 explicit ReturnNode(intptr_t token_pos) 464 explicit ReturnNode(intptr_t token_pos)
465 : AstNode(token_pos), 465 : AstNode(token_pos),
466 value_(new LiteralNode(token_pos, Instance::ZoneHandle())), 466 value_(new LiteralNode(token_pos, Instance::ZoneHandle())),
467 inlined_finally_list_() { } 467 inlined_finally_list_() { }
468 // Return from a non-void function. 468 // Return from a non-void function.
469 ReturnNode(intptr_t token_pos, 469 ReturnNode(intptr_t token_pos,
470 AstNode* value) 470 AstNode* value)
471 : AstNode(token_pos), value_(value), inlined_finally_list_() { 471 : AstNode(token_pos), value_(value), inlined_finally_list_() {
472 ASSERT(value != NULL); 472 ASSERT(value_ != NULL);
473 } 473 }
474 474
475 AstNode* value() const { return value_; } 475 AstNode* value() const { return value_; }
476 476
477 intptr_t inlined_finally_list_length() const { 477 intptr_t inlined_finally_list_length() const {
478 return inlined_finally_list_.length(); 478 return inlined_finally_list_.length();
479 } 479 }
480 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const { 480 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const {
481 return inlined_finally_list_[index]; 481 return inlined_finally_list_[index];
482 } 482 }
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 private: 921 private:
922 Token::Kind kind_; 922 Token::Kind kind_;
923 SourceLabel* label_; 923 SourceLabel* label_;
924 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; 924 GrowableArray<InlinedFinallyNode*> inlined_finally_list_;
925 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode); 925 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode);
926 }; 926 };
927 927
928 928
929 class LoadLocalNode : public AstNode { 929 class LoadLocalNode : public AstNode {
930 public: 930 public:
931 LoadLocalNode(intptr_t token_pos, const LocalVariable& local) 931 LoadLocalNode(intptr_t token_pos, const LocalVariable* local)
932 : AstNode(token_pos), local_(local), pseudo_(NULL) { 932 : AstNode(token_pos), local_(local), pseudo_(NULL) {
933 ASSERT(&local_ != NULL); 933 ASSERT(local_ != NULL);
Ivan Posva 2012/08/03 20:10:26 local_ = *local;
regis 2012/08/06 22:31:49 This is actually not possible, because of DISALLOW
934 } 934 }
935 // The pseudo node does not produce input but must be visited before 935 // The pseudo node does not produce input but must be visited before
936 // completing local load. 936 // completing local load.
937 LoadLocalNode(intptr_t token_pos, 937 LoadLocalNode(intptr_t token_pos,
938 const LocalVariable& local, 938 const LocalVariable* local,
939 AstNode* pseudo) 939 AstNode* pseudo)
940 : AstNode(token_pos), local_(local), pseudo_(pseudo) { 940 : AstNode(token_pos), local_(local), pseudo_(pseudo) {
941 ASSERT(&local_ != NULL); 941 ASSERT(local_ != NULL);
942 } 942 }
943 943
944 const LocalVariable& local() const { return local_; } 944 const LocalVariable* local() const { return local_; }
Ivan Posva 2012/08/03 20:10:26 Then this change is not needed, which is causing y
regis 2012/08/06 22:31:49 Done.
945 AstNode* pseudo() const { return pseudo_; } // Can be NULL. 945 AstNode* pseudo() const { return pseudo_; } // Can be NULL.
946 bool HasPseudo() const { return pseudo_ != NULL; } 946 bool HasPseudo() const { return pseudo_ != NULL; }
947 947
948 virtual void VisitChildren(AstNodeVisitor* visitor) const { 948 virtual void VisitChildren(AstNodeVisitor* visitor) const {
949 if (HasPseudo()) { 949 if (HasPseudo()) {
950 pseudo()->Visit(visitor); 950 pseudo()->Visit(visitor);
951 } 951 }
952 } 952 }
953 953
954 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 954 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
955 955
956 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode); 956 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode);
957 957
958 private: 958 private:
959 const LocalVariable& local_; 959 const LocalVariable* local_;
Ivan Posva 2012/08/03 20:10:26 ditto.
regis 2012/08/06 22:31:49 Done.
960 AstNode* pseudo_; 960 AstNode* pseudo_;
961 961
962 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode); 962 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode);
963 }; 963 };
964 964
965 965
966 class StoreLocalNode : public AstNode { 966 class StoreLocalNode : public AstNode {
967 public: 967 public:
968 StoreLocalNode(intptr_t token_pos, 968 StoreLocalNode(intptr_t token_pos,
969 const LocalVariable& local, 969 const LocalVariable* local,
970 AstNode* value) 970 AstNode* value)
971 : AstNode(token_pos), local_(local), value_(value) { 971 : AstNode(token_pos), local_(local), value_(value) {
972 ASSERT(&local_ != NULL); 972 ASSERT(local_ != NULL);
973 ASSERT(value_ != NULL); 973 ASSERT(value_ != NULL);
974 } 974 }
975 975
976 const LocalVariable& local() const { return local_; } 976 const LocalVariable* local() const { return local_; }
977 AstNode* value() const { return value_; } 977 AstNode* value() const { return value_; }
978 978
979 virtual void VisitChildren(AstNodeVisitor* visitor) const { 979 virtual void VisitChildren(AstNodeVisitor* visitor) const {
980 value()->Visit(visitor); 980 value()->Visit(visitor);
981 } 981 }
982 982
983 DECLARE_COMMON_NODE_FUNCTIONS(StoreLocalNode); 983 DECLARE_COMMON_NODE_FUNCTIONS(StoreLocalNode);
984 984
985 private: 985 private:
986 const LocalVariable& local_; 986 const LocalVariable* local_;
987 AstNode* value_; 987 AstNode* value_;
988 988
989 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreLocalNode); 989 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreLocalNode);
990 }; 990 };
991 991
992 992
993 993
994 class LoadInstanceFieldNode : public AstNode { 994 class LoadInstanceFieldNode : public AstNode {
995 public: 995 public:
996 LoadInstanceFieldNode(intptr_t token_pos, 996 LoadInstanceFieldNode(intptr_t token_pos,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 AstNode* value_; 1102 AstNode* value_;
1103 1103
1104 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode); 1104 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode);
1105 }; 1105 };
1106 1106
1107 1107
1108 class LoadIndexedNode : public AstNode { 1108 class LoadIndexedNode : public AstNode {
1109 public: 1109 public:
1110 LoadIndexedNode(intptr_t token_pos, AstNode* array, AstNode* index) 1110 LoadIndexedNode(intptr_t token_pos, AstNode* array, AstNode* index)
1111 : AstNode(token_pos), array_(array), index_expr_(index) { 1111 : AstNode(token_pos), array_(array), index_expr_(index) {
1112 ASSERT(array != NULL); 1112 ASSERT(array_ != NULL);
1113 ASSERT(index != NULL); 1113 ASSERT(index_expr_ != NULL);
1114 } 1114 }
1115 1115
1116 AstNode* array() const { return array_; } 1116 AstNode* array() const { return array_; }
1117 AstNode* index_expr() const { return index_expr_; } 1117 AstNode* index_expr() const { return index_expr_; }
1118 1118
1119 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1119 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1120 array()->Visit(visitor); 1120 array()->Visit(visitor);
1121 index_expr()->Visit(visitor); 1121 index_expr()->Visit(visitor);
1122 } 1122 }
1123 1123
1124 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 1124 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
1125 1125
1126 DECLARE_COMMON_NODE_FUNCTIONS(LoadIndexedNode); 1126 DECLARE_COMMON_NODE_FUNCTIONS(LoadIndexedNode);
1127 1127
1128 private: 1128 private:
1129 AstNode* array_; 1129 AstNode* array_;
1130 AstNode* index_expr_; 1130 AstNode* index_expr_;
1131 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode); 1131 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode);
1132 }; 1132 };
1133 1133
1134 1134
1135 class StoreIndexedNode : public AstNode { 1135 class StoreIndexedNode : public AstNode {
1136 public: 1136 public:
1137 StoreIndexedNode(intptr_t token_pos, 1137 StoreIndexedNode(intptr_t token_pos,
1138 AstNode* array, AstNode* index, AstNode* value) 1138 AstNode* array, AstNode* index, AstNode* value)
1139 : AstNode(token_pos), array_(array), index_expr_(index), value_(value) { 1139 : AstNode(token_pos), array_(array), index_expr_(index), value_(value) {
1140 ASSERT(array != NULL); 1140 ASSERT(array_ != NULL);
1141 ASSERT(index != NULL); 1141 ASSERT(index_expr_ != NULL);
1142 ASSERT(value != NULL); 1142 ASSERT(value_ != NULL);
1143 } 1143 }
1144 1144
1145 AstNode* array() const { return array_; } 1145 AstNode* array() const { return array_; }
1146 AstNode* index_expr() const { return index_expr_; } 1146 AstNode* index_expr() const { return index_expr_; }
1147 AstNode* value() const { return value_; } 1147 AstNode* value() const { return value_; }
1148 1148
1149 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1149 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1150 array()->Visit(visitor); 1150 array()->Visit(visitor);
1151 index_expr()->Visit(visitor); 1151 index_expr()->Visit(visitor);
1152 value()->Visit(visitor); 1152 value()->Visit(visitor);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 StaticSetterNode(intptr_t token_pos, 1310 StaticSetterNode(intptr_t token_pos,
1311 const Class& cls, 1311 const Class& cls,
1312 const String& field_name, 1312 const String& field_name,
1313 AstNode* value) 1313 AstNode* value)
1314 : AstNode(token_pos), 1314 : AstNode(token_pos),
1315 cls_(cls), 1315 cls_(cls),
1316 field_name_(field_name), 1316 field_name_(field_name),
1317 value_(value) { 1317 value_(value) {
1318 ASSERT(cls_.IsZoneHandle()); 1318 ASSERT(cls_.IsZoneHandle());
1319 ASSERT(field_name_.IsZoneHandle()); 1319 ASSERT(field_name_.IsZoneHandle());
1320 ASSERT(value != NULL); 1320 ASSERT(value_ != NULL);
1321 } 1321 }
1322 1322
1323 const Class& cls() const { return cls_; } 1323 const Class& cls() const { return cls_; }
1324 const String& field_name() const { return field_name_; } 1324 const String& field_name() const { return field_name_; }
1325 AstNode* value() const { return value_; } 1325 AstNode* value() const { return value_; }
1326 1326
1327 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1327 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1328 value()->Visit(visitor); 1328 value()->Visit(visitor);
1329 } 1329 }
1330 1330
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 // instantiator_class. 1426 // instantiator_class.
1427 // 1427 //
1428 // A temporary local is needed to hold the allocated value while the 1428 // A temporary local is needed to hold the allocated value while the
1429 // constructor is being called. 1429 // constructor is being called.
1430 class ConstructorCallNode : public AstNode { 1430 class ConstructorCallNode : public AstNode {
1431 public: 1431 public:
1432 ConstructorCallNode(intptr_t token_pos, 1432 ConstructorCallNode(intptr_t token_pos,
1433 const AbstractTypeArguments& type_arguments, 1433 const AbstractTypeArguments& type_arguments,
1434 const Function& constructor, 1434 const Function& constructor,
1435 ArgumentListNode* arguments, 1435 ArgumentListNode* arguments,
1436 const LocalVariable& allocated_object_var) 1436 const LocalVariable* allocated_object_var)
1437 : AstNode(token_pos), 1437 : AstNode(token_pos),
1438 type_arguments_(type_arguments), 1438 type_arguments_(type_arguments),
1439 constructor_(constructor), 1439 constructor_(constructor),
1440 arguments_(arguments), 1440 arguments_(arguments),
1441 allocated_object_var_(allocated_object_var) { 1441 allocated_object_var_(allocated_object_var) {
1442 ASSERT(type_arguments_.IsZoneHandle()); 1442 ASSERT(type_arguments_.IsZoneHandle());
1443 ASSERT(constructor_.IsZoneHandle()); 1443 ASSERT(constructor_.IsZoneHandle());
1444 ASSERT(arguments_ != NULL); 1444 ASSERT(arguments_ != NULL);
1445 ASSERT(allocated_object_var_ != NULL);
1445 } 1446 }
1446 1447
1447 const AbstractTypeArguments& type_arguments() const { 1448 const AbstractTypeArguments& type_arguments() const {
1448 return type_arguments_; 1449 return type_arguments_;
1449 } 1450 }
1450 const Function& constructor() const { return constructor_; } 1451 const Function& constructor() const { return constructor_; }
1451 ArgumentListNode* arguments() const { return arguments_; } 1452 ArgumentListNode* arguments() const { return arguments_; }
1452 const LocalVariable& allocated_object_var() const { 1453 const LocalVariable* allocated_object_var() const {
1453 return allocated_object_var_; 1454 return allocated_object_var_;
1454 } 1455 }
1455 1456
1456 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1457 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1457 arguments()->Visit(visitor); 1458 arguments()->Visit(visitor);
1458 } 1459 }
1459 1460
1460 DECLARE_COMMON_NODE_FUNCTIONS(ConstructorCallNode); 1461 DECLARE_COMMON_NODE_FUNCTIONS(ConstructorCallNode);
1461 1462
1462 private: 1463 private:
1463 const AbstractTypeArguments& type_arguments_; 1464 const AbstractTypeArguments& type_arguments_;
1464 const Function& constructor_; 1465 const Function& constructor_;
1465 ArgumentListNode* arguments_; 1466 ArgumentListNode* arguments_;
1466 const LocalVariable& allocated_object_var_; 1467 const LocalVariable* allocated_object_var_;
1467 1468
1468 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode); 1469 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode);
1469 }; 1470 };
1470 1471
1471 1472
1472 // The body of a Dart function marked as 'native' consists of this node. 1473 // The body of a Dart function marked as 'native' consists of this node.
1473 class NativeBodyNode : public AstNode { 1474 class NativeBodyNode : public AstNode {
1474 public: 1475 public:
1475 NativeBodyNode(intptr_t token_pos, 1476 NativeBodyNode(intptr_t token_pos,
1476 const String& native_c_function_name, 1477 const String& native_c_function_name,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); 1516 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode);
1516 }; 1517 };
1517 1518
1518 1519
1519 class CatchClauseNode : public AstNode { 1520 class CatchClauseNode : public AstNode {
1520 public: 1521 public:
1521 static const int kInvalidTryIndex = -1; 1522 static const int kInvalidTryIndex = -1;
1522 1523
1523 CatchClauseNode(intptr_t token_pos, 1524 CatchClauseNode(intptr_t token_pos,
1524 SequenceNode* catch_block, 1525 SequenceNode* catch_block,
1525 const LocalVariable& context_var, 1526 const LocalVariable* context_var,
1526 const LocalVariable& exception_var, 1527 const LocalVariable* exception_var,
1527 const LocalVariable& stacktrace_var) 1528 const LocalVariable* stacktrace_var)
1528 : AstNode(token_pos), 1529 : AstNode(token_pos),
1529 try_index_(kInvalidTryIndex), 1530 try_index_(kInvalidTryIndex),
1530 catch_block_(catch_block), 1531 catch_block_(catch_block),
1531 context_var_(context_var), 1532 context_var_(context_var),
1532 exception_var_(exception_var), 1533 exception_var_(exception_var),
1533 stacktrace_var_(stacktrace_var) { 1534 stacktrace_var_(stacktrace_var) {
1534 ASSERT(catch_block != NULL); 1535 ASSERT(catch_block_ != NULL);
1536 ASSERT(context_var_ != NULL);
1537 ASSERT(exception_var_ != NULL);
1538 ASSERT(stacktrace_var_ != NULL);
1535 } 1539 }
1536 1540
1537 int try_index() const { 1541 int try_index() const {
1538 ASSERT(try_index_ >= 0); 1542 ASSERT(try_index_ >= 0);
1539 return try_index_; 1543 return try_index_;
1540 } 1544 }
1541 void set_try_index(int value) { try_index_ = value; } 1545 void set_try_index(int value) { try_index_ = value; }
1542 1546
1543 const LocalVariable& context_var() const { return context_var_; } 1547 const LocalVariable* context_var() const { return context_var_; }
1544 const LocalVariable& exception_var() const { return exception_var_; } 1548 const LocalVariable* exception_var() const { return exception_var_; }
1545 const LocalVariable& stacktrace_var() const { return stacktrace_var_; } 1549 const LocalVariable* stacktrace_var() const { return stacktrace_var_; }
1546 1550
1547 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1551 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1548 catch_block_->Visit(visitor); 1552 catch_block_->Visit(visitor);
1549 } 1553 }
1550 1554
1551 DECLARE_COMMON_NODE_FUNCTIONS(CatchClauseNode); 1555 DECLARE_COMMON_NODE_FUNCTIONS(CatchClauseNode);
1552 1556
1553 private: 1557 private:
1554 int try_index_; // Running index of the try blocks seen in a function. 1558 int try_index_; // Running index of the try blocks seen in a function.
1555 SequenceNode* catch_block_; 1559 SequenceNode* catch_block_;
1556 const LocalVariable& context_var_; 1560 const LocalVariable* context_var_;
1557 const LocalVariable& exception_var_; 1561 const LocalVariable* exception_var_;
1558 const LocalVariable& stacktrace_var_; 1562 const LocalVariable* stacktrace_var_;
1559 1563
1560 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode); 1564 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode);
1561 }; 1565 };
1562 1566
1563 1567
1564 class TryCatchNode : public AstNode { 1568 class TryCatchNode : public AstNode {
1565 public: 1569 public:
1566 TryCatchNode(intptr_t token_pos, 1570 TryCatchNode(intptr_t token_pos,
1567 SequenceNode* try_block, 1571 SequenceNode* try_block,
1568 SourceLabel* end_catch_label, 1572 SourceLabel* end_catch_label,
1569 const LocalVariable& context_var, 1573 const LocalVariable* context_var,
1570 CatchClauseNode* catch_block, 1574 CatchClauseNode* catch_block,
1571 SequenceNode* finally_block) 1575 SequenceNode* finally_block)
1572 : AstNode(token_pos), 1576 : AstNode(token_pos),
1573 try_block_(try_block), 1577 try_block_(try_block),
1574 end_catch_label_(end_catch_label), 1578 end_catch_label_(end_catch_label),
1575 context_var_(context_var), 1579 context_var_(context_var),
1576 catch_block_(catch_block), 1580 catch_block_(catch_block),
1577 finally_block_(finally_block) { 1581 finally_block_(finally_block) {
1578 ASSERT(try_block != NULL); 1582 ASSERT(try_block_ != NULL);
1579 ASSERT(catch_block != NULL || finally_block != NULL); 1583 ASSERT(context_var_ != NULL);
1580 ASSERT(end_catch_label != NULL); 1584 ASSERT(catch_block_ != NULL || finally_block_ != NULL);
1585 ASSERT(end_catch_label_ != NULL);
1581 } 1586 }
1582 1587
1583 SequenceNode* try_block() const { return try_block_; } 1588 SequenceNode* try_block() const { return try_block_; }
1584 SourceLabel* end_catch_label() const { return end_catch_label_; } 1589 SourceLabel* end_catch_label() const { return end_catch_label_; }
1585 CatchClauseNode* catch_block() const { return catch_block_; } 1590 CatchClauseNode* catch_block() const { return catch_block_; }
1586 SequenceNode* finally_block() const { return finally_block_; } 1591 SequenceNode* finally_block() const { return finally_block_; }
1587 const LocalVariable& context_var() const { return context_var_; } 1592 const LocalVariable* context_var() const { return context_var_; }
1588 1593
1589 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1594 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1590 try_block_->Visit(visitor); 1595 try_block_->Visit(visitor);
1591 if (catch_block_ != NULL) { 1596 if (catch_block_ != NULL) {
1592 catch_block_->Visit(visitor); 1597 catch_block_->Visit(visitor);
1593 } 1598 }
1594 if (finally_block_ != NULL) { 1599 if (finally_block_ != NULL) {
1595 finally_block_->Visit(visitor); 1600 finally_block_->Visit(visitor);
1596 } 1601 }
1597 } 1602 }
1598 1603
1599 DECLARE_COMMON_NODE_FUNCTIONS(TryCatchNode); 1604 DECLARE_COMMON_NODE_FUNCTIONS(TryCatchNode);
1600 1605
1601 private: 1606 private:
1602 SequenceNode* try_block_; 1607 SequenceNode* try_block_;
1603 SourceLabel* end_catch_label_; 1608 SourceLabel* end_catch_label_;
1604 const LocalVariable& context_var_; 1609 const LocalVariable* context_var_;
1605 CatchClauseNode* catch_block_; 1610 CatchClauseNode* catch_block_;
1606 SequenceNode* finally_block_; 1611 SequenceNode* finally_block_;
1607 1612
1608 DISALLOW_COPY_AND_ASSIGN(TryCatchNode); 1613 DISALLOW_COPY_AND_ASSIGN(TryCatchNode);
1609 }; 1614 };
1610 1615
1611 1616
1612 class ThrowNode : public AstNode { 1617 class ThrowNode : public AstNode {
1613 public: 1618 public:
1614 ThrowNode(intptr_t token_pos, AstNode* exception, AstNode* stacktrace) 1619 ThrowNode(intptr_t token_pos, AstNode* exception, AstNode* stacktrace)
1615 : AstNode(token_pos), exception_(exception), stacktrace_(stacktrace) { 1620 : AstNode(token_pos), exception_(exception), stacktrace_(stacktrace) {
1616 ASSERT(exception != NULL); 1621 ASSERT(exception_ != NULL);
1617 } 1622 }
1618 1623
1619 AstNode* exception() const { return exception_; } 1624 AstNode* exception() const { return exception_; }
1620 AstNode* stacktrace() const { return stacktrace_; } 1625 AstNode* stacktrace() const { return stacktrace_; }
1621 1626
1622 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1627 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1623 exception()->Visit(visitor); 1628 exception()->Visit(visitor);
1624 if (stacktrace() != NULL) { 1629 if (stacktrace() != NULL) {
1625 stacktrace()->Visit(visitor); 1630 stacktrace()->Visit(visitor);
1626 } 1631 }
1627 } 1632 }
1628 1633
1629 DECLARE_COMMON_NODE_FUNCTIONS(ThrowNode); 1634 DECLARE_COMMON_NODE_FUNCTIONS(ThrowNode);
1630 private: 1635 private:
1631 AstNode* exception_; 1636 AstNode* exception_;
1632 AstNode* stacktrace_; 1637 AstNode* stacktrace_;
1633 1638
1634 DISALLOW_IMPLICIT_CONSTRUCTORS(ThrowNode); 1639 DISALLOW_IMPLICIT_CONSTRUCTORS(ThrowNode);
1635 }; 1640 };
1636 1641
1637 1642
1638 class InlinedFinallyNode : public AstNode { 1643 class InlinedFinallyNode : public AstNode {
1639 public: 1644 public:
1640 InlinedFinallyNode(intptr_t token_pos, 1645 InlinedFinallyNode(intptr_t token_pos,
1641 AstNode* finally_block, 1646 AstNode* finally_block,
1642 const LocalVariable& context_var) 1647 const LocalVariable* context_var)
1643 : AstNode(token_pos), 1648 : AstNode(token_pos),
1644 finally_block_(finally_block), 1649 finally_block_(finally_block),
1645 context_var_(context_var) { 1650 context_var_(context_var) {
1646 ASSERT(finally_block != NULL); 1651 ASSERT(finally_block_ != NULL);
1652 ASSERT(context_var_ != NULL);
1647 } 1653 }
1648 1654
1649 AstNode* finally_block() const { return finally_block_; } 1655 AstNode* finally_block() const { return finally_block_; }
1650 const LocalVariable& context_var() const { return context_var_; } 1656 const LocalVariable* context_var() const { return context_var_; }
1651 1657
1652 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1658 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1653 finally_block()->Visit(visitor); 1659 finally_block()->Visit(visitor);
1654 } 1660 }
1655 1661
1656 DECLARE_COMMON_NODE_FUNCTIONS(InlinedFinallyNode); 1662 DECLARE_COMMON_NODE_FUNCTIONS(InlinedFinallyNode);
1663
Ivan Posva 2012/08/03 20:10:26 Why here, but not on line 1634?
regis 2012/08/06 22:31:49 Added new line after 1634.
1657 private: 1664 private:
1658 AstNode* finally_block_; 1665 AstNode* finally_block_;
1659 const LocalVariable& context_var_; 1666 const LocalVariable* context_var_;
1660 1667
1661 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1668 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1662 }; 1669 };
1663 1670
1664 } // namespace dart 1671 } // namespace dart
1665 1672
1666 #undef DECLARE_COMMON_NODE_FUNCTIONS 1673 #undef DECLARE_COMMON_NODE_FUNCTIONS
1667 1674
1668 #endif // VM_AST_H_ 1675 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698