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

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

Issue 10356108: With removal of increment operations, each node has a unique id. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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/compiler.cc » ('j') | no next file with comments »
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 explicit AstNode(intptr_t token_index) 98 explicit AstNode(intptr_t token_index)
99 : token_index_(token_index), 99 : token_index_(token_index),
100 id_(GetNextId()), 100 id_(GetNextId()),
101 ic_data_(ICData::ZoneHandle()), 101 ic_data_(ICData::ZoneHandle()),
102 info_(NULL) { 102 info_(NULL) {
103 ASSERT(token_index >= 0); 103 ASSERT(token_index >= 0);
104 } 104 }
105 105
106 intptr_t token_index() const { return token_index_; } 106 intptr_t token_index() const { return token_index_; }
107 107
108 virtual void SetIcDataAtId(intptr_t node_id, const ICData& value) { 108
109 ASSERT(id() == node_id); 109 const ICData& ic_data() const { return ic_data_; }
110 set_ic_data(value); 110 void set_ic_data(const ICData& value) {
111 ic_data_ = value.raw();
111 } 112 }
112 113
113 virtual const ICData& ICDataAtId(intptr_t node_id) const {
114 ASSERT(id() == node_id);
115 return ic_data_;
116 }
117
118 virtual bool HasId(intptr_t value) const { return id_ == value; }
119
120 intptr_t id() const { return id_; } 114 intptr_t id() const { return id_; }
121 115
122 void set_info(CodeGenInfo* info) { info_ = info; } 116 void set_info(CodeGenInfo* info) { info_ = info; }
123 CodeGenInfo* info() const { return info_; } 117 CodeGenInfo* info() const { return info_; }
124 118
125 #define AST_TYPE_CHECK(type, name) \ 119 #define AST_TYPE_CHECK(type, name) \
126 virtual bool Is##type() const { return false; } \ 120 virtual bool Is##type() const { return false; } \
127 virtual type* As##type() { return NULL; } 121 virtual type* As##type() { return NULL; }
128 NODE_LIST(AST_TYPE_CHECK) 122 NODE_LIST(AST_TYPE_CHECK)
129 #undef AST_TYPE_CHECK 123 #undef AST_TYPE_CHECK
(...skipping 27 matching lines...) Expand all
157 // constant. Otherwise, the return value is an approximation of the 151 // constant. Otherwise, the return value is an approximation of the
158 // actual value of the const expression. The type of the returned value 152 // actual value of the const expression. The type of the returned value
159 // corresponds to the type of the const expression and is either 153 // corresponds to the type of the const expression and is either
160 // Number, Integer, String, Bool, or anything else (not a subtype of 154 // Number, Integer, String, Bool, or anything else (not a subtype of
161 // the former). 155 // the former).
162 virtual const Instance* EvalConstExpr() const { return NULL; } 156 virtual const Instance* EvalConstExpr() const { return NULL; }
163 157
164 protected: 158 protected:
165 friend class ParsedFunction; 159 friend class ParsedFunction;
166 160
167 const ICData& ic_data() const { return ic_data_; }
168 void set_ic_data(const ICData& value) {
169 ic_data_ = value.raw();
170 }
171
172 static intptr_t GetNextId() { 161 static intptr_t GetNextId() {
173 Isolate* isolate = Isolate::Current(); 162 Isolate* isolate = Isolate::Current();
174 intptr_t tmp = isolate->ast_node_id(); 163 intptr_t tmp = isolate->ast_node_id();
175 isolate->set_ast_node_id(tmp + 1); 164 isolate->set_ast_node_id(tmp + 1);
176 return tmp; 165 return tmp;
177 } 166 }
178 167
179 private: 168 private:
180 const intptr_t token_index_; 169 const intptr_t token_index_;
181 // Unique id per function compiled, used to match AST node to a PC. 170 // Unique id per function compiled, used to match AST node to a PC.
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 const LocalVariable& context_var_; 1652 const LocalVariable& context_var_;
1664 1653
1665 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1654 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1666 }; 1655 };
1667 1656
1668 } // namespace dart 1657 } // namespace dart
1669 1658
1670 #undef DECLARE_COMMON_NODE_FUNCTIONS 1659 #undef DECLARE_COMMON_NODE_FUNCTIONS
1671 1660
1672 #endif // VM_AST_H_ 1661 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698