| 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_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
| 6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast-types.h" | 8 #include "src/ast/ast-types.h" |
| 9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
| 10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
| (...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 | 1533 |
| 1534 int const flags_; | 1534 int const flags_; |
| 1535 const AstRawString* const pattern_; | 1535 const AstRawString* const pattern_; |
| 1536 }; | 1536 }; |
| 1537 | 1537 |
| 1538 | 1538 |
| 1539 // An array literal has a literals object that is used | 1539 // An array literal has a literals object that is used |
| 1540 // for minimizing the work when constructing it at runtime. | 1540 // for minimizing the work when constructing it at runtime. |
| 1541 class ArrayLiteral final : public MaterializedLiteral { | 1541 class ArrayLiteral final : public MaterializedLiteral { |
| 1542 public: | 1542 public: |
| 1543 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 1543 Handle<ConstantElementsPair> constant_elements() const { |
| 1544 return constant_elements_; |
| 1545 } |
| 1544 ElementsKind constant_elements_kind() const { | 1546 ElementsKind constant_elements_kind() const { |
| 1545 DCHECK_EQ(2, constant_elements_->length()); | 1547 return static_cast<ElementsKind>(constant_elements()->elements_kind()); |
| 1546 return static_cast<ElementsKind>( | |
| 1547 Smi::cast(constant_elements_->get(0))->value()); | |
| 1548 } | 1548 } |
| 1549 | 1549 |
| 1550 ZoneList<Expression*>* values() const { return values_; } | 1550 ZoneList<Expression*>* values() const { return values_; } |
| 1551 | 1551 |
| 1552 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } | 1552 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } |
| 1553 | 1553 |
| 1554 // Return an AST id for an element that is used in simulate instructions. | 1554 // Return an AST id for an element that is used in simulate instructions. |
| 1555 BailoutId GetIdForElement(int i) { return BailoutId(local_id(i + 1)); } | 1555 BailoutId GetIdForElement(int i) { return BailoutId(local_id(i + 1)); } |
| 1556 | 1556 |
| 1557 // Unlike other AST nodes, this number of bailout IDs allocated for an | 1557 // Unlike other AST nodes, this number of bailout IDs allocated for an |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 int literal_index, int pos) | 1603 int literal_index, int pos) |
| 1604 : MaterializedLiteral(literal_index, pos, kArrayLiteral), | 1604 : MaterializedLiteral(literal_index, pos, kArrayLiteral), |
| 1605 first_spread_index_(first_spread_index), | 1605 first_spread_index_(first_spread_index), |
| 1606 values_(values) {} | 1606 values_(values) {} |
| 1607 | 1607 |
| 1608 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } | 1608 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } |
| 1609 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1609 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1610 | 1610 |
| 1611 int first_spread_index_; | 1611 int first_spread_index_; |
| 1612 FeedbackVectorSlot literal_slot_; | 1612 FeedbackVectorSlot literal_slot_; |
| 1613 Handle<FixedArray> constant_elements_; | 1613 Handle<ConstantElementsPair> constant_elements_; |
| 1614 ZoneList<Expression*>* values_; | 1614 ZoneList<Expression*>* values_; |
| 1615 }; | 1615 }; |
| 1616 | 1616 |
| 1617 | 1617 |
| 1618 class VariableProxy final : public Expression { | 1618 class VariableProxy final : public Expression { |
| 1619 public: | 1619 public: |
| 1620 bool IsValidReferenceExpression() const { | 1620 bool IsValidReferenceExpression() const { |
| 1621 return !is_this() && !is_new_target(); | 1621 return !is_this() && !is_new_target(); |
| 1622 } | 1622 } |
| 1623 | 1623 |
| (...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3631 : NULL; \ | 3631 : NULL; \ |
| 3632 } | 3632 } |
| 3633 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3633 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3634 #undef DECLARE_NODE_FUNCTIONS | 3634 #undef DECLARE_NODE_FUNCTIONS |
| 3635 | 3635 |
| 3636 | 3636 |
| 3637 } // namespace internal | 3637 } // namespace internal |
| 3638 } // namespace v8 | 3638 } // namespace v8 |
| 3639 | 3639 |
| 3640 #endif // V8_AST_AST_H_ | 3640 #endif // V8_AST_AST_H_ |
| OLD | NEW |