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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 V(Yield) \ | 85 V(Yield) \ |
86 V(Throw) \ | 86 V(Throw) \ |
87 V(Property) \ | 87 V(Property) \ |
88 V(Call) \ | 88 V(Call) \ |
89 V(CallNew) \ | 89 V(CallNew) \ |
90 V(CallRuntime) \ | 90 V(CallRuntime) \ |
91 V(UnaryOperation) \ | 91 V(UnaryOperation) \ |
92 V(CountOperation) \ | 92 V(CountOperation) \ |
93 V(BinaryOperation) \ | 93 V(BinaryOperation) \ |
94 V(CompareOperation) \ | 94 V(CompareOperation) \ |
| 95 V(SpreadOperation) \ |
95 V(ThisFunction) \ | 96 V(ThisFunction) \ |
96 V(SuperReference) \ | 97 V(SuperReference) \ |
97 V(CaseClause) | 98 V(CaseClause) |
98 | 99 |
99 #define AST_NODE_LIST(V) \ | 100 #define AST_NODE_LIST(V) \ |
100 DECLARATION_NODE_LIST(V) \ | 101 DECLARATION_NODE_LIST(V) \ |
101 MODULE_NODE_LIST(V) \ | 102 MODULE_NODE_LIST(V) \ |
102 STATEMENT_NODE_LIST(V) \ | 103 STATEMENT_NODE_LIST(V) \ |
103 EXPRESSION_NODE_LIST(V) | 104 EXPRESSION_NODE_LIST(V) |
104 | 105 |
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2201 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2202 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2202 | 2203 |
2203 Token::Value op_; | 2204 Token::Value op_; |
2204 Expression* left_; | 2205 Expression* left_; |
2205 Expression* right_; | 2206 Expression* right_; |
2206 | 2207 |
2207 Type* combined_type_; | 2208 Type* combined_type_; |
2208 }; | 2209 }; |
2209 | 2210 |
2210 | 2211 |
| 2212 class SpreadOperation FINAL : public Expression { |
| 2213 public: |
| 2214 DECLARE_NODE_TYPE(SpreadOperation) |
| 2215 |
| 2216 Expression* expression() const { return expression_; } |
| 2217 |
| 2218 static int num_ids() { return parent_num_ids(); } |
| 2219 |
| 2220 protected: |
| 2221 SpreadOperation(Zone* zone, Expression* expression, int pos) |
| 2222 : Expression(zone, pos), expression_(expression) {} |
| 2223 static int parent_num_ids() { return Expression::num_ids(); } |
| 2224 |
| 2225 private: |
| 2226 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2227 |
| 2228 Expression* expression_; |
| 2229 }; |
| 2230 |
| 2231 |
2211 class Conditional FINAL : public Expression { | 2232 class Conditional FINAL : public Expression { |
2212 public: | 2233 public: |
2213 DECLARE_NODE_TYPE(Conditional) | 2234 DECLARE_NODE_TYPE(Conditional) |
2214 | 2235 |
2215 Expression* condition() const { return condition_; } | 2236 Expression* condition() const { return condition_; } |
2216 Expression* then_expression() const { return then_expression_; } | 2237 Expression* then_expression() const { return then_expression_; } |
2217 Expression* else_expression() const { return else_expression_; } | 2238 Expression* else_expression() const { return else_expression_; } |
2218 | 2239 |
2219 static int num_ids() { return parent_num_ids() + 2; } | 2240 static int num_ids() { return parent_num_ids() + 2; } |
2220 BailoutId ThenId() const { return BailoutId(local_id(0)); } | 2241 BailoutId ThenId() const { return BailoutId(local_id(0)); } |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3406 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); | 3427 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); |
3407 } | 3428 } |
3408 | 3429 |
3409 CompareOperation* NewCompareOperation(Token::Value op, | 3430 CompareOperation* NewCompareOperation(Token::Value op, |
3410 Expression* left, | 3431 Expression* left, |
3411 Expression* right, | 3432 Expression* right, |
3412 int pos) { | 3433 int pos) { |
3413 return new (zone_) CompareOperation(zone_, op, left, right, pos); | 3434 return new (zone_) CompareOperation(zone_, op, left, right, pos); |
3414 } | 3435 } |
3415 | 3436 |
| 3437 SpreadOperation* NewSpreadOperation(Expression* expression, int pos) { |
| 3438 return new (zone_) SpreadOperation(zone_, expression, pos); |
| 3439 } |
| 3440 |
3416 Conditional* NewConditional(Expression* condition, | 3441 Conditional* NewConditional(Expression* condition, |
3417 Expression* then_expression, | 3442 Expression* then_expression, |
3418 Expression* else_expression, | 3443 Expression* else_expression, |
3419 int position) { | 3444 int position) { |
3420 return new (zone_) Conditional(zone_, condition, then_expression, | 3445 return new (zone_) Conditional(zone_, condition, then_expression, |
3421 else_expression, position); | 3446 else_expression, position); |
3422 } | 3447 } |
3423 | 3448 |
3424 Assignment* NewAssignment(Token::Value op, | 3449 Assignment* NewAssignment(Token::Value op, |
3425 Expression* target, | 3450 Expression* target, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3490 | 3515 |
3491 private: | 3516 private: |
3492 Zone* zone_; | 3517 Zone* zone_; |
3493 AstValueFactory* ast_value_factory_; | 3518 AstValueFactory* ast_value_factory_; |
3494 }; | 3519 }; |
3495 | 3520 |
3496 | 3521 |
3497 } } // namespace v8::internal | 3522 } } // namespace v8::internal |
3498 | 3523 |
3499 #endif // V8_AST_H_ | 3524 #endif // V8_AST_H_ |
OLD | NEW |