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(Spread) \ |
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 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2257 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2257 | 2258 |
2258 Token::Value op_; | 2259 Token::Value op_; |
2259 Expression* left_; | 2260 Expression* left_; |
2260 Expression* right_; | 2261 Expression* right_; |
2261 | 2262 |
2262 Type* combined_type_; | 2263 Type* combined_type_; |
2263 }; | 2264 }; |
2264 | 2265 |
2265 | 2266 |
| 2267 class Spread FINAL : public Expression { |
| 2268 public: |
| 2269 DECLARE_NODE_TYPE(Spread) |
| 2270 |
| 2271 Expression* expression() const { return expression_; } |
| 2272 |
| 2273 static int num_ids() { return parent_num_ids(); } |
| 2274 |
| 2275 protected: |
| 2276 Spread(Zone* zone, Expression* expression, int pos) |
| 2277 : Expression(zone, pos), expression_(expression) {} |
| 2278 static int parent_num_ids() { return Expression::num_ids(); } |
| 2279 |
| 2280 private: |
| 2281 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2282 |
| 2283 Expression* expression_; |
| 2284 }; |
| 2285 |
| 2286 |
2266 class Conditional FINAL : public Expression { | 2287 class Conditional FINAL : public Expression { |
2267 public: | 2288 public: |
2268 DECLARE_NODE_TYPE(Conditional) | 2289 DECLARE_NODE_TYPE(Conditional) |
2269 | 2290 |
2270 Expression* condition() const { return condition_; } | 2291 Expression* condition() const { return condition_; } |
2271 Expression* then_expression() const { return then_expression_; } | 2292 Expression* then_expression() const { return then_expression_; } |
2272 Expression* else_expression() const { return else_expression_; } | 2293 Expression* else_expression() const { return else_expression_; } |
2273 | 2294 |
2274 static int num_ids() { return parent_num_ids() + 2; } | 2295 static int num_ids() { return parent_num_ids() + 2; } |
2275 BailoutId ThenId() const { return BailoutId(local_id(0)); } | 2296 BailoutId ThenId() const { return BailoutId(local_id(0)); } |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3468 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); | 3489 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); |
3469 } | 3490 } |
3470 | 3491 |
3471 CompareOperation* NewCompareOperation(Token::Value op, | 3492 CompareOperation* NewCompareOperation(Token::Value op, |
3472 Expression* left, | 3493 Expression* left, |
3473 Expression* right, | 3494 Expression* right, |
3474 int pos) { | 3495 int pos) { |
3475 return new (zone_) CompareOperation(zone_, op, left, right, pos); | 3496 return new (zone_) CompareOperation(zone_, op, left, right, pos); |
3476 } | 3497 } |
3477 | 3498 |
| 3499 Spread* NewSpread(Expression* expression, int pos) { |
| 3500 return new (zone_) Spread(zone_, expression, pos); |
| 3501 } |
| 3502 |
3478 Conditional* NewConditional(Expression* condition, | 3503 Conditional* NewConditional(Expression* condition, |
3479 Expression* then_expression, | 3504 Expression* then_expression, |
3480 Expression* else_expression, | 3505 Expression* else_expression, |
3481 int position) { | 3506 int position) { |
3482 return new (zone_) Conditional(zone_, condition, then_expression, | 3507 return new (zone_) Conditional(zone_, condition, then_expression, |
3483 else_expression, position); | 3508 else_expression, position); |
3484 } | 3509 } |
3485 | 3510 |
3486 Assignment* NewAssignment(Token::Value op, | 3511 Assignment* NewAssignment(Token::Value op, |
3487 Expression* target, | 3512 Expression* target, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3552 | 3577 |
3553 private: | 3578 private: |
3554 Zone* zone_; | 3579 Zone* zone_; |
3555 AstValueFactory* ast_value_factory_; | 3580 AstValueFactory* ast_value_factory_; |
3556 }; | 3581 }; |
3557 | 3582 |
3558 | 3583 |
3559 } } // namespace v8::internal | 3584 } } // namespace v8::internal |
3560 | 3585 |
3561 #endif // V8_AST_H_ | 3586 #endif // V8_AST_H_ |
OLD | NEW |