From a2e914538f651aab9638512a327a31718a8da53e Mon Sep 17 00:00:00 2001
From: Joerg Bornemann <joerg.bornemann@nokia.com>
Date: Fri, 18 Sep 2009 14:01:38 +0200
Subject: QtWebKit Windows CE compile fix

There is no _aligned_alloc or _aligned_free on Windows CE.
We just use the Windows code that was there before and use VirtualAlloc.
But that also means that the BLOCK_SIZE must be 64K as this function
allocates on 64K boundaries.

Reviewed-by: Simon Hausmann
---
 src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp | 4 ++++
 src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h   | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp
index 9fac2e3..c02744c 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp
@@ -252,6 +252,8 @@ NEVER_INLINE CollectorBlock* Heap::allocateBlock()
     uintptr_t address = reinterpret_cast<uintptr_t>(mask);
 
     memset(reinterpret_cast<void*>(address), 0, BLOCK_SIZE);
+#elif PLATFORM(WINCE)
+    void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
 #elif PLATFORM(WIN_OS)
 #if COMPILER(MINGW)
     void* address = __mingw_aligned_malloc(BLOCK_SIZE, BLOCK_SIZE);
@@ -334,6 +336,8 @@ NEVER_INLINE void Heap::freeBlock(CollectorBlock* block)
     vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(block), BLOCK_SIZE);
 #elif PLATFORM(SYMBIAN)
     userChunk->Free(reinterpret_cast<TAny*>(block));
+#elif PLATFORM(WINCE)
+    VirtualFree(block, 0, MEM_RELEASE);
 #elif PLATFORM(WIN_OS)
 #if COMPILER(MINGW)
     __mingw_aligned_free(block);
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h
index 2dc3264..1a55bb5 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h
@@ -181,7 +181,11 @@ namespace JSC {
 #endif
     template<> struct CellSize<sizeof(uint64_t)> { static const size_t m_value = 64; };
 
+#if PLATFORM(WINCE)
+    const size_t BLOCK_SIZE = 64 * 1024; // 64k
+#else
     const size_t BLOCK_SIZE = 64 * 4096; // 256k
+#endif
 
     // derived constants
     const size_t BLOCK_OFFSET_MASK = BLOCK_SIZE - 1;
-- 
cgit v0.12