Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_AST_H_ | 5 #ifndef V8_AST_H_ |
| 6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 int node_count_; | 177 int node_count_; |
| 178 int feedback_slots_; | 178 int feedback_slots_; |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 | 181 |
| 182 class AstNode: public ZoneObject { | 182 class AstNode: public ZoneObject { |
| 183 public: | 183 public: |
| 184 // For generating IDs for AstNodes. | 184 // For generating IDs for AstNodes. |
| 185 class IdGen { | 185 class IdGen { |
| 186 public: | 186 public: |
| 187 explicit IdGen(int id = 0) : id_(id) {} | 187 IdGen() : id_(BailoutId::FirstUsable().ToInt()) {} |
|
wingo
2014/10/08 13:34:46
What is the plan with bailout ids -- still a per-f
| |
| 188 | 188 |
| 189 int GetNextId() { return ReserveIdRange(1); } | 189 int GetNextId() { return ReserveIdRange(1); } |
| 190 int ReserveIdRange(int n) { | 190 int ReserveIdRange(int n) { |
| 191 int tmp = id_; | 191 int tmp = id_; |
| 192 id_ += n; | 192 id_ += n; |
| 193 return tmp; | 193 return tmp; |
| 194 } | 194 } |
| 195 | 195 |
| 196 private: | 196 private: |
| 197 int id_; | 197 int id_; |
| 198 | |
| 199 DISALLOW_COPY_AND_ASSIGN(IdGen); | |
| 198 }; | 200 }; |
| 199 | 201 |
| 200 #define DECLARE_TYPE_ENUM(type) k##type, | 202 #define DECLARE_TYPE_ENUM(type) k##type, |
| 201 enum NodeType { | 203 enum NodeType { |
| 202 AST_NODE_LIST(DECLARE_TYPE_ENUM) | 204 AST_NODE_LIST(DECLARE_TYPE_ENUM) |
| 203 kInvalid = -1 | 205 kInvalid = -1 |
| 204 }; | 206 }; |
| 205 #undef DECLARE_TYPE_ENUM | 207 #undef DECLARE_TYPE_ENUM |
| 206 | 208 |
| 207 void* operator new(size_t size, Zone* zone) { | 209 void* operator new(size_t size, Zone* zone) { |
| (...skipping 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3581 Zone* zone_; | 3583 Zone* zone_; |
| 3582 Visitor visitor_; | 3584 Visitor visitor_; |
| 3583 AstValueFactory* ast_value_factory_; | 3585 AstValueFactory* ast_value_factory_; |
| 3584 AstNode::IdGen* id_gen_; | 3586 AstNode::IdGen* id_gen_; |
| 3585 }; | 3587 }; |
| 3586 | 3588 |
| 3587 | 3589 |
| 3588 } } // namespace v8::internal | 3590 } } // namespace v8::internal |
| 3589 | 3591 |
| 3590 #endif // V8_AST_H_ | 3592 #endif // V8_AST_H_ |
| OLD | NEW |