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 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 Statement* then_statement_; | 1156 Statement* then_statement_; |
1157 Statement* else_statement_; | 1157 Statement* else_statement_; |
1158 int base_id_; | 1158 int base_id_; |
1159 }; | 1159 }; |
1160 | 1160 |
1161 | 1161 |
1162 class TryStatement : public Statement { | 1162 class TryStatement : public Statement { |
1163 public: | 1163 public: |
1164 Block* try_block() const { return try_block_; } | 1164 Block* try_block() const { return try_block_; } |
1165 | 1165 |
| 1166 void set_base_id(int id) { base_id_ = id; } |
| 1167 static int num_ids() { return parent_num_ids() + 1; } |
| 1168 BailoutId HandlerId() const { return BailoutId(local_id(0)); } |
| 1169 |
1166 protected: | 1170 protected: |
1167 TryStatement(Zone* zone, Block* try_block, int pos) | 1171 TryStatement(Zone* zone, Block* try_block, int pos) |
1168 : Statement(zone, pos), try_block_(try_block) {} | 1172 : Statement(zone, pos), |
| 1173 try_block_(try_block), |
| 1174 base_id_(BailoutId::None().ToInt()) {} |
| 1175 static int parent_num_ids() { return 0; } |
| 1176 |
| 1177 int base_id() const { |
| 1178 DCHECK(!BailoutId(base_id_).IsNone()); |
| 1179 return base_id_; |
| 1180 } |
1169 | 1181 |
1170 private: | 1182 private: |
| 1183 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1184 |
1171 Block* try_block_; | 1185 Block* try_block_; |
| 1186 int base_id_; |
1172 }; | 1187 }; |
1173 | 1188 |
1174 | 1189 |
1175 class TryCatchStatement final : public TryStatement { | 1190 class TryCatchStatement final : public TryStatement { |
1176 public: | 1191 public: |
1177 DECLARE_NODE_TYPE(TryCatchStatement) | 1192 DECLARE_NODE_TYPE(TryCatchStatement) |
1178 | 1193 |
1179 Scope* scope() { return scope_; } | 1194 Scope* scope() { return scope_; } |
1180 Variable* variable() { return variable_; } | 1195 Variable* variable() { return variable_; } |
1181 Block* catch_block() const { return catch_block_; } | 1196 Block* catch_block() const { return catch_block_; } |
(...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3597 | 3612 |
3598 private: | 3613 private: |
3599 Zone* zone_; | 3614 Zone* zone_; |
3600 AstValueFactory* ast_value_factory_; | 3615 AstValueFactory* ast_value_factory_; |
3601 }; | 3616 }; |
3602 | 3617 |
3603 | 3618 |
3604 } } // namespace v8::internal | 3619 } } // namespace v8::internal |
3605 | 3620 |
3606 #endif // V8_AST_H_ | 3621 #endif // V8_AST_H_ |
OLD | NEW |