Version 3.9.15
Fix the heap profiler crash caused by memory layout changes between passes.
Fix Error.prototype.toString to throw TypeError. (issue 1980)
Fix double-rounding in strtod for MinGW. (issue 1062)
Fix corrupted snapshot serializaton on ia32. (Chromium issue v8/1985)
Performance and stability improvements on all platforms.
git-svn-id: http://v8.googlecode.com/svn/trunk@10930 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/platform-posix.cc b/src/platform-posix.cc
index 34fd5c4..4543a66 100644
--- a/src/platform-posix.cc
+++ b/src/platform-posix.cc
@@ -53,6 +53,7 @@
#include "v8.h"
+#include "codegen.h"
#include "platform.h"
namespace v8 {
@@ -126,6 +127,29 @@
}
+static Mutex* transcendental_function_mutex = OS::CreateMutex();
+
+#define TRANSCENDENTAL_FUNCTION(name, type) \
+static TranscendentalFunction fast_##name##_function = NULL; \
+double fast_##name(double x) { \
+ if (fast_##name##_function == NULL) { \
+ ScopedLock lock(transcendental_function_mutex); \
+ TranscendentalFunction temp = \
+ CreateTranscendentalFunction(type); \
+ MemoryBarrier(); \
+ fast_##name##_function = temp; \
+ } \
+ return (*fast_##name##_function)(x); \
+}
+
+TRANSCENDENTAL_FUNCTION(sin, TranscendentalCache::SIN)
+TRANSCENDENTAL_FUNCTION(cos, TranscendentalCache::COS)
+TRANSCENDENTAL_FUNCTION(tan, TranscendentalCache::TAN)
+TRANSCENDENTAL_FUNCTION(log, TranscendentalCache::LOG)
+
+#undef TRANSCENDENTAL_FUNCTION
+
+
double OS::nan_value() {
// NAN from math.h is defined in C99 and not in POSIX.
return NAN;