| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 #define DEF_FORWARD_DECLARATION(type) class type; | 124 #define DEF_FORWARD_DECLARATION(type) class type; |
| 125 AST_NODE_LIST(DEF_FORWARD_DECLARATION) | 125 AST_NODE_LIST(DEF_FORWARD_DECLARATION) |
| 126 #undef DEF_FORWARD_DECLARATION | 126 #undef DEF_FORWARD_DECLARATION |
| 127 | 127 |
| 128 | 128 |
| 129 class FeedbackVectorSlotCache { | 129 class FeedbackVectorSlotCache { |
| 130 public: | 130 public: |
| 131 explicit FeedbackVectorSlotCache(Zone* zone) | 131 explicit FeedbackVectorSlotCache(Zone* zone) |
| 132 : zone_(zone), | 132 : zone_(zone), |
| 133 hash_map_(base::HashMap::PointersMatch, | 133 hash_map_(ZoneHashMap::kDefaultHashMapCapacity, |
| 134 ZoneHashMap::kDefaultHashMapCapacity, | |
| 135 ZoneAllocationPolicy(zone)) {} | 134 ZoneAllocationPolicy(zone)) {} |
| 136 | 135 |
| 137 void Put(Variable* variable, FeedbackVectorSlot slot) { | 136 void Put(Variable* variable, FeedbackVectorSlot slot) { |
| 138 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert( | 137 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert( |
| 139 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); | 138 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); |
| 140 entry->value = reinterpret_cast<void*>(slot.ToInt()); | 139 entry->value = reinterpret_cast<void*>(slot.ToInt()); |
| 141 } | 140 } |
| 142 | 141 |
| 143 ZoneHashMap::Entry* Get(Variable* variable) const { | 142 ZoneHashMap::Entry* Get(Variable* variable) const { |
| 144 return hash_map_.Lookup(variable, ComputePointerHash(variable)); | 143 return hash_map_.Lookup(variable, ComputePointerHash(variable)); |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 : public BitField<bool, HasElementsField::kNext, 1> {}; | 1508 : public BitField<bool, HasElementsField::kNext, 1> {}; |
| 1510 | 1509 |
| 1511 protected: | 1510 protected: |
| 1512 static const uint8_t kNextBitFieldIndex = MayStoreDoublesField::kNext; | 1511 static const uint8_t kNextBitFieldIndex = MayStoreDoublesField::kNext; |
| 1513 }; | 1512 }; |
| 1514 | 1513 |
| 1515 | 1514 |
| 1516 // A map from property names to getter/setter pairs allocated in the zone. | 1515 // A map from property names to getter/setter pairs allocated in the zone. |
| 1517 class AccessorTable | 1516 class AccessorTable |
| 1518 : public base::TemplateHashMap<Literal, ObjectLiteral::Accessors, | 1517 : public base::TemplateHashMap<Literal, ObjectLiteral::Accessors, |
| 1518 bool (*)(void*, void*), |
| 1519 ZoneAllocationPolicy> { | 1519 ZoneAllocationPolicy> { |
| 1520 public: | 1520 public: |
| 1521 explicit AccessorTable(Zone* zone) | 1521 explicit AccessorTable(Zone* zone) |
| 1522 : base::TemplateHashMap<Literal, ObjectLiteral::Accessors, | 1522 : base::TemplateHashMap<Literal, ObjectLiteral::Accessors, |
| 1523 ZoneAllocationPolicy>(Literal::Match, | 1523 bool (*)(void*, void*), ZoneAllocationPolicy>( |
| 1524 ZoneAllocationPolicy(zone)), | 1524 Literal::Match, ZoneAllocationPolicy(zone)), |
| 1525 zone_(zone) {} | 1525 zone_(zone) {} |
| 1526 | 1526 |
| 1527 Iterator lookup(Literal* literal) { | 1527 Iterator lookup(Literal* literal) { |
| 1528 Iterator it = find(literal, true, ZoneAllocationPolicy(zone_)); | 1528 Iterator it = find(literal, true, ZoneAllocationPolicy(zone_)); |
| 1529 if (it->second == NULL) it->second = new (zone_) ObjectLiteral::Accessors(); | 1529 if (it->second == NULL) it->second = new (zone_) ObjectLiteral::Accessors(); |
| 1530 return it; | 1530 return it; |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 private: | 1533 private: |
| 1534 Zone* zone_; | 1534 Zone* zone_; |
| (...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3609 : NULL; \ | 3609 : NULL; \ |
| 3610 } | 3610 } |
| 3611 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3611 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3612 #undef DECLARE_NODE_FUNCTIONS | 3612 #undef DECLARE_NODE_FUNCTIONS |
| 3613 | 3613 |
| 3614 | 3614 |
| 3615 } // namespace internal | 3615 } // namespace internal |
| 3616 } // namespace v8 | 3616 } // namespace v8 |
| 3617 | 3617 |
| 3618 #endif // V8_AST_AST_H_ | 3618 #endif // V8_AST_AST_H_ |
| OLD | NEW |