Bug 609905 - reTempAlloc: 512k heap allocation for no purpose. r=nnethercote.
authorJulian Seward <jseward@acm.org>
Thu, 02 Dec 2010 22:26:24 -0800
changeset 58715 25fd3451c0ae6de4f182bd48e02768369ed08c06
parent 58714 2de8816c40884e86935ec353e656a39ce319e7a1
child 58716 582b2499287698bf722bf45b6b73a7bdd0483b6e
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersnnethercote
bugs609905
milestone2.0b8pre
Bug 609905 - reTempAlloc: 512k heap allocation for no purpose. r=nnethercote.
js/src/jscntxt.h
js/src/jstracer.cpp
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -923,17 +923,17 @@ struct TraceMonitor {
     /*
      * Cached storage to use when executing on trace. While we may enter nested
      * traces, we always reuse the outer trace's storage, so never need more
      * than of these.
      */
     TraceNativeStorage      *storage;
 
     /*
-     * There are 5 allocators here.  This might seem like overkill, but they
+     * There are 4 allocators here.  This might seem like overkill, but they
      * have different lifecycles, and by keeping them separate we keep the
      * amount of retained memory down significantly.  They are flushed (ie.
      * all the allocated memory is freed) periodically.
      *
      * - dataAlloc has the lifecycle of the monitor.  It's flushed only when
      *   the monitor is flushed.  It's used for fragments.
      *
      * - traceAlloc has the same flush lifecycle as the dataAlloc, but it is
@@ -941,29 +941,24 @@ struct TraceMonitor {
      *   if recording aborts.  So you can put things in it that are only
      *   reachable on a successful record/compile cycle like GuardRecords and
      *   SideExits.
      *
      * - tempAlloc is flushed after each recording, successful or not.  It's
      *   used to store LIR code and for all other elements in the LIR
      *   pipeline.
      *
-     * - reTempAlloc is just like tempAlloc, but is used for regexp
-     *   compilation in RegExpNativeCompiler rather than normal compilation in
-     *   TraceRecorder.
-     *
      * - codeAlloc has the same lifetime as dataAlloc, but its API is
      *   different (CodeAlloc vs. VMAllocator).  It's used for native code.
      *   It's also a good idea to keep code and data separate to avoid I-cache
      *   vs. D-cache issues.
      */
     VMAllocator*            dataAlloc;
     VMAllocator*            traceAlloc;
     VMAllocator*            tempAlloc;
-    VMAllocator*            reTempAlloc;
     nanojit::CodeAlloc*     codeAlloc;
     nanojit::Assembler*     assembler;
     FrameInfoCache*         frameCache;
 
     /* This gets incremented every time the monitor is flushed. */
     uintN                   flushEpoch;
 
     Oracle*                 oracle;
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -2731,17 +2731,16 @@ TraceMonitor::flush()
 
     flushEpoch++;
 
     frameCache->reset();
     dataAlloc->reset();
     traceAlloc->reset();
     codeAlloc->reset();
     tempAlloc->reset();
-    reTempAlloc->reset();
     oracle->clear();
     loopProfiles->clear();
 
     Allocator& alloc = *dataAlloc;
 
     for (size_t i = 0; i < MONITOR_N_GLOBAL_STATES; ++i) {
         globalStates[i].globalShape = -1;
         globalStates[i].globalSlots = new (alloc) SlotList(&alloc);
@@ -7585,17 +7584,16 @@ InitJIT(TraceMonitor *tm)
         abort();
 
     tm->flushEpoch = 0;
     
     JS_ASSERT(!tm->dataAlloc && !tm->traceAlloc && !tm->codeAlloc);
     tm->dataAlloc = new VMAllocator();
     tm->traceAlloc = new VMAllocator();
     tm->tempAlloc = new VMAllocator();
-    tm->reTempAlloc = new VMAllocator();
     tm->codeAlloc = new CodeAlloc();
     tm->frameCache = new FrameInfoCache(tm->dataAlloc);
     tm->storage = new TraceNativeStorage();
     tm->cachedTempTypeMap = new TypeMap(0);
     tm->flush();
     verbose_only( tm->branches = NULL; )
 
 #if !defined XP_WIN
@@ -7722,21 +7720,16 @@ FinishJIT(TraceMonitor *tm)
         tm->traceAlloc = NULL;
     }
 
     if (tm->tempAlloc) {
         delete tm->tempAlloc;
         tm->tempAlloc = NULL;
     }
 
-    if (tm->reTempAlloc) {
-        delete tm->reTempAlloc;
-        tm->reTempAlloc = NULL;
-    }
-
     if (tm->storage) {
         delete tm->storage;
         tm->storage = NULL;
     }
 
     delete tm->cachedTempTypeMap;
     tm->cachedTempTypeMap = NULL;
 }