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

Unified Diff: src/platform.h

Issue 9873023: Fix performance regressions due to lazy initialization. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make init traits non-template structs. Created 8 years, 9 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/lazy-instance.h ('k') | src/platform-cygwin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform.h
diff --git a/src/platform.h b/src/platform.h
index 4ec6057c5df01d563e39d3b8a07457d5bc8e8d96..3b2aa3c8bafdf7c2a11ce1190769ef9eeac168b6 100644
--- a/src/platform.h
+++ b/src/platform.h
@@ -119,6 +119,10 @@ class OS {
// Initializes the platform OS support. Called once at VM startup.
static void SetUp();
+ // Initializes the platform OS support that depend on CPU features. This is
+ // called after CPU initialization.
+ static void PostSetUp();
+
// Returns the accumulated user time for thread. This routine
// can be used for profiling. The implementation should
// strive for high-precision timer resolution, preferable
@@ -545,7 +549,8 @@ struct CreateMutexTrait {
// // Do something.
// }
//
-typedef LazyDynamicInstance<Mutex, CreateMutexTrait>::type LazyMutex;
+typedef LazyDynamicInstance<
+ Mutex, CreateMutexTrait, ThreadSafeInitOnceTrait>::type LazyMutex;
#define LAZY_MUTEX_INITIALIZER LAZY_DYNAMIC_INSTANCE_INITIALIZER
@@ -616,7 +621,8 @@ struct CreateSemaphoreTrait {
template <int InitialValue>
struct LazySemaphore {
typedef typename LazyDynamicInstance<
- Semaphore, CreateSemaphoreTrait<InitialValue> >::type type;
+ Semaphore, CreateSemaphoreTrait<InitialValue>,
+ ThreadSafeInitOnceTrait>::type type;
};
#define LAZY_SEMAPHORE_INITIALIZER LAZY_DYNAMIC_INSTANCE_INITIALIZER
« no previous file with comments | « src/lazy-instance.h ('k') | src/platform-cygwin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698