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

Unified Diff: src/ast/scopes.cc

Issue 2345233003: [base] Move hashmap allocator to a field (Closed)
Patch Set: Remove zone arguments where the parameters were removed so that the bloody thing compiles again Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/scopes.h ('k') | src/base/hashmap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index d45b02091cd805d1b0e5ec8fad07f651cac2ca7b..e274d8964733063b099df1a694a802e4fc112cdb 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -36,9 +36,8 @@ Variable* VariableMap::Declare(Zone* zone, Scope* scope,
// AstRawStrings are unambiguous, i.e., the same string is always represented
// by the same AstRawString*.
// FIXME(marja): fix the type of Lookup.
- Entry* p =
- ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name), name->hash(),
- ZoneAllocationPolicy(zone));
+ Entry* p = ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name),
+ name->hash());
if (added) *added = p->value == nullptr;
if (p->value == nullptr) {
// The variable has not been declared yet -> insert it.
@@ -54,11 +53,10 @@ void VariableMap::Remove(Variable* var) {
ZoneHashMap::Remove(const_cast<AstRawString*>(name), name->hash());
}
-void VariableMap::Add(Zone* zone, Variable* var) {
+void VariableMap::Add(Variable* var) {
const AstRawString* name = var->raw_name();
- Entry* p =
- ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name), name->hash(),
- ZoneAllocationPolicy(zone));
+ Entry* p = ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name),
+ name->hash());
DCHECK_NULL(p->value);
DCHECK_EQ(name, p->key);
p->value = var;
@@ -77,13 +75,12 @@ Variable* VariableMap::Lookup(const AstRawString* name) {
SloppyBlockFunctionMap::SloppyBlockFunctionMap(Zone* zone)
: ZoneHashMap(ZoneHashMap::PointersMatch, 8, ZoneAllocationPolicy(zone)) {}
-void SloppyBlockFunctionMap::Declare(Zone* zone, const AstRawString* name,
+void SloppyBlockFunctionMap::Declare(const AstRawString* name,
SloppyBlockFunctionStatement* stmt) {
// AstRawStrings are unambiguous, i.e., the same string is always represented
// by the same AstRawString*.
- Entry* p =
- ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name), name->hash(),
- ZoneAllocationPolicy(zone));
+ Entry* p = ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name),
+ name->hash());
stmt->set_next(static_cast<SloppyBlockFunctionStatement*>(p->value));
p->value = stmt;
}
@@ -694,7 +691,7 @@ void Scope::Snapshot::Reparent(DeclarationScope* new_parent) const {
new_parent->AddLocal(local);
if (local->mode() == VAR) {
outer_closure->variables_.Remove(local);
- new_parent->variables_.Add(new_parent->zone(), local);
+ new_parent->variables_.Add(local);
}
}
outer_closure->locals_.Rewind(top_local_);
« no previous file with comments | « src/ast/scopes.h ('k') | src/base/hashmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698