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

Unified Diff: src/compiler/ast-graph-builder.h

Issue 873423004: First stab at try-catch and try-finally in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed moarer comments by Ben Titzer. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.h
diff --git a/src/compiler/ast-graph-builder.h b/src/compiler/ast-graph-builder.h
index 07a2a06821bebb3d3b40bc679b90ecf4bf10c375..390ab234a482dbb04d7169c59e1e019e9df60262 100644
--- a/src/compiler/ast-graph-builder.h
+++ b/src/compiler/ast-graph-builder.h
@@ -63,8 +63,12 @@ class AstGraphBuilder : public AstVisitor {
class AstEffectContext;
class AstValueContext;
class AstTestContext;
- class BreakableScope;
class ContextScope;
+ class ControlScope;
+ class ControlScopeForBreakable;
+ class ControlScopeForIteration;
+ class ControlScopeForCatch;
+ class ControlScopeForFinally;
class Environment;
friend class ControlBuilder;
@@ -77,8 +81,8 @@ class AstGraphBuilder : public AstVisitor {
// List of global declarations for functions and variables.
ZoneVector<Handle<Object>> globals_;
- // Stack of breakable statements entered by the visitor.
- BreakableScope* breakable_;
+ // Stack of control scopes currently entered by the visitor.
+ ControlScope* execution_control_;
// Stack of context objects pushed onto the chain by the visitor.
ContextScope* execution_context_;
@@ -110,7 +114,7 @@ class AstGraphBuilder : public AstVisitor {
Zone* local_zone() const { return local_zone_; }
Environment* environment() { return environment_; }
AstContext* ast_context() const { return ast_context_; }
- BreakableScope* breakable() const { return breakable_; }
+ ControlScope* execution_control() const { return execution_control_; }
ContextScope* execution_context() const { return execution_context_; }
CommonOperatorBuilder* common() const { return jsgraph_->common(); }
CompilationInfo* info() const { return info_; }
@@ -126,7 +130,7 @@ class AstGraphBuilder : public AstVisitor {
Node* exit_control() const { return exit_control_; }
void set_ast_context(AstContext* ctx) { ast_context_ = ctx; }
- void set_breakable(BreakableScope* brk) { breakable_ = brk; }
+ void set_execution_control(ControlScope* ctrl) { execution_control_ = ctrl; }
void set_execution_context(ContextScope* ctx) { execution_context_ = ctx; }
void set_exit_control(Node* exit) { exit_control_ = exit; }
void set_current_context(Node* ctx) { current_context_ = ctx; }
@@ -237,6 +241,10 @@ class AstGraphBuilder : public AstVisitor {
Node* BuildHoleCheckThrow(Node* value, Variable* var, Node* not_hole,
BailoutId bailout_id);
+ // Builders for non-local control flow.
+ Node* BuildReturn(Node* return_value);
+ Node* BuildThrow(Node* exception_value);
+
// Builders for binary operations.
Node* BuildBinaryOp(Node* left, Node* right, Token::Value op);
@@ -529,42 +537,6 @@ class AstGraphBuilder::AstTestContext FINAL : public AstContext {
};
-// Scoped class tracking breakable statements entered by the visitor. Allows to
-// properly 'break' and 'continue' iteration statements as well as to 'break'
-// from blocks within switch statements.
-class AstGraphBuilder::BreakableScope BASE_EMBEDDED {
- public:
- BreakableScope(AstGraphBuilder* owner, BreakableStatement* target,
- ControlBuilder* control, int drop_extra)
- : owner_(owner),
- target_(target),
- next_(owner->breakable()),
- control_(control),
- drop_extra_(drop_extra) {
- owner_->set_breakable(this); // Push.
- }
-
- ~BreakableScope() {
- owner_->set_breakable(next_); // Pop.
- }
-
- // Either 'break' or 'continue' the target statement.
- void BreakTarget(BreakableStatement* target);
- void ContinueTarget(BreakableStatement* target);
-
- private:
- AstGraphBuilder* owner_;
- BreakableStatement* target_;
- BreakableScope* next_;
- ControlBuilder* control_;
- int drop_extra_;
-
- // Find the correct scope for the target statement. Note that this also drops
- // extra operands from the environment for each scope skipped along the way.
- BreakableScope* FindBreakable(BreakableStatement* target);
-};
-
-
// Scoped class tracking context objects created by the visitor. Represents
// mutations of the context chain within the function body and allows to
// change the current {scope} and {context} during visitation.
« 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