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/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1095 | 1095 |
1096 | 1096 |
1097 class WithStatement FINAL : public Statement { | 1097 class WithStatement FINAL : public Statement { |
1098 public: | 1098 public: |
1099 DECLARE_NODE_TYPE(WithStatement) | 1099 DECLARE_NODE_TYPE(WithStatement) |
1100 | 1100 |
1101 Scope* scope() { return scope_; } | 1101 Scope* scope() { return scope_; } |
1102 Expression* expression() const { return expression_; } | 1102 Expression* expression() const { return expression_; } |
1103 Statement* statement() const { return statement_; } | 1103 Statement* statement() const { return statement_; } |
1104 | 1104 |
1105 void set_base_id(int id) { base_id_ = id; } | |
Benedikt Meurer
2015/01/22 10:35:17
There are no words to describe how ugly this is...
| |
1106 static int num_ids() { return parent_num_ids() + 1; } | |
1107 BailoutId EntryId() const { return BailoutId(local_id(0)); } | |
1108 | |
1105 protected: | 1109 protected: |
1106 WithStatement( | 1110 WithStatement(Zone* zone, Scope* scope, Expression* expression, |
1107 Zone* zone, Scope* scope, | 1111 Statement* statement, int pos) |
1108 Expression* expression, Statement* statement, int pos) | |
1109 : Statement(zone, pos), | 1112 : Statement(zone, pos), |
1110 scope_(scope), | 1113 scope_(scope), |
1111 expression_(expression), | 1114 expression_(expression), |
1112 statement_(statement) { } | 1115 statement_(statement), |
1116 base_id_(BailoutId::None().ToInt()) {} | |
1117 static int parent_num_ids() { return 0; } | |
1118 | |
1119 int base_id() const { | |
1120 DCHECK(!BailoutId(base_id_).IsNone()); | |
1121 return base_id_; | |
1122 } | |
1113 | 1123 |
1114 private: | 1124 private: |
1125 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | |
1126 | |
1115 Scope* scope_; | 1127 Scope* scope_; |
1116 Expression* expression_; | 1128 Expression* expression_; |
1117 Statement* statement_; | 1129 Statement* statement_; |
1130 int base_id_; | |
1118 }; | 1131 }; |
1119 | 1132 |
1120 | 1133 |
1121 class CaseClause FINAL : public Expression { | 1134 class CaseClause FINAL : public Expression { |
1122 public: | 1135 public: |
1123 DECLARE_NODE_TYPE(CaseClause) | 1136 DECLARE_NODE_TYPE(CaseClause) |
1124 | 1137 |
1125 bool is_default() const { return label_ == NULL; } | 1138 bool is_default() const { return label_ == NULL; } |
1126 Expression* label() const { | 1139 Expression* label() const { |
1127 CHECK(!is_default()); | 1140 CHECK(!is_default()); |
(...skipping 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3520 | 3533 |
3521 private: | 3534 private: |
3522 Zone* zone_; | 3535 Zone* zone_; |
3523 AstValueFactory* ast_value_factory_; | 3536 AstValueFactory* ast_value_factory_; |
3524 }; | 3537 }; |
3525 | 3538 |
3526 | 3539 |
3527 } } // namespace v8::internal | 3540 } } // namespace v8::internal |
3528 | 3541 |
3529 #endif // V8_AST_H_ | 3542 #endif // V8_AST_H_ |
OLD | NEW |