Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: src/ast/ast.h

Issue 2369963002: [base] Remove PointersMatch, making a separate std::equals hashmap (Closed)
Patch Set: Fix the other simulators Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after
3601 : NULL; \ 3601 : NULL; \
3602 } 3602 }
3603 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3603 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3604 #undef DECLARE_NODE_FUNCTIONS 3604 #undef DECLARE_NODE_FUNCTIONS
3605 3605
3606 3606
3607 } // namespace internal 3607 } // namespace internal
3608 } // namespace v8 3608 } // namespace v8
3609 3609
3610 #endif // V8_AST_AST_H_ 3610 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698