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

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

Issue 2010243003: Move hashmap into base/. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 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/arm64/simulator-arm64.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/assembler.h" 8 #include "src/assembler.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 #define DECLARE_NODE_TYPE(type) \ 123 #define DECLARE_NODE_TYPE(type) \
124 void Accept(AstVisitor* v) override; \ 124 void Accept(AstVisitor* v) override; \
125 AstNode::NodeType node_type() const final { return AstNode::k##type; } \ 125 AstNode::NodeType node_type() const final { return AstNode::k##type; } \
126 friend class AstNodeFactory; 126 friend class AstNodeFactory;
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_(HashMap::PointersMatch, ZoneHashMap::kDefaultHashMapCapacity, 133 hash_map_(base::HashMap::PointersMatch,
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 = hash_map_.LookupOrInsert( 138 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert(
138 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); 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));
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 ZoneList<Property*>* properties_; 1545 ZoneList<Property*>* properties_;
1545 int boilerplate_properties_; 1546 int boilerplate_properties_;
1546 bool fast_elements_; 1547 bool fast_elements_;
1547 bool has_elements_; 1548 bool has_elements_;
1548 bool may_store_doubles_; 1549 bool may_store_doubles_;
1549 FeedbackVectorSlot slot_; 1550 FeedbackVectorSlot slot_;
1550 }; 1551 };
1551 1552
1552 1553
1553 // A map from property names to getter/setter pairs allocated in the zone. 1554 // A map from property names to getter/setter pairs allocated in the zone.
1554 class AccessorTable : public TemplateHashMap<Literal, ObjectLiteral::Accessors, 1555 class AccessorTable
1555 ZoneAllocationPolicy> { 1556 : public base::TemplateHashMap<Literal, ObjectLiteral::Accessors,
1557 ZoneAllocationPolicy> {
1556 public: 1558 public:
1557 explicit AccessorTable(Zone* zone) 1559 explicit AccessorTable(Zone* zone)
1558 : TemplateHashMap<Literal, ObjectLiteral::Accessors, 1560 : base::TemplateHashMap<Literal, ObjectLiteral::Accessors,
1559 ZoneAllocationPolicy>(Literal::Match, 1561 ZoneAllocationPolicy>(Literal::Match,
1560 ZoneAllocationPolicy(zone)), 1562 ZoneAllocationPolicy(zone)),
1561 zone_(zone) {} 1563 zone_(zone) {}
1562 1564
1563 Iterator lookup(Literal* literal) { 1565 Iterator lookup(Literal* literal) {
1564 Iterator it = find(literal, true, ZoneAllocationPolicy(zone_)); 1566 Iterator it = find(literal, true, ZoneAllocationPolicy(zone_));
1565 if (it->second == NULL) it->second = new (zone_) ObjectLiteral::Accessors(); 1567 if (it->second == NULL) it->second = new (zone_) ObjectLiteral::Accessors();
1566 return it; 1568 return it;
1567 } 1569 }
1568 1570
1569 private: 1571 private:
1570 Zone* zone_; 1572 Zone* zone_;
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after
3577 : NULL; \ 3579 : NULL; \
3578 } 3580 }
3579 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3581 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3580 #undef DECLARE_NODE_FUNCTIONS 3582 #undef DECLARE_NODE_FUNCTIONS
3581 3583
3582 3584
3583 } // namespace internal 3585 } // namespace internal
3584 } // namespace v8 3586 } // namespace v8
3585 3587
3586 #endif // V8_AST_AST_H_ 3588 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « src/arm64/simulator-arm64.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698