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

Unified Diff: src/scopes.cc

Issue 9455088: Remove static initializers in v8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Lint. Created 8 years, 10 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
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index 9835108751a14c564a12caba8eb9bac92a1ee75a..f06e663c29c4e5fe6410a4cb4ef366bccf6f0be4 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -31,6 +31,7 @@
#include "bootstrapper.h"
#include "compiler.h"
+#include "lazy-instance.h"
#include "messages.h"
#include "scopeinfo.h"
@@ -56,7 +57,14 @@ class ZoneAllocator: public Allocator {
};
-static ZoneAllocator* LocalsMapAllocator = ::new ZoneAllocator();
+struct CreateZoneAllocator {
+ static ZoneAllocator* Create() {
+ return ::new ZoneAllocator();
+ }
+};
+
+static LazyDynamicInstance<ZoneAllocator, CreateZoneAllocator>::type
+ LocalsMapAllocator = LAZY_DYNAMIC_INSTANCE_INITIALIZER;
// ----------------------------------------------------------------------------
@@ -77,7 +85,7 @@ static bool Match(void* key1, void* key2) {
}
-VariableMap::VariableMap() : HashMap(Match, LocalsMapAllocator, 8) {}
+VariableMap::VariableMap() : HashMap(Match, LocalsMapAllocator.Pointer(), 8) {}
fschneider 2012/02/28 16:54:48 Not needed anymore because HashMap is already refa
VariableMap::~VariableMap() {}

Powered by Google App Engine
This is Rietveld 408576698