Bug 639743 - JM: clean up Executable{Pool,Allocator} some more, 1/6. r=dvander.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 09 Mar 2011 19:10:41 -0800
changeset 64264 5bfe25660c9e51086a72ee2f9ac68fda624d4046
parent 64263 fdab5c480ab5afa77941bd58486967b6ff2d0ca3
child 64265 504939f68ed2ad15a8cd308ff1510c5412b5fc71
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, 1/6. r=dvander.
js/src/assembler/jit/ExecutableAllocator.h
js/src/jscompartment.cpp
js/src/methodjit/MethodJIT.cpp
--- a/js/src/assembler/jit/ExecutableAllocator.h
+++ b/js/src/assembler/jit/ExecutableAllocator.h
@@ -192,40 +192,24 @@ private:
     static void systemRelease(const Allocation& alloc);
 
     ExecutablePool(size_t n);
 };
 
 class ExecutableAllocator {
     enum ProtectionSeting { Writable, Executable };
 
-    // Initialization can fail so we use a create method instead.
-    ExecutableAllocator() {}
 public:
     static size_t pageSize;
 
-    // Returns NULL on OOM.
-    static ExecutableAllocator *create()
+    ExecutableAllocator()
     {
-        /* We can't (easily) use js_new() here because the constructor is private. */
-        void *memory = js_malloc(sizeof(ExecutableAllocator));
-        ExecutableAllocator *allocator = memory ? new(memory) ExecutableAllocator() : NULL;
-        if (!allocator)
-            return allocator;
-
         if (!pageSize)
             intializePageSize();
-        ExecutablePool *pool = ExecutablePool::create(JIT_ALLOCATOR_LARGE_ALLOC_SIZE);
-        if (!pool) {
-            js_delete(allocator);
-            return NULL;
-        }
-        JS_ASSERT(allocator->m_smallAllocationPools.empty());
-        allocator->m_smallAllocationPools.append(pool);
-        return allocator;
+        JS_ASSERT(m_smallAllocationPools.empty());
     }
 
     ~ExecutableAllocator()
     {
         for (size_t i = 0; i < m_smallAllocationPools.length(); i++)
             m_smallAllocationPools[i]->destroy();
     }
 
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -144,17 +144,17 @@ JSCompartment::init()
 #endif
 
 #ifdef JS_TRACER
     if (!InitJIT(&traceMonitor))
         return false;
 #endif
 
 #if ENABLE_YARR_JIT
-    regExpAllocator = JSC::ExecutableAllocator::create();
+    regExpAllocator = js_new<JSC::ExecutableAllocator>();
     if (!regExpAllocator)
         return false;
 #endif
 
     if (!backEdgeTable.init())
         return false;
 
 #ifdef JS_METHODJIT
--- a/js/src/methodjit/MethodJIT.cpp
+++ b/js/src/methodjit/MethodJIT.cpp
@@ -684,17 +684,17 @@ JS_STATIC_ASSERT(JSVAL_PAYLOAD_MASK == 0
 #  error "Unsupported CPU!"
 #endif
 
 #endif                   /* _MSC_VER */
 
 bool
 JaegerCompartment::Initialize()
 {
-    execAlloc_ = JSC::ExecutableAllocator::create();
+    execAlloc_ = js_new<JSC::ExecutableAllocator>();
     if (!execAlloc_)
         return false;
     
     TrampolineCompiler tc(execAlloc_, &trampolines);
     if (!tc.compile()) {
         delete execAlloc_;
         return false;
     }