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 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 | 1579 |
1580 // An array literal has a literals object that is used | 1580 // An array literal has a literals object that is used |
1581 // for minimizing the work when constructing it at runtime. | 1581 // for minimizing the work when constructing it at runtime. |
1582 class ArrayLiteral FINAL : public MaterializedLiteral { | 1582 class ArrayLiteral FINAL : public MaterializedLiteral { |
1583 public: | 1583 public: |
1584 DECLARE_NODE_TYPE(ArrayLiteral) | 1584 DECLARE_NODE_TYPE(ArrayLiteral) |
1585 | 1585 |
1586 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 1586 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
1587 ZoneList<Expression*>* values() const { return values_; } | 1587 ZoneList<Expression*>* values() const { return values_; } |
1588 | 1588 |
| 1589 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } |
| 1590 |
| 1591 // Return an AST id for an element that is used in simulate instructions. |
| 1592 BailoutId GetIdForElement(int i) { return BailoutId(local_id(i + 1)); } |
| 1593 |
1589 // Unlike other AST nodes, this number of bailout IDs allocated for an | 1594 // Unlike other AST nodes, this number of bailout IDs allocated for an |
1590 // ArrayLiteral can vary, so num_ids() is not a static method. | 1595 // ArrayLiteral can vary, so num_ids() is not a static method. |
1591 int num_ids() const { return parent_num_ids() + values()->length(); } | 1596 int num_ids() const { return parent_num_ids() + 1 + values()->length(); } |
1592 | |
1593 // Return an AST id for an element that is used in simulate instructions. | |
1594 BailoutId GetIdForElement(int i) { return BailoutId(local_id(i)); } | |
1595 | 1597 |
1596 // Populate the constant elements fixed array. | 1598 // Populate the constant elements fixed array. |
1597 void BuildConstantElements(Isolate* isolate); | 1599 void BuildConstantElements(Isolate* isolate); |
1598 | 1600 |
1599 // Assemble bitfield of flags for the CreateArrayLiteral helper. | 1601 // Assemble bitfield of flags for the CreateArrayLiteral helper. |
1600 int ComputeFlags() const { | 1602 int ComputeFlags() const { |
1601 int flags = depth() == 1 ? kShallowElements : kNoFlags; | 1603 int flags = depth() == 1 ? kShallowElements : kNoFlags; |
1602 flags |= ArrayLiteral::kDisableMementos; | 1604 flags |= ArrayLiteral::kDisableMementos; |
1603 return flags; | 1605 return flags; |
1604 } | 1606 } |
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3535 | 3537 |
3536 private: | 3538 private: |
3537 Zone* zone_; | 3539 Zone* zone_; |
3538 AstValueFactory* ast_value_factory_; | 3540 AstValueFactory* ast_value_factory_; |
3539 }; | 3541 }; |
3540 | 3542 |
3541 | 3543 |
3542 } } // namespace v8::internal | 3544 } } // namespace v8::internal |
3543 | 3545 |
3544 #endif // V8_AST_H_ | 3546 #endif // V8_AST_H_ |
OLD | NEW |