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; |