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_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 Statement* else_statement_; | 1176 Statement* else_statement_; |
1177 int base_id_; | 1177 int base_id_; |
1178 }; | 1178 }; |
1179 | 1179 |
1180 | 1180 |
1181 class TryStatement : public Statement { | 1181 class TryStatement : public Statement { |
1182 public: | 1182 public: |
1183 Block* try_block() const { return try_block_; } | 1183 Block* try_block() const { return try_block_; } |
1184 void set_try_block(Block* b) { try_block_ = b; } | 1184 void set_try_block(Block* b) { try_block_ = b; } |
1185 | 1185 |
1186 void set_base_id(int id) { base_id_ = id; } | |
1187 static int num_ids() { return parent_num_ids() + 1; } | |
1188 BailoutId HandlerId() const { return BailoutId(local_id(0)); } | |
1189 | |
1190 protected: | 1186 protected: |
1191 TryStatement(Zone* zone, Block* try_block, int pos) | 1187 TryStatement(Zone* zone, Block* try_block, int pos) |
1192 : Statement(zone, pos), | 1188 : Statement(zone, pos), try_block_(try_block) {} |
1193 try_block_(try_block), | |
1194 base_id_(BailoutId::None().ToInt()) {} | |
1195 static int parent_num_ids() { return 0; } | |
1196 | |
1197 int base_id() const { | |
1198 DCHECK(!BailoutId(base_id_).IsNone()); | |
1199 return base_id_; | |
1200 } | |
1201 | 1189 |
1202 private: | 1190 private: |
1203 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | |
1204 | |
1205 Block* try_block_; | 1191 Block* try_block_; |
1206 int base_id_; | |
1207 }; | 1192 }; |
1208 | 1193 |
1209 | 1194 |
1210 class TryCatchStatement final : public TryStatement { | 1195 class TryCatchStatement final : public TryStatement { |
1211 public: | 1196 public: |
1212 DECLARE_NODE_TYPE(TryCatchStatement) | 1197 DECLARE_NODE_TYPE(TryCatchStatement) |
1213 | 1198 |
1214 Scope* scope() { return scope_; } | 1199 Scope* scope() { return scope_; } |
1215 Variable* variable() { return variable_; } | 1200 Variable* variable() { return variable_; } |
1216 Block* catch_block() const { return catch_block_; } | 1201 Block* catch_block() const { return catch_block_; } |
(...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3512 // the parser-level zone. | 3497 // the parser-level zone. |
3513 Zone* parser_zone_; | 3498 Zone* parser_zone_; |
3514 AstValueFactory* ast_value_factory_; | 3499 AstValueFactory* ast_value_factory_; |
3515 }; | 3500 }; |
3516 | 3501 |
3517 | 3502 |
3518 } // namespace internal | 3503 } // namespace internal |
3519 } // namespace v8 | 3504 } // namespace v8 |
3520 | 3505 |
3521 #endif // V8_AST_AST_H_ | 3506 #endif // V8_AST_AST_H_ |
OLD | NEW |