Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: src/ast.h

Issue 938443002: [es6] implement spread calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add construct support, clean out some gunk Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 V(Yield) \ 86 V(Yield) \
87 V(Throw) \ 87 V(Throw) \
88 V(Property) \ 88 V(Property) \
89 V(Call) \ 89 V(Call) \
90 V(CallNew) \ 90 V(CallNew) \
91 V(CallRuntime) \ 91 V(CallRuntime) \
92 V(UnaryOperation) \ 92 V(UnaryOperation) \
93 V(CountOperation) \ 93 V(CountOperation) \
94 V(BinaryOperation) \ 94 V(BinaryOperation) \
95 V(CompareOperation) \ 95 V(CompareOperation) \
96 V(SpreadOperation) \
96 V(ThisFunction) \ 97 V(ThisFunction) \
97 V(SuperReference) \ 98 V(SuperReference) \
98 V(CaseClause) 99 V(CaseClause)
99 100
100 #define AST_NODE_LIST(V) \ 101 #define AST_NODE_LIST(V) \
101 DECLARATION_NODE_LIST(V) \ 102 DECLARATION_NODE_LIST(V) \
102 MODULE_NODE_LIST(V) \ 103 MODULE_NODE_LIST(V) \
103 STATEMENT_NODE_LIST(V) \ 104 STATEMENT_NODE_LIST(V) \
104 EXPRESSION_NODE_LIST(V) 105 EXPRESSION_NODE_LIST(V)
105 106
(...skipping 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2235 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2235 2236
2236 Token::Value op_; 2237 Token::Value op_;
2237 Expression* left_; 2238 Expression* left_;
2238 Expression* right_; 2239 Expression* right_;
2239 2240
2240 Type* combined_type_; 2241 Type* combined_type_;
2241 }; 2242 };
2242 2243
2243 2244
2245 class SpreadOperation FINAL : public Expression {
2246 public:
2247 DECLARE_NODE_TYPE(SpreadOperation)
2248
2249 Expression* expression() const { return expression_; }
2250
2251 static int num_ids() { return parent_num_ids(); }
2252
2253 protected:
2254 SpreadOperation(Zone* zone, Expression* expression, int pos)
2255 : Expression(zone, pos), expression_(expression) {}
2256 static int parent_num_ids() { return Expression::num_ids(); }
2257
2258 private:
2259 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2260
2261 Expression* expression_;
2262 };
2263
2264
2244 class Conditional FINAL : public Expression { 2265 class Conditional FINAL : public Expression {
2245 public: 2266 public:
2246 DECLARE_NODE_TYPE(Conditional) 2267 DECLARE_NODE_TYPE(Conditional)
2247 2268
2248 Expression* condition() const { return condition_; } 2269 Expression* condition() const { return condition_; }
2249 Expression* then_expression() const { return then_expression_; } 2270 Expression* then_expression() const { return then_expression_; }
2250 Expression* else_expression() const { return else_expression_; } 2271 Expression* else_expression() const { return else_expression_; }
2251 2272
2252 static int num_ids() { return parent_num_ids() + 2; } 2273 static int num_ids() { return parent_num_ids() + 2; }
2253 BailoutId ThenId() const { return BailoutId(local_id(0)); } 2274 BailoutId ThenId() const { return BailoutId(local_id(0)); }
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); 3474 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos);
3454 } 3475 }
3455 3476
3456 CompareOperation* NewCompareOperation(Token::Value op, 3477 CompareOperation* NewCompareOperation(Token::Value op,
3457 Expression* left, 3478 Expression* left,
3458 Expression* right, 3479 Expression* right,
3459 int pos) { 3480 int pos) {
3460 return new (zone_) CompareOperation(zone_, op, left, right, pos); 3481 return new (zone_) CompareOperation(zone_, op, left, right, pos);
3461 } 3482 }
3462 3483
3484 SpreadOperation* NewSpreadOperation(Expression* expression, int pos) {
3485 return new (zone_) SpreadOperation(zone_, expression, pos);
3486 }
3487
3463 Conditional* NewConditional(Expression* condition, 3488 Conditional* NewConditional(Expression* condition,
3464 Expression* then_expression, 3489 Expression* then_expression,
3465 Expression* else_expression, 3490 Expression* else_expression,
3466 int position) { 3491 int position) {
3467 return new (zone_) Conditional(zone_, condition, then_expression, 3492 return new (zone_) Conditional(zone_, condition, then_expression,
3468 else_expression, position); 3493 else_expression, position);
3469 } 3494 }
3470 3495
3471 Assignment* NewAssignment(Token::Value op, 3496 Assignment* NewAssignment(Token::Value op,
3472 Expression* target, 3497 Expression* target,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3537 3562
3538 private: 3563 private:
3539 Zone* zone_; 3564 Zone* zone_;
3540 AstValueFactory* ast_value_factory_; 3565 AstValueFactory* ast_value_factory_;
3541 }; 3566 };
3542 3567
3543 3568
3544 } } // namespace v8::internal 3569 } } // namespace v8::internal
3545 3570
3546 #endif // V8_AST_H_ 3571 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/ast-numbering.cc » ('j') | src/compiler/ast-graph-builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698