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-types.h" | 8 #include "src/ast/ast-types.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 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 // implemented in JavaScript (see "v8natives.js"). | 1979 // implemented in JavaScript (see "v8natives.js"). |
1980 class CallRuntime final : public Expression { | 1980 class CallRuntime final : public Expression { |
1981 public: | 1981 public: |
1982 ZoneList<Expression*>* arguments() const { return arguments_; } | 1982 ZoneList<Expression*>* arguments() const { return arguments_; } |
1983 bool is_jsruntime() const { return function_ == NULL; } | 1983 bool is_jsruntime() const { return function_ == NULL; } |
1984 | 1984 |
1985 int context_index() const { | 1985 int context_index() const { |
1986 DCHECK(is_jsruntime()); | 1986 DCHECK(is_jsruntime()); |
1987 return context_index_; | 1987 return context_index_; |
1988 } | 1988 } |
| 1989 void set_context_index(int index) { |
| 1990 DCHECK(is_jsruntime()); |
| 1991 context_index_ = index; |
| 1992 } |
1989 const Runtime::Function* function() const { | 1993 const Runtime::Function* function() const { |
1990 DCHECK(!is_jsruntime()); | 1994 DCHECK(!is_jsruntime()); |
1991 return function_; | 1995 return function_; |
1992 } | 1996 } |
1993 | 1997 |
1994 static int num_ids() { return parent_num_ids() + 1; } | 1998 static int num_ids() { return parent_num_ids() + 1; } |
1995 BailoutId CallId() { return BailoutId(local_id(0)); } | 1999 BailoutId CallId() { return BailoutId(local_id(0)); } |
1996 | 2000 |
1997 const char* debug_name() { | 2001 const char* debug_name() { |
1998 return is_jsruntime() ? "(context function)" : function_->name; | 2002 return is_jsruntime() ? "(context function)" : function_->name; |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3137 | 3141 |
3138 TryCatchStatement* NewTryCatchStatementForDesugaring(Block* try_block, | 3142 TryCatchStatement* NewTryCatchStatementForDesugaring(Block* try_block, |
3139 Scope* scope, | 3143 Scope* scope, |
3140 Variable* variable, | 3144 Variable* variable, |
3141 Block* catch_block, | 3145 Block* catch_block, |
3142 int pos) { | 3146 int pos) { |
3143 return new (zone_) TryCatchStatement( | 3147 return new (zone_) TryCatchStatement( |
3144 try_block, scope, variable, catch_block, HandlerTable::DESUGARING, pos); | 3148 try_block, scope, variable, catch_block, HandlerTable::DESUGARING, pos); |
3145 } | 3149 } |
3146 | 3150 |
| 3151 TryCatchStatement* NewTryCatchStatementForAsyncAwait(Block* try_block, |
| 3152 Scope* scope, |
| 3153 Variable* variable, |
| 3154 Block* catch_block, |
| 3155 int pos) { |
| 3156 return new (zone_) |
| 3157 TryCatchStatement(try_block, scope, variable, catch_block, |
| 3158 HandlerTable::ASYNC_AWAIT, pos); |
| 3159 } |
| 3160 |
3147 TryFinallyStatement* NewTryFinallyStatement(Block* try_block, | 3161 TryFinallyStatement* NewTryFinallyStatement(Block* try_block, |
3148 Block* finally_block, int pos) { | 3162 Block* finally_block, int pos) { |
3149 return new (zone_) TryFinallyStatement(try_block, finally_block, pos); | 3163 return new (zone_) TryFinallyStatement(try_block, finally_block, pos); |
3150 } | 3164 } |
3151 | 3165 |
3152 DebuggerStatement* NewDebuggerStatement(int pos) { | 3166 DebuggerStatement* NewDebuggerStatement(int pos) { |
3153 return new (zone_) DebuggerStatement(pos); | 3167 return new (zone_) DebuggerStatement(pos); |
3154 } | 3168 } |
3155 | 3169 |
3156 EmptyStatement* NewEmptyStatement(int pos) { | 3170 EmptyStatement* NewEmptyStatement(int pos) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3504 : NULL; \ | 3518 : NULL; \ |
3505 } | 3519 } |
3506 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3520 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3507 #undef DECLARE_NODE_FUNCTIONS | 3521 #undef DECLARE_NODE_FUNCTIONS |
3508 | 3522 |
3509 | 3523 |
3510 } // namespace internal | 3524 } // namespace internal |
3511 } // namespace v8 | 3525 } // namespace v8 |
3512 | 3526 |
3513 #endif // V8_AST_AST_H_ | 3527 #endif // V8_AST_AST_H_ |
OLD | NEW |