Modified: trunk/Source/_javascript_Core/ChangeLog (105917 => 105918)
--- trunk/Source/_javascript_Core/ChangeLog 2012-01-25 20:47:34 UTC (rev 105917)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-01-25 20:52:41 UTC (rev 105918)
@@ -1,3 +1,17 @@
+2012-01-25 Yong Li <[email protected]>
+
+ [BlackBerry] Implement OSAllocator::commit/decommit.
+ BlackBerry port should support virtual memory decommiting.
+ https://bugs.webkit.org/show_bug.cgi?id=77013
+
+ Reviewed by Rob Buis.
+
+ * wtf/OSAllocatorPosix.cpp:
+ (WTF::OSAllocator::reserveUncommitted):
+ (WTF::OSAllocator::commit):
+ (WTF::OSAllocator::decommit):
+ * wtf/Platform.h:
+
2012-01-24 Oliver Hunt <[email protected]>
Make DFG update topCallFrame
Modified: trunk/Source/_javascript_Core/wtf/OSAllocatorPosix.cpp (105917 => 105918)
--- trunk/Source/_javascript_Core/wtf/OSAllocatorPosix.cpp 2012-01-25 20:47:34 UTC (rev 105917)
+++ trunk/Source/_javascript_Core/wtf/OSAllocatorPosix.cpp 2012-01-25 20:52:41 UTC (rev 105918)
@@ -37,7 +37,9 @@
void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable, bool includesGuardPages)
{
void* result = reserveAndCommit(bytes, usage, writable, executable, includesGuardPages);
-#if HAVE(MADV_FREE_REUSE)
+#if OS(QNX)
+ posix_madvise(result, bytes, POSIX_MADV_DONTNEED);
+#elif HAVE(MADV_FREE_REUSE)
// To support the "reserve then commit" model, we have to initially decommit.
while (madvise(result, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
#endif
@@ -120,7 +122,9 @@
void OSAllocator::commit(void* address, size_t bytes, bool, bool)
{
-#if HAVE(MADV_FREE_REUSE)
+#if OS(QNX)
+ posix_madvise(address, bytes, POSIX_MADV_WILLNEED);
+#elif HAVE(MADV_FREE_REUSE)
while (madvise(address, bytes, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { }
#else
// Non-MADV_FREE_REUSE reservations automatically commit on demand.
@@ -131,7 +135,9 @@
void OSAllocator::decommit(void* address, size_t bytes)
{
-#if HAVE(MADV_FREE_REUSE)
+#if OS(QNX)
+ posix_madvise(address, bytes, POSIX_MADV_DONTNEED);
+#elif HAVE(MADV_FREE_REUSE)
while (madvise(address, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
#elif HAVE(MADV_FREE)
while (madvise(address, bytes, MADV_FREE) == -1 && errno == EAGAIN) { }
Modified: trunk/Source/_javascript_Core/wtf/Platform.h (105917 => 105918)
--- trunk/Source/_javascript_Core/wtf/Platform.h 2012-01-25 20:47:34 UTC (rev 105917)
+++ trunk/Source/_javascript_Core/wtf/Platform.h 2012-01-25 20:52:41 UTC (rev 105918)
@@ -723,6 +723,8 @@
#define HAVE_ERRNO_H 1
#define HAVE_MMAP 1
+#define HAVE_MADV_FREE_REUSE 1
+#define HAVE_MADV_FREE 1
#define HAVE_SBRK 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_PARAM_H 1