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

Unified Diff: src/platform-win32.cc

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/platform-solaris.cc ('k') | src/v8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index 12cd610a3420c834d98efeea59f41ed59ebdbf33..198bbb3f7b586eab00ca981e540fdf1b96d1c278 100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -167,7 +167,6 @@ void OS::MemCopy(void* dest, const void* src, size_t size) {
#ifdef _WIN64
typedef double (*ModuloFunction)(double, double);
static ModuloFunction modulo_function = NULL;
-V8_DECLARE_ONCE(modulo_function_init_once);
// Defined in codegen-x64.cc.
ModuloFunction CreateModuloFunction();
@@ -176,7 +175,6 @@ void init_modulo_function() {
}
double modulo(double x, double y) {
- CallOnce(&modulo_function_init_once, &init_modulo_function);
// Note: here we rely on dependent reads being ordered. This is true
// on all architectures we currently support.
return (*modulo_function)(x, y);
@@ -199,13 +197,10 @@ double modulo(double x, double y) {
#define UNARY_MATH_FUNCTION(name, generator) \
static UnaryMathFunction fast_##name##_function = NULL; \
-V8_DECLARE_ONCE(fast_##name##_init_once); \
void init_fast_##name##_function() { \
fast_##name##_function = generator; \
} \
double fast_##name(double x) { \
- CallOnce(&fast_##name##_init_once, \
- &init_fast_##name##_function); \
return (*fast_##name##_function)(x); \
}
@@ -218,6 +213,16 @@ UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction())
#undef MATH_FUNCTION
+void MathSetup() {
+ init_modulo_function();
+ init_fast_sin_function();
+ init_fast_cos_function();
+ init_fast_tan_function();
+ init_fast_log_function();
+ init_fast_sqrt_function();
+}
+
+
// ----------------------------------------------------------------------------
// The Time class represents time on win32. A timestamp is represented as
// a 64-bit integer in 100 nanoseconds since January 1, 1601 (UTC). JavaScript
@@ -568,6 +573,13 @@ void OS::SetUp() {
}
+void OS::PostSetUp() {
+ // Math functions depend on CPU features therefore they are initialized after
+ // CPU.
+ MathSetup();
+}
+
+
// Returns the accumulated user time for thread.
int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) {
FILETIME dummy;
« no previous file with comments | « src/platform-solaris.cc ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698