Index: src/scopes.cc |
diff --git a/src/scopes.cc b/src/scopes.cc |
index 963d539afb96e664e8b2f063a14f7e85ee03048f..ba7a9698e61cd55e47341ba38d5cbfd4ec6d9526 100644 |
--- a/src/scopes.cc |
+++ b/src/scopes.cc |
@@ -66,6 +66,28 @@ Variable* VariableMap::Lookup(const AstRawString* name) { |
} |
+SloppyBlockFunctionMap::SloppyBlockFunctionMap(Zone* zone) |
+ : ZoneHashMap(ZoneHashMap::PointersMatch, 8, ZoneAllocationPolicy(zone)), |
+ zone_(zone) {} |
+SloppyBlockFunctionMap::~SloppyBlockFunctionMap() {} |
+ |
+ |
+void SloppyBlockFunctionMap::Declare(const AstRawString* name, |
+ DelegateStatement* 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_)); |
+ if (p->value == nullptr) { |
+ p->value = new (zone_->New(sizeof(DelegateVector))) DelegateVector(zone_); |
+ } |
+ ZoneVector<DelegateStatement*>* delegates = |
+ static_cast<DelegateVector*>(p->value); |
+ delegates->push_back(stmt); |
+} |
+ |
+ |
// ---------------------------------------------------------------------------- |
// Implementation of Scope |
@@ -79,6 +101,7 @@ Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type, |
decls_(4, zone), |
module_descriptor_( |
scope_type == MODULE_SCOPE ? ModuleDescriptor::New(zone) : NULL), |
+ sloppy_block_function_map_(zone), |
already_resolved_(false), |
ast_value_factory_(ast_value_factory), |
zone_(zone), |
@@ -100,6 +123,7 @@ Scope::Scope(Zone* zone, Scope* inner_scope, ScopeType scope_type, |
unresolved_(16, zone), |
decls_(4, zone), |
module_descriptor_(NULL), |
+ sloppy_block_function_map_(zone), |
already_resolved_(true), |
ast_value_factory_(value_factory), |
zone_(zone), |
@@ -125,6 +149,7 @@ Scope::Scope(Zone* zone, Scope* inner_scope, |
unresolved_(0, zone), |
decls_(0, zone), |
module_descriptor_(NULL), |
+ sloppy_block_function_map_(zone), |
already_resolved_(true), |
ast_value_factory_(value_factory), |
zone_(zone), |