Index: src/platform.h |
diff --git a/src/platform.h b/src/platform.h |
index 4c7dc3f34b91a1673cbbf848872ffb828f091f50..7d857cc0dfd8042a91dfd11c461edce3c80885e7 100644 |
--- a/src/platform.h |
+++ b/src/platform.h |
@@ -139,6 +139,10 @@ class TimezoneCache; |
class OS { |
public: |
+ // 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 |
@@ -291,6 +295,86 @@ class OS { |
// the platform doesn't care. Guaranteed to be a power of two. |
static int ActivationFrameAlignment(); |
+#if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X87) |
+ // Limit below which the extra overhead of the MemCopy function is likely |
+ // to outweigh the benefits of faster copying. |
+ static const int kMinComplexMemCopy = 64; |
+ |
+ // Copy memory area. No restrictions. |
+ static void MemMove(void* dest, const void* src, size_t size); |
+ typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size); |
+ |
+ // Keep the distinction of "move" vs. "copy" for the benefit of other |
+ // architectures. |
+ static void MemCopy(void* dest, const void* src, size_t size) { |
+ MemMove(dest, src, size); |
+ } |
+#elif defined(V8_HOST_ARCH_ARM) |
+ typedef void (*MemCopyUint8Function)(uint8_t* dest, |
+ const uint8_t* src, |
+ size_t size); |
+ static MemCopyUint8Function memcopy_uint8_function; |
+ static void MemCopyUint8Wrapper(uint8_t* dest, |
+ const uint8_t* src, |
+ size_t chars) { |
+ memcpy(dest, src, chars); |
+ } |
+ // For values < 16, the assembler function is slower than the inlined C code. |
+ static const int kMinComplexMemCopy = 16; |
+ static void MemCopy(void* dest, const void* src, size_t size) { |
+ (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest), |
+ reinterpret_cast<const uint8_t*>(src), |
+ size); |
+ } |
+ static void MemMove(void* dest, const void* src, size_t size) { |
+ memmove(dest, src, size); |
+ } |
+ |
+ typedef void (*MemCopyUint16Uint8Function)(uint16_t* dest, |
+ const uint8_t* src, |
+ size_t size); |
+ static MemCopyUint16Uint8Function memcopy_uint16_uint8_function; |
+ static void MemCopyUint16Uint8Wrapper(uint16_t* dest, |
+ const uint8_t* src, |
+ size_t chars); |
+ // For values < 12, the assembler function is slower than the inlined C code. |
+ static const int kMinComplexConvertMemCopy = 12; |
+ static void MemCopyUint16Uint8(uint16_t* dest, |
+ const uint8_t* src, |
+ size_t size) { |
+ (*memcopy_uint16_uint8_function)(dest, src, size); |
+ } |
+#elif defined(V8_HOST_ARCH_MIPS) |
+ typedef void (*MemCopyUint8Function)(uint8_t* dest, |
+ const uint8_t* src, |
+ size_t size); |
+ static MemCopyUint8Function memcopy_uint8_function; |
+ static void MemCopyUint8Wrapper(uint8_t* dest, |
+ const uint8_t* src, |
+ size_t chars) { |
+ memcpy(dest, src, chars); |
+ } |
+ // For values < 16, the assembler function is slower than the inlined C code. |
+ static const int kMinComplexMemCopy = 16; |
+ static void MemCopy(void* dest, const void* src, size_t size) { |
+ (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest), |
+ reinterpret_cast<const uint8_t*>(src), |
+ size); |
+ } |
+ static void MemMove(void* dest, const void* src, size_t size) { |
+ memmove(dest, src, size); |
+ } |
+#else |
+ // Copy memory area to disjoint memory area. |
+ static void MemCopy(void* dest, const void* src, size_t size) { |
+ memcpy(dest, src, size); |
+ } |
+ static void MemMove(void* dest, const void* src, size_t size) { |
+ memmove(dest, src, size); |
+ } |
+ static const int kMinComplexMemCopy = 16 * kPointerSize; |
+#endif // V8_TARGET_ARCH_IA32 |
+ |
static int GetCurrentProcessId(); |
private: |