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/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/ast-value-factory.h" | 9 #include "src/ast-value-factory.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 | 456 |
457 class Block final : public BreakableStatement { | 457 class Block final : public BreakableStatement { |
458 public: | 458 public: |
459 DECLARE_NODE_TYPE(Block) | 459 DECLARE_NODE_TYPE(Block) |
460 | 460 |
461 void AddStatement(Statement* statement, Zone* zone) { | 461 void AddStatement(Statement* statement, Zone* zone) { |
462 statements_.Add(statement, zone); | 462 statements_.Add(statement, zone); |
463 } | 463 } |
464 | 464 |
| 465 void InsertStatementAt(int index, Statement* statement, Zone* zone) { |
| 466 statements_.InsertAt(index, statement, zone); |
| 467 } |
| 468 |
465 ZoneList<Statement*>* statements() { return &statements_; } | 469 ZoneList<Statement*>* statements() { return &statements_; } |
466 bool ignore_completion_value() const { return ignore_completion_value_; } | 470 bool ignore_completion_value() const { return ignore_completion_value_; } |
467 | 471 |
468 static int num_ids() { return parent_num_ids() + 1; } | 472 static int num_ids() { return parent_num_ids() + 1; } |
469 BailoutId DeclsId() const { return BailoutId(local_id(0)); } | 473 BailoutId DeclsId() const { return BailoutId(local_id(0)); } |
470 | 474 |
471 bool IsJump() const override { | 475 bool IsJump() const override { |
472 return !statements_.is_empty() && statements_.last()->IsJump() | 476 return !statements_.is_empty() && statements_.last()->IsJump() |
473 && labels() == NULL; // Good enough as an approximation... | 477 && labels() == NULL; // Good enough as an approximation... |
474 } | 478 } |
(...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 // ---------------------------------------------------------------------------- | 3202 // ---------------------------------------------------------------------------- |
3199 // AstNode factory | 3203 // AstNode factory |
3200 | 3204 |
3201 class AstNodeFactory final BASE_EMBEDDED { | 3205 class AstNodeFactory final BASE_EMBEDDED { |
3202 public: | 3206 public: |
3203 explicit AstNodeFactory(AstValueFactory* ast_value_factory) | 3207 explicit AstNodeFactory(AstValueFactory* ast_value_factory) |
3204 : local_zone_(ast_value_factory->zone()), | 3208 : local_zone_(ast_value_factory->zone()), |
3205 parser_zone_(ast_value_factory->zone()), | 3209 parser_zone_(ast_value_factory->zone()), |
3206 ast_value_factory_(ast_value_factory) {} | 3210 ast_value_factory_(ast_value_factory) {} |
3207 | 3211 |
| 3212 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } |
| 3213 |
3208 VariableDeclaration* NewVariableDeclaration( | 3214 VariableDeclaration* NewVariableDeclaration( |
3209 VariableProxy* proxy, VariableMode mode, Scope* scope, int pos, | 3215 VariableProxy* proxy, VariableMode mode, Scope* scope, int pos, |
3210 bool is_class_declaration = false, int declaration_group_start = -1) { | 3216 bool is_class_declaration = false, int declaration_group_start = -1) { |
3211 return new (parser_zone_) | 3217 return new (parser_zone_) |
3212 VariableDeclaration(parser_zone_, proxy, mode, scope, pos, | 3218 VariableDeclaration(parser_zone_, proxy, mode, scope, pos, |
3213 is_class_declaration, declaration_group_start); | 3219 is_class_declaration, declaration_group_start); |
3214 } | 3220 } |
3215 | 3221 |
3216 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, | 3222 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, |
3217 VariableMode mode, | 3223 VariableMode mode, |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3627 // the parser-level zone. | 3633 // the parser-level zone. |
3628 Zone* parser_zone_; | 3634 Zone* parser_zone_; |
3629 AstValueFactory* ast_value_factory_; | 3635 AstValueFactory* ast_value_factory_; |
3630 }; | 3636 }; |
3631 | 3637 |
3632 | 3638 |
3633 } // namespace internal | 3639 } // namespace internal |
3634 } // namespace v8 | 3640 } // namespace v8 |
3635 | 3641 |
3636 #endif // V8_AST_H_ | 3642 #endif // V8_AST_H_ |
OLD | NEW |