1
0
MozillaThunderbird/ppc-xpcshell.patch
2013-06-06 20:24:09 +00:00

72 lines
2.1 KiB
Diff

Index: mozilla/js/src/gc/Heap.h
===================================================================
--- mozilla.orig/js/src/gc/Heap.h
+++ mozilla/js/src/gc/Heap.h
@@ -110,19 +110,22 @@ struct Cell
*/
#if defined(SOLARIS) && (defined(__sparc) || defined(__sparcv9))
const size_t PageShift = 13;
+const size_t ArenaShift = PageShift;
+#elif defined(__powerpc__)
+const size_t PageShift = 16;
+const size_t ArenaShift = 12;
#else
const size_t PageShift = 12;
+const size_t ArenaShift = PageShift;
#endif
const size_t PageSize = size_t(1) << PageShift;
+const size_t ArenaSize = size_t(1) << ArenaShift;
+const size_t ArenaMask = ArenaSize - 1;
const size_t ChunkShift = 20;
const size_t ChunkSize = size_t(1) << ChunkShift;
const size_t ChunkMask = ChunkSize - 1;
-const size_t ArenaShift = PageShift;
-const size_t ArenaSize = PageSize;
-const size_t ArenaMask = ArenaSize - 1;
-
/*
* This is the maximum number of arenas we allow in the FreeCommitted state
* before we trigger a GC_SHRINK to release free arenas to the OS.
Index: mozilla/js/src/gc/Memory.cpp
===================================================================
--- mozilla.orig/js/src/gc/Memory.cpp
+++ mozilla/js/src/gc/Memory.cpp
@@ -15,6 +15,15 @@
namespace js {
namespace gc {
+/* Unused memory decommiting requires the arena size match the page size. */
+extern const size_t PageSize;
+extern const size_t ArenaSize;
+static bool
+DecommitEnabled()
+{
+ return PageSize == ArenaSize;
+}
+
#if defined(XP_WIN)
#include "jswin.h"
#include <psapi.h>
@@ -83,6 +92,9 @@ UnmapPages(void *p, size_t size)
bool
MarkPagesUnused(void *p, size_t size)
{
+ if (!DecommitEnabled())
+ return false;
+
JS_ASSERT(uintptr_t(p) % PageSize == 0);
LPVOID p2 = VirtualAlloc(p, size, MEM_RESET, PAGE_READWRITE);
return p2 == p;
@@ -352,6 +364,9 @@ UnmapPages(void *p, size_t size)
bool
MarkPagesUnused(void *p, size_t size)
{
+ if (!DecommitEnabled())
+ return false;
+
JS_ASSERT(uintptr_t(p) % PageSize == 0);
int result = madvise(p, size, MADV_DONTNEED);
return result != -1;