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 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 ZoneList<Property*>* properties_; | 1507 ZoneList<Property*>* properties_; |
1508 int boilerplate_properties_; | 1508 int boilerplate_properties_; |
1509 bool fast_elements_; | 1509 bool fast_elements_; |
1510 bool has_elements_; | 1510 bool has_elements_; |
1511 bool may_store_doubles_; | 1511 bool may_store_doubles_; |
1512 bool has_function_; | 1512 bool has_function_; |
1513 FeedbackVectorSlot slot_; | 1513 FeedbackVectorSlot slot_; |
1514 }; | 1514 }; |
1515 | 1515 |
1516 | 1516 |
| 1517 // A map from property names to getter/setter pairs allocated in the zone. |
| 1518 class AccessorTable : public TemplateHashMap<Literal, ObjectLiteral::Accessors, |
| 1519 ZoneAllocationPolicy> { |
| 1520 public: |
| 1521 explicit AccessorTable(Zone* zone) |
| 1522 : TemplateHashMap<Literal, ObjectLiteral::Accessors, |
| 1523 ZoneAllocationPolicy>(Literal::Match, |
| 1524 ZoneAllocationPolicy(zone)), |
| 1525 zone_(zone) {} |
| 1526 |
| 1527 Iterator lookup(Literal* literal) { |
| 1528 Iterator it = find(literal, true, ZoneAllocationPolicy(zone_)); |
| 1529 if (it->second == NULL) it->second = new (zone_) ObjectLiteral::Accessors(); |
| 1530 return it; |
| 1531 } |
| 1532 |
| 1533 private: |
| 1534 Zone* zone_; |
| 1535 }; |
| 1536 |
| 1537 |
1517 // Node for capturing a regexp literal. | 1538 // Node for capturing a regexp literal. |
1518 class RegExpLiteral final : public MaterializedLiteral { | 1539 class RegExpLiteral final : public MaterializedLiteral { |
1519 public: | 1540 public: |
1520 DECLARE_NODE_TYPE(RegExpLiteral) | 1541 DECLARE_NODE_TYPE(RegExpLiteral) |
1521 | 1542 |
1522 Handle<String> pattern() const { return pattern_->string(); } | 1543 Handle<String> pattern() const { return pattern_->string(); } |
1523 Handle<String> flags() const { return flags_->string(); } | 1544 Handle<String> flags() const { return flags_->string(); } |
1524 | 1545 |
1525 protected: | 1546 protected: |
1526 RegExpLiteral(Zone* zone, const AstRawString* pattern, | 1547 RegExpLiteral(Zone* zone, const AstRawString* pattern, |
(...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3615 // the parser-level zone. | 3636 // the parser-level zone. |
3616 Zone* parser_zone_; | 3637 Zone* parser_zone_; |
3617 AstValueFactory* ast_value_factory_; | 3638 AstValueFactory* ast_value_factory_; |
3618 }; | 3639 }; |
3619 | 3640 |
3620 | 3641 |
3621 } // namespace internal | 3642 } // namespace internal |
3622 } // namespace v8 | 3643 } // namespace v8 |
3623 | 3644 |
3624 #endif // V8_AST_H_ | 3645 #endif // V8_AST_H_ |
OLD | NEW |