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

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

Issue 2351393003: [base] Revert "Move hashmap allocator to a field" (Closed)
Patch Set: Whoops, patch sets should build 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 class TypeFeedbackOracle; 122 class TypeFeedbackOracle;
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 : hash_map_(base::HashMap::PointersMatch, 132 : zone_(zone),
133 hash_map_(base::HashMap::PointersMatch,
133 ZoneHashMap::kDefaultHashMapCapacity, 134 ZoneHashMap::kDefaultHashMapCapacity,
134 ZoneAllocationPolicy(zone)) {} 135 ZoneAllocationPolicy(zone)) {}
135 136
136 void Put(Variable* variable, FeedbackVectorSlot slot) { 137 void Put(Variable* variable, FeedbackVectorSlot slot) {
137 ZoneHashMap::Entry* entry = 138 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert(
138 hash_map_.LookupOrInsert(variable, ComputePointerHash(variable)); 139 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_));
139 entry->value = reinterpret_cast<void*>(slot.ToInt()); 140 entry->value = reinterpret_cast<void*>(slot.ToInt());
140 } 141 }
141 142
142 ZoneHashMap::Entry* Get(Variable* variable) const { 143 ZoneHashMap::Entry* Get(Variable* variable) const {
143 return hash_map_.Lookup(variable, ComputePointerHash(variable)); 144 return hash_map_.Lookup(variable, ComputePointerHash(variable));
144 } 145 }
145 146
146 private: 147 private:
148 Zone* zone_;
147 ZoneHashMap hash_map_; 149 ZoneHashMap hash_map_;
148 }; 150 };
149 151
150 152
151 class AstProperties final BASE_EMBEDDED { 153 class AstProperties final BASE_EMBEDDED {
152 public: 154 public:
153 enum Flag { 155 enum Flag {
154 kNoFlags = 0, 156 kNoFlags = 0,
155 kDontSelfOptimize = 1 << 0, 157 kDontSelfOptimize = 1 << 0,
156 kDontCrankshaft = 1 << 1 158 kDontCrankshaft = 1 << 1
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 : public base::TemplateHashMap<Literal, ObjectLiteral::Accessors, 1518 : public base::TemplateHashMap<Literal, ObjectLiteral::Accessors,
1517 ZoneAllocationPolicy> { 1519 ZoneAllocationPolicy> {
1518 public: 1520 public:
1519 explicit AccessorTable(Zone* zone) 1521 explicit AccessorTable(Zone* zone)
1520 : base::TemplateHashMap<Literal, ObjectLiteral::Accessors, 1522 : base::TemplateHashMap<Literal, ObjectLiteral::Accessors,
1521 ZoneAllocationPolicy>(Literal::Match, 1523 ZoneAllocationPolicy>(Literal::Match,
1522 ZoneAllocationPolicy(zone)), 1524 ZoneAllocationPolicy(zone)),
1523 zone_(zone) {} 1525 zone_(zone) {}
1524 1526
1525 Iterator lookup(Literal* literal) { 1527 Iterator lookup(Literal* literal) {
1526 Iterator it = find(literal, true); 1528 Iterator it = find(literal, true, ZoneAllocationPolicy(zone_));
1527 if (it->second == NULL) it->second = new (zone_) ObjectLiteral::Accessors(); 1529 if (it->second == NULL) it->second = new (zone_) ObjectLiteral::Accessors();
1528 return it; 1530 return it;
1529 } 1531 }
1530 1532
1531 private: 1533 private:
1532 Zone* zone_; 1534 Zone* zone_;
1533 }; 1535 };
1534 1536
1535 1537
1536 // Node for capturing a regexp literal. 1538 // Node for capturing a regexp literal.
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
3607 : NULL; \ 3609 : NULL; \
3608 } 3610 }
3609 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3611 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3610 #undef DECLARE_NODE_FUNCTIONS 3612 #undef DECLARE_NODE_FUNCTIONS
3611 3613
3612 3614
3613 } // namespace internal 3615 } // namespace internal
3614 } // namespace v8 3616 } // namespace v8
3615 3617
3616 #endif // V8_AST_AST_H_ 3618 #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