| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 V(ForInStatement) \ | 68 V(ForInStatement) \ |
| 69 V(ForOfStatement) \ | 69 V(ForOfStatement) \ |
| 70 V(TryCatchStatement) \ | 70 V(TryCatchStatement) \ |
| 71 V(TryFinallyStatement) \ | 71 V(TryFinallyStatement) \ |
| 72 V(DebuggerStatement) | 72 V(DebuggerStatement) |
| 73 | 73 |
| 74 #define EXPRESSION_NODE_LIST(V) \ | 74 #define EXPRESSION_NODE_LIST(V) \ |
| 75 V(FunctionLiteral) \ | 75 V(FunctionLiteral) \ |
| 76 V(ClassLiteral) \ | 76 V(ClassLiteral) \ |
| 77 V(NativeFunctionLiteral) \ | 77 V(NativeFunctionLiteral) \ |
| 78 V(Spread) \ |
| 78 V(Conditional) \ | 79 V(Conditional) \ |
| 79 V(VariableProxy) \ | 80 V(VariableProxy) \ |
| 80 V(Literal) \ | 81 V(Literal) \ |
| 81 V(RegExpLiteral) \ | 82 V(RegExpLiteral) \ |
| 82 V(ObjectLiteral) \ | 83 V(ObjectLiteral) \ |
| 83 V(ArrayLiteral) \ | 84 V(ArrayLiteral) \ |
| 84 V(Assignment) \ | 85 V(Assignment) \ |
| 85 V(Yield) \ | 86 V(Yield) \ |
| 86 V(Throw) \ | 87 V(Throw) \ |
| 87 V(Property) \ | 88 V(Property) \ |
| (...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2217 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2218 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2218 | 2219 |
| 2219 Token::Value op_; | 2220 Token::Value op_; |
| 2220 Expression* left_; | 2221 Expression* left_; |
| 2221 Expression* right_; | 2222 Expression* right_; |
| 2222 | 2223 |
| 2223 Type* combined_type_; | 2224 Type* combined_type_; |
| 2224 }; | 2225 }; |
| 2225 | 2226 |
| 2226 | 2227 |
| 2228 class Spread FINAL : public Expression { |
| 2229 public: |
| 2230 DECLARE_NODE_TYPE(Spread) |
| 2231 |
| 2232 Expression* expression() const { return expression_; } |
| 2233 |
| 2234 static int num_ids() { return parent_num_ids(); } |
| 2235 |
| 2236 protected: |
| 2237 Spread(Zone* zone, Expression* expression, int position) |
| 2238 : Expression(zone, position), |
| 2239 expression_(expression) {} |
| 2240 static int parent_num_ids() { return Expression::num_ids(); } |
| 2241 |
| 2242 private: |
| 2243 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2244 |
| 2245 Expression* expression_; |
| 2246 }; |
| 2247 |
| 2248 |
| 2227 class Conditional FINAL : public Expression { | 2249 class Conditional FINAL : public Expression { |
| 2228 public: | 2250 public: |
| 2229 DECLARE_NODE_TYPE(Conditional) | 2251 DECLARE_NODE_TYPE(Conditional) |
| 2230 | 2252 |
| 2231 Expression* condition() const { return condition_; } | 2253 Expression* condition() const { return condition_; } |
| 2232 Expression* then_expression() const { return then_expression_; } | 2254 Expression* then_expression() const { return then_expression_; } |
| 2233 Expression* else_expression() const { return else_expression_; } | 2255 Expression* else_expression() const { return else_expression_; } |
| 2234 | 2256 |
| 2235 static int num_ids() { return parent_num_ids() + 2; } | 2257 static int num_ids() { return parent_num_ids() + 2; } |
| 2236 BailoutId ThenId() const { return BailoutId(local_id(0)); } | 2258 BailoutId ThenId() const { return BailoutId(local_id(0)); } |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3425 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); | 3447 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); |
| 3426 } | 3448 } |
| 3427 | 3449 |
| 3428 CompareOperation* NewCompareOperation(Token::Value op, | 3450 CompareOperation* NewCompareOperation(Token::Value op, |
| 3429 Expression* left, | 3451 Expression* left, |
| 3430 Expression* right, | 3452 Expression* right, |
| 3431 int pos) { | 3453 int pos) { |
| 3432 return new (zone_) CompareOperation(zone_, op, left, right, pos); | 3454 return new (zone_) CompareOperation(zone_, op, left, right, pos); |
| 3433 } | 3455 } |
| 3434 | 3456 |
| 3457 Spread* NewSpread(Expression* expression, int position) { |
| 3458 return new (zone_) Spread(zone_, expression, position); |
| 3459 } |
| 3460 |
| 3435 Conditional* NewConditional(Expression* condition, | 3461 Conditional* NewConditional(Expression* condition, |
| 3436 Expression* then_expression, | 3462 Expression* then_expression, |
| 3437 Expression* else_expression, | 3463 Expression* else_expression, |
| 3438 int position) { | 3464 int position) { |
| 3439 return new (zone_) Conditional(zone_, condition, then_expression, | 3465 return new (zone_) Conditional(zone_, condition, then_expression, |
| 3440 else_expression, position); | 3466 else_expression, position); |
| 3441 } | 3467 } |
| 3442 | 3468 |
| 3443 Assignment* NewAssignment(Token::Value op, | 3469 Assignment* NewAssignment(Token::Value op, |
| 3444 Expression* target, | 3470 Expression* target, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3509 | 3535 |
| 3510 private: | 3536 private: |
| 3511 Zone* zone_; | 3537 Zone* zone_; |
| 3512 AstValueFactory* ast_value_factory_; | 3538 AstValueFactory* ast_value_factory_; |
| 3513 }; | 3539 }; |
| 3514 | 3540 |
| 3515 | 3541 |
| 3516 } } // namespace v8::internal | 3542 } } // namespace v8::internal |
| 3517 | 3543 |
| 3518 #endif // V8_AST_H_ | 3544 #endif // V8_AST_H_ |
| OLD | NEW |