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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 | 915 |
916 | 916 |
917 class WithStatement final : public Statement { | 917 class WithStatement final : public Statement { |
918 public: | 918 public: |
919 Scope* scope() { return scope_; } | 919 Scope* scope() { return scope_; } |
920 Expression* expression() const { return expression_; } | 920 Expression* expression() const { return expression_; } |
921 void set_expression(Expression* e) { expression_ = e; } | 921 void set_expression(Expression* e) { expression_ = e; } |
922 Statement* statement() const { return statement_; } | 922 Statement* statement() const { return statement_; } |
923 void set_statement(Statement* s) { statement_ = s; } | 923 void set_statement(Statement* s) { statement_ = s; } |
924 | 924 |
925 void set_base_id(int id) { base_id_ = id; } | |
926 static int num_ids() { return parent_num_ids() + 2; } | |
927 BailoutId ToObjectId() const { return BailoutId(local_id(0)); } | |
928 BailoutId EntryId() const { return BailoutId(local_id(1)); } | |
929 | |
930 private: | 925 private: |
931 friend class AstNodeFactory; | 926 friend class AstNodeFactory; |
932 | 927 |
933 WithStatement(Scope* scope, Expression* expression, Statement* statement, | 928 WithStatement(Scope* scope, Expression* expression, Statement* statement, |
934 int pos) | 929 int pos) |
935 : Statement(pos, kWithStatement), | 930 : Statement(pos, kWithStatement), |
936 base_id_(BailoutId::None().ToInt()), | |
937 scope_(scope), | 931 scope_(scope), |
938 expression_(expression), | 932 expression_(expression), |
939 statement_(statement) {} | 933 statement_(statement) {} |
940 | 934 |
941 static int parent_num_ids() { return 0; } | |
942 int base_id() const { | |
943 DCHECK(!BailoutId(base_id_).IsNone()); | |
944 return base_id_; | |
945 } | |
946 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | |
947 | |
948 int base_id_; | |
949 Scope* scope_; | 935 Scope* scope_; |
950 Expression* expression_; | 936 Expression* expression_; |
951 Statement* statement_; | 937 Statement* statement_; |
952 }; | 938 }; |
953 | 939 |
954 | 940 |
955 class CaseClause final : public Expression { | 941 class CaseClause final : public Expression { |
956 public: | 942 public: |
957 bool is_default() const { return label_ == NULL; } | 943 bool is_default() const { return label_ == NULL; } |
958 Expression* label() const { | 944 Expression* label() const { |
(...skipping 2633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3592 : NULL; \ | 3578 : NULL; \ |
3593 } | 3579 } |
3594 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3580 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3595 #undef DECLARE_NODE_FUNCTIONS | 3581 #undef DECLARE_NODE_FUNCTIONS |
3596 | 3582 |
3597 | 3583 |
3598 } // namespace internal | 3584 } // namespace internal |
3599 } // namespace v8 | 3585 } // namespace v8 |
3600 | 3586 |
3601 #endif // V8_AST_AST_H_ | 3587 #endif // V8_AST_AST_H_ |
OLD | NEW |