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

Side by Side Diff: src/ast/ast.h

Issue 1842953003: Preserve exception message in iterator finalization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Turbofan Created 4 years, 8 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
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.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 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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 1175
1176 1176
1177 class TryCatchStatement final : public TryStatement { 1177 class TryCatchStatement final : public TryStatement {
1178 public: 1178 public:
1179 DECLARE_NODE_TYPE(TryCatchStatement) 1179 DECLARE_NODE_TYPE(TryCatchStatement)
1180 1180
1181 Scope* scope() { return scope_; } 1181 Scope* scope() { return scope_; }
1182 Variable* variable() { return variable_; } 1182 Variable* variable() { return variable_; }
1183 Block* catch_block() const { return catch_block_; } 1183 Block* catch_block() const { return catch_block_; }
1184 void set_catch_block(Block* b) { catch_block_ = b; } 1184 void set_catch_block(Block* b) { catch_block_ = b; }
1185 bool clear_pending_message() { return clear_pending_message_; }
Michael Starzinger 2016/04/01 13:07:41 nit: I love the awesome comment below. Can we move
1186
1187 // The clear_pending_message flag indicates whether or not to clear the
1188 // isolate's pending exception message before executing the catch_block. In
1189 // the normal use case, this flag is always on because the message object
1190 // is not needed anymore when entering the catch block and should not be kept
1191 // alive.
1192 // The use case where the flag is off is when the catch block is guaranteed to
1193 // rethrow the caught exception (using %ReThrow), which reuses the pending
1194 // message instead of generating a new one.
1195 // (When the catch block doesn't rethrow but is guaranteed to perform an
1196 // ordinary throw, not clearing the old message is safe but not very useful.)
1185 1197
1186 protected: 1198 protected:
1187 TryCatchStatement(Zone* zone, Block* try_block, Scope* scope, 1199 TryCatchStatement(Zone* zone, Block* try_block, Scope* scope,
1188 Variable* variable, Block* catch_block, int pos) 1200 Variable* variable, Block* catch_block,
1201 bool clear_pending_message, int pos)
1189 : TryStatement(zone, try_block, pos), 1202 : TryStatement(zone, try_block, pos),
1190 scope_(scope), 1203 scope_(scope),
1191 variable_(variable), 1204 variable_(variable),
1192 catch_block_(catch_block) {} 1205 catch_block_(catch_block),
1206 clear_pending_message_(clear_pending_message) {}
1193 1207
1194 private: 1208 private:
1195 Scope* scope_; 1209 Scope* scope_;
1196 Variable* variable_; 1210 Variable* variable_;
1197 Block* catch_block_; 1211 Block* catch_block_;
1212 bool clear_pending_message_;
1198 }; 1213 };
1199 1214
1200 1215
1201 class TryFinallyStatement final : public TryStatement { 1216 class TryFinallyStatement final : public TryStatement {
1202 public: 1217 public:
1203 DECLARE_NODE_TYPE(TryFinallyStatement) 1218 DECLARE_NODE_TYPE(TryFinallyStatement)
1204 1219
1205 Block* finally_block() const { return finally_block_; } 1220 Block* finally_block() const { return finally_block_; }
1206 void set_finally_block(Block* b) { finally_block_ = b; } 1221 void set_finally_block(Block* b) { finally_block_ = b; }
1207 1222
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after
3127 Statement* then_statement, 3142 Statement* then_statement,
3128 Statement* else_statement, 3143 Statement* else_statement,
3129 int pos) { 3144 int pos) {
3130 return new (local_zone_) IfStatement(local_zone_, condition, then_statement, 3145 return new (local_zone_) IfStatement(local_zone_, condition, then_statement,
3131 else_statement, pos); 3146 else_statement, pos);
3132 } 3147 }
3133 3148
3134 TryCatchStatement* NewTryCatchStatement(Block* try_block, Scope* scope, 3149 TryCatchStatement* NewTryCatchStatement(Block* try_block, Scope* scope,
3135 Variable* variable, 3150 Variable* variable,
3136 Block* catch_block, int pos) { 3151 Block* catch_block, int pos) {
3137 return new (local_zone_) TryCatchStatement(local_zone_, try_block, scope, 3152 return new (local_zone_) TryCatchStatement(
3138 variable, catch_block, pos); 3153 local_zone_, try_block, scope, variable, catch_block, true, pos);
3154 }
3155
3156 TryCatchStatement* NewTryCatchStatementForReThrow(Block* try_block,
3157 Scope* scope,
3158 Variable* variable,
3159 Block* catch_block,
3160 int pos) {
3161 return new (local_zone_) TryCatchStatement(
3162 local_zone_, try_block, scope, variable, catch_block, false, pos);
3139 } 3163 }
3140 3164
3141 TryFinallyStatement* NewTryFinallyStatement(Block* try_block, 3165 TryFinallyStatement* NewTryFinallyStatement(Block* try_block,
3142 Block* finally_block, int pos) { 3166 Block* finally_block, int pos) {
3143 return new (local_zone_) 3167 return new (local_zone_)
3144 TryFinallyStatement(local_zone_, try_block, finally_block, pos); 3168 TryFinallyStatement(local_zone_, try_block, finally_block, pos);
3145 } 3169 }
3146 3170
3147 DebuggerStatement* NewDebuggerStatement(int pos) { 3171 DebuggerStatement* NewDebuggerStatement(int pos) {
3148 return new (local_zone_) DebuggerStatement(local_zone_, pos); 3172 return new (local_zone_) DebuggerStatement(local_zone_, pos);
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
3514 : NULL; \ 3538 : NULL; \
3515 } 3539 }
3516 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3540 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3517 #undef DECLARE_NODE_FUNCTIONS 3541 #undef DECLARE_NODE_FUNCTIONS
3518 3542
3519 3543
3520 } // namespace internal 3544 } // namespace internal
3521 } // namespace v8 3545 } // namespace v8
3522 3546
3523 #endif // V8_AST_AST_H_ 3547 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698