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/ast/ast-value-factory.h" | 8 #include "src/ast/ast-value-factory.h" |
9 #include "src/ast/modules.h" | 9 #include "src/ast/modules.h" |
10 #include "src/ast/variables.h" | 10 #include "src/ast/variables.h" |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 Statement* else_statement_; | 1133 Statement* else_statement_; |
1134 int base_id_; | 1134 int base_id_; |
1135 }; | 1135 }; |
1136 | 1136 |
1137 | 1137 |
1138 class TryStatement : public Statement { | 1138 class TryStatement : public Statement { |
1139 public: | 1139 public: |
1140 Block* try_block() const { return try_block_; } | 1140 Block* try_block() const { return try_block_; } |
1141 void set_try_block(Block* b) { try_block_ = b; } | 1141 void set_try_block(Block* b) { try_block_ = b; } |
1142 | 1142 |
| 1143 // Prediction of whether exceptions thrown into the handler for this try block |
| 1144 // will be caught. |
| 1145 // |
| 1146 // This is set in ast-numbering and later compiled into the code's handler |
| 1147 // table. The runtime uses this information to implement a feature that |
| 1148 // notifies the debugger when an uncaught exception is thrown, _before_ the |
| 1149 // exception propagates to the top. |
| 1150 // |
| 1151 // Since it's generally undecidable whether an exception will be caught, our |
| 1152 // prediction is only an approximation. |
| 1153 bool catch_predicted() const { return catch_predicted_; } |
| 1154 void set_catch_predicted(bool b) { catch_predicted_ = b; } |
| 1155 |
1143 protected: | 1156 protected: |
1144 TryStatement(Zone* zone, Block* try_block, int pos) | 1157 TryStatement(Zone* zone, Block* try_block, int pos) |
1145 : Statement(zone, pos), try_block_(try_block) {} | 1158 : Statement(zone, pos), try_block_(try_block), catch_predicted_(false) {} |
1146 | 1159 |
1147 private: | 1160 private: |
1148 Block* try_block_; | 1161 Block* try_block_; |
| 1162 bool catch_predicted_; |
1149 }; | 1163 }; |
1150 | 1164 |
1151 | 1165 |
1152 class TryCatchStatement final : public TryStatement { | 1166 class TryCatchStatement final : public TryStatement { |
1153 public: | 1167 public: |
1154 DECLARE_NODE_TYPE(TryCatchStatement) | 1168 DECLARE_NODE_TYPE(TryCatchStatement) |
1155 | 1169 |
1156 Scope* scope() { return scope_; } | 1170 Scope* scope() { return scope_; } |
1157 Variable* variable() { return variable_; } | 1171 Variable* variable() { return variable_; } |
1158 Block* catch_block() const { return catch_block_; } | 1172 Block* catch_block() const { return catch_block_; } |
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3553 : NULL; \ | 3567 : NULL; \ |
3554 } | 3568 } |
3555 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3569 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3556 #undef DECLARE_NODE_FUNCTIONS | 3570 #undef DECLARE_NODE_FUNCTIONS |
3557 | 3571 |
3558 | 3572 |
3559 } // namespace internal | 3573 } // namespace internal |
3560 } // namespace v8 | 3574 } // namespace v8 |
3561 | 3575 |
3562 #endif // V8_AST_AST_H_ | 3576 #endif // V8_AST_AST_H_ |
OLD | NEW |