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/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/ast-value-factory.h" | 9 #include "src/ast-value-factory.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 Zone* zone_; | 1558 Zone* zone_; |
1559 }; | 1559 }; |
1560 | 1560 |
1561 | 1561 |
1562 // Node for capturing a regexp literal. | 1562 // Node for capturing a regexp literal. |
1563 class RegExpLiteral final : public MaterializedLiteral { | 1563 class RegExpLiteral final : public MaterializedLiteral { |
1564 public: | 1564 public: |
1565 DECLARE_NODE_TYPE(RegExpLiteral) | 1565 DECLARE_NODE_TYPE(RegExpLiteral) |
1566 | 1566 |
1567 Handle<String> pattern() const { return pattern_->string(); } | 1567 Handle<String> pattern() const { return pattern_->string(); } |
1568 Handle<String> flags() const { return flags_->string(); } | 1568 int flags() const { return flags_; } |
1569 | 1569 |
1570 protected: | 1570 protected: |
1571 RegExpLiteral(Zone* zone, const AstRawString* pattern, | 1571 RegExpLiteral(Zone* zone, const AstRawString* pattern, int flags, |
1572 const AstRawString* flags, int literal_index, bool is_strong, | 1572 int literal_index, bool is_strong, int pos) |
1573 int pos) | |
1574 : MaterializedLiteral(zone, literal_index, is_strong, pos), | 1573 : MaterializedLiteral(zone, literal_index, is_strong, pos), |
1575 pattern_(pattern), | 1574 pattern_(pattern), |
1576 flags_(flags) { | 1575 flags_(flags) { |
1577 set_depth(1); | 1576 set_depth(1); |
1578 } | 1577 } |
1579 | 1578 |
1580 private: | 1579 private: |
1581 const AstRawString* pattern_; | 1580 const AstRawString* const pattern_; |
1582 const AstRawString* flags_; | 1581 int const flags_; |
1583 }; | 1582 }; |
1584 | 1583 |
1585 | 1584 |
1586 // An array literal has a literals object that is used | 1585 // An array literal has a literals object that is used |
1587 // for minimizing the work when constructing it at runtime. | 1586 // for minimizing the work when constructing it at runtime. |
1588 class ArrayLiteral final : public MaterializedLiteral { | 1587 class ArrayLiteral final : public MaterializedLiteral { |
1589 public: | 1588 public: |
1590 DECLARE_NODE_TYPE(ArrayLiteral) | 1589 DECLARE_NODE_TYPE(ArrayLiteral) |
1591 | 1590 |
1592 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 1591 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3431 } | 3430 } |
3432 | 3431 |
3433 ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key, | 3432 ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key, |
3434 Expression* value, | 3433 Expression* value, |
3435 bool is_static, | 3434 bool is_static, |
3436 bool is_computed_name) { | 3435 bool is_computed_name) { |
3437 return new (local_zone_) ObjectLiteral::Property( | 3436 return new (local_zone_) ObjectLiteral::Property( |
3438 ast_value_factory_, key, value, is_static, is_computed_name); | 3437 ast_value_factory_, key, value, is_static, is_computed_name); |
3439 } | 3438 } |
3440 | 3439 |
3441 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, | 3440 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, int flags, |
3442 const AstRawString* flags, | 3441 int literal_index, bool is_strong, int pos) { |
3443 int literal_index, | |
3444 bool is_strong, | |
3445 int pos) { | |
3446 return new (local_zone_) RegExpLiteral(local_zone_, pattern, flags, | 3442 return new (local_zone_) RegExpLiteral(local_zone_, pattern, flags, |
3447 literal_index, is_strong, pos); | 3443 literal_index, is_strong, pos); |
3448 } | 3444 } |
3449 | 3445 |
3450 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, | 3446 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, |
3451 int literal_index, | 3447 int literal_index, |
3452 bool is_strong, | 3448 bool is_strong, |
3453 int pos) { | 3449 int pos) { |
3454 return new (local_zone_) | 3450 return new (local_zone_) |
3455 ArrayLiteral(local_zone_, values, -1, literal_index, is_strong, pos); | 3451 ArrayLiteral(local_zone_, values, -1, literal_index, is_strong, pos); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3670 // the parser-level zone. | 3666 // the parser-level zone. |
3671 Zone* parser_zone_; | 3667 Zone* parser_zone_; |
3672 AstValueFactory* ast_value_factory_; | 3668 AstValueFactory* ast_value_factory_; |
3673 }; | 3669 }; |
3674 | 3670 |
3675 | 3671 |
3676 } // namespace internal | 3672 } // namespace internal |
3677 } // namespace v8 | 3673 } // namespace v8 |
3678 | 3674 |
3679 #endif // V8_AST_H_ | 3675 #endif // V8_AST_H_ |
OLD | NEW |