Bug 639743 - JM: clean up Executable{Pool,Allocator} some more, 4/6. r=dvander.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 09 Mar 2011 19:12:26 -0800
changeset 64267 5a256e0cd7b6dd23a79c16fe880a963e39f9e402
parent 64266 03151dfd666386d4bc9761d8e9b1401fc8d6bb9f
child 64268 7c1b798a25fd891558bee582196b1340010537f5
push id19328
push usercleary@mozilla.com
push dateTue, 29 Mar 2011 21:56:11 +0000
treeherdermozilla-central@3d0784802ce6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs639743
milestone2.0b13pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 639743 - JM: clean up Executable{Pool,Allocator} some more, 4/6. r=dvander.
js/src/assembler/jit/ExecutableAllocator.h
js/src/assembler/jit/ExecutableAllocatorOS2.cpp
js/src/assembler/jit/ExecutableAllocatorPosix.cpp
js/src/assembler/jit/ExecutableAllocatorSymbian.cpp
js/src/assembler/jit/ExecutableAllocatorWin.cpp
--- a/js/src/assembler/jit/ExecutableAllocator.h
+++ b/js/src/assembler/jit/ExecutableAllocator.h
@@ -163,17 +163,17 @@ class ExecutableAllocator {
     enum ProtectionSeting { Writable, Executable };
 
 public:
     static size_t pageSize;
 
     ExecutableAllocator()
     {
         if (!pageSize)
-            intializePageSize();
+            pageSize = determinePageSize();
         JS_ASSERT(m_smallAllocationPools.empty());
     }
 
     ~ExecutableAllocator()
     {
         for (size_t i = 0; i < m_smallAllocationPools.length(); i++)
             m_smallAllocationPools[i]->destroy();
     }
@@ -405,16 +405,16 @@ private:
 
 #if ENABLE_ASSEMBLER_WX_EXCLUSIVE
     static void reprotectRegion(void*, size_t, ProtectionSeting);
 #endif
 
     static const size_t maxSmallPools = 4;
     typedef js::Vector<ExecutablePool *, maxSmallPools, js::SystemAllocPolicy > SmallExecPoolVector;
     SmallExecPoolVector m_smallAllocationPools;
-    static void intializePageSize();
+    static size_t determinePageSize();
 };
 
 }
 
 #endif // ENABLE(ASSEMBLER)
 
 #endif // !defined(ExecutableAllocator)
--- a/js/src/assembler/jit/ExecutableAllocatorOS2.cpp
+++ b/js/src/assembler/jit/ExecutableAllocatorOS2.cpp
@@ -28,19 +28,19 @@
 
 #if ENABLE_ASSEMBLER && WTF_PLATFORM_OS2
 
 #define INCL_DOS
 #include <os2.h>
 
 namespace JSC {
 
-void ExecutableAllocator::intializePageSize()
+size_t ExecutableAllocator::determinePageSize()
 {
-    ExecutableAllocator::pageSize = 4096u;
+    return 4096u;
 }
 
 ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
 {
     void* allocation = NULL;
     if (DosAllocMem(&allocation, n, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) &&
         DosAllocMem(&allocation, n, PAG_COMMIT|PAG_READ|PAG_WRITE))
         CRASH();
--- a/js/src/assembler/jit/ExecutableAllocatorPosix.cpp
+++ b/js/src/assembler/jit/ExecutableAllocatorPosix.cpp
@@ -28,19 +28,19 @@
 #if ENABLE_ASSEMBLER && WTF_PLATFORM_UNIX && !WTF_PLATFORM_SYMBIAN
 
 #include <sys/mman.h>
 #include <unistd.h>
 #include <wtf/VMTags.h>
 
 namespace JSC {
 
-void ExecutableAllocator::intializePageSize()
+size_t ExecutableAllocator::determinePageSize()
 {
-    ExecutableAllocator::pageSize = getpagesize();
+    return getpagesize();
 }
 
 ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
 {
     void* allocation = mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0);
     if (allocation == MAP_FAILED)
         allocation = NULL;
     ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(allocation), n };
--- a/js/src/assembler/jit/ExecutableAllocatorSymbian.cpp
+++ b/js/src/assembler/jit/ExecutableAllocatorSymbian.cpp
@@ -27,28 +27,28 @@
 #include <e32hal.h>
 #include <e32std.h>
 
 // Set the page size to 256 Kb to compensate for moving memory model limitation
 const size_t MOVING_MEM_PAGE_SIZE = 256 * 1024; 
 
 namespace JSC {
 
-void ExecutableAllocator::intializePageSize()
+size_t ExecutableAllocator::determinePageSize()
 {
 #if WTF_CPU_ARMV5_OR_LOWER
     // The moving memory model (as used in ARMv5 and earlier platforms)
     // on Symbian OS limits the number of chunks for each process to 16. 
     // To mitigate this limitation increase the pagesize to 
     // allocate less of larger chunks.
-    ExecutableAllocator::pageSize = MOVING_MEM_PAGE_SIZE;
+    return MOVING_MEM_PAGE_SIZE;
 #else
     TInt page_size;
     UserHal::PageSizeInBytes(page_size);
-    ExecutableAllocator::pageSize = page_size;
+    return page_size;
 #endif
 }
 
 ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
 {
     RChunk* codeChunk = new RChunk();
 
     TInt errorCode = codeChunk->CreateLocalCode(n, n);
--- a/js/src/assembler/jit/ExecutableAllocatorWin.cpp
+++ b/js/src/assembler/jit/ExecutableAllocatorWin.cpp
@@ -27,21 +27,21 @@
 #include "ExecutableAllocator.h"
 
 #if ENABLE_ASSEMBLER && WTF_PLATFORM_WIN_OS
 
 #include "jswin.h"
 
 namespace JSC {
 
-void ExecutableAllocator::intializePageSize()
+size_t ExecutableAllocator::determinePageSize()
 {
     SYSTEM_INFO system_info;
     GetSystemInfo(&system_info);
-    ExecutableAllocator::pageSize = system_info.dwPageSize;
+    return system_info.dwPageSize;
 }
 
 ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
 {
     void *allocation = VirtualAlloc(0, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
     ExecutablePool::Allocation alloc = {reinterpret_cast<char*>(allocation), n};
     return alloc;
 }