| 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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 enum Flags { | 1607 enum Flags { |
| 1608 kNoFlags = 0, | 1608 kNoFlags = 0, |
| 1609 kShallowElements = 1, | 1609 kShallowElements = 1, |
| 1610 kDisableMementos = 1 << 1, | 1610 kDisableMementos = 1 << 1, |
| 1611 kIsStrong = 1 << 2 | 1611 kIsStrong = 1 << 2 |
| 1612 }; | 1612 }; |
| 1613 | 1613 |
| 1614 protected: | 1614 protected: |
| 1615 ArrayLiteral(Zone* zone, ZoneList<Expression*>* values, int literal_index, | 1615 ArrayLiteral(Zone* zone, ZoneList<Expression*>* values, |
| 1616 bool is_strong, int pos) | 1616 int first_spread_index, int literal_index, bool is_strong, |
| 1617 int pos) |
| 1617 : MaterializedLiteral(zone, literal_index, is_strong, pos), | 1618 : MaterializedLiteral(zone, literal_index, is_strong, pos), |
| 1618 values_(values) {} | 1619 values_(values), |
| 1620 first_spread_index_(first_spread_index) {} |
| 1619 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } | 1621 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } |
| 1620 | 1622 |
| 1621 private: | 1623 private: |
| 1622 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1624 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1623 | 1625 |
| 1624 Handle<FixedArray> constant_elements_; | 1626 Handle<FixedArray> constant_elements_; |
| 1625 ZoneList<Expression*>* values_; | 1627 ZoneList<Expression*>* values_; |
| 1628 int first_spread_index_; |
| 1626 }; | 1629 }; |
| 1627 | 1630 |
| 1628 | 1631 |
| 1629 class VariableProxy final : public Expression { | 1632 class VariableProxy final : public Expression { |
| 1630 public: | 1633 public: |
| 1631 DECLARE_NODE_TYPE(VariableProxy) | 1634 DECLARE_NODE_TYPE(VariableProxy) |
| 1632 | 1635 |
| 1633 bool IsValidReferenceExpression() const override { return !is_this(); } | 1636 bool IsValidReferenceExpression() const override { return !is_this(); } |
| 1634 | 1637 |
| 1635 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } | 1638 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } |
| (...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3445 bool is_strong, | 3448 bool is_strong, |
| 3446 int pos) { | 3449 int pos) { |
| 3447 return new (zone_) RegExpLiteral(zone_, pattern, flags, literal_index, | 3450 return new (zone_) RegExpLiteral(zone_, pattern, flags, literal_index, |
| 3448 is_strong, pos); | 3451 is_strong, pos); |
| 3449 } | 3452 } |
| 3450 | 3453 |
| 3451 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, | 3454 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, |
| 3452 int literal_index, | 3455 int literal_index, |
| 3453 bool is_strong, | 3456 bool is_strong, |
| 3454 int pos) { | 3457 int pos) { |
| 3455 return new (zone_) ArrayLiteral(zone_, values, literal_index, is_strong, | 3458 return new (zone_) |
| 3456 pos); | 3459 ArrayLiteral(zone_, values, -1, literal_index, is_strong, pos); |
| 3460 } |
| 3461 |
| 3462 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, |
| 3463 int first_spread_index, int literal_index, |
| 3464 bool is_strong, int pos) { |
| 3465 return new (zone_) ArrayLiteral(zone_, values, first_spread_index, |
| 3466 literal_index, is_strong, pos); |
| 3457 } | 3467 } |
| 3458 | 3468 |
| 3459 VariableProxy* NewVariableProxy(Variable* var, | 3469 VariableProxy* NewVariableProxy(Variable* var, |
| 3460 int start_position = RelocInfo::kNoPosition, | 3470 int start_position = RelocInfo::kNoPosition, |
| 3461 int end_position = RelocInfo::kNoPosition) { | 3471 int end_position = RelocInfo::kNoPosition) { |
| 3462 return new (zone_) VariableProxy(zone_, var, start_position, end_position); | 3472 return new (zone_) VariableProxy(zone_, var, start_position, end_position); |
| 3463 } | 3473 } |
| 3464 | 3474 |
| 3465 VariableProxy* NewVariableProxy(const AstRawString* name, | 3475 VariableProxy* NewVariableProxy(const AstRawString* name, |
| 3466 Variable::Kind variable_kind, | 3476 Variable::Kind variable_kind, |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3613 | 3623 |
| 3614 private: | 3624 private: |
| 3615 Zone* zone_; | 3625 Zone* zone_; |
| 3616 AstValueFactory* ast_value_factory_; | 3626 AstValueFactory* ast_value_factory_; |
| 3617 }; | 3627 }; |
| 3618 | 3628 |
| 3619 | 3629 |
| 3620 } } // namespace v8::internal | 3630 } } // namespace v8::internal |
| 3621 | 3631 |
| 3622 #endif // V8_AST_H_ | 3632 #endif // V8_AST_H_ |
| OLD | NEW |