Ignore:
Timestamp:
Feb 4, 2011, 4:20:16 PM (15 years ago)
Author:
[email protected]
Message:

2011-02-04 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.

Rolled back in r77612 with ASSERT/crash fixed.
https://bugs.webkit.org/show_bug.cgi?id=53759


Don't shrink the heap to 0 unconditionally. Instead, shrink to 1 if
necessary. For now, the heap assumes that it always has at least one
block live.

  • runtime/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::reset):
  • runtime/Heap.h:
  • runtime/MarkedSpace.cpp: (JSC::MarkedSpace::allocate): (JSC::MarkedSpace::shrinkBlocks): (JSC::MarkedSpace::sweep): (JSC::MarkedSpace::reset):
  • runtime/MarkedSpace.h: (JSC::MarkedSpace::highWaterMark): (JSC::MarkedSpace::setHighWaterMark):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Heap.cpp

    r77619 r77699  
    3333#include "JSONObject.h"
    3434#include "Tracing.h"
     35#include <algorithm>
    3536
    3637#define COLLECT_ON_EVERY_ALLOCATION 0
    3738
     39using namespace std;
     40
    3841namespace JSC {
    3942
     43const size_t minBytesPerCycle = 512 * 1024;
     44
    4045Heap::Heap(JSGlobalData* globalData)
    41     : m_markedSpace(globalData)
    42     , m_operationInProgress(NoOperation)
     46    : m_operationInProgress(NoOperation)
     47    , m_markedSpace(globalData)
    4348    , m_markListSet(0)
    4449    , m_activityCallback(DefaultGCActivityCallback::create(this))
     
    382387        m_markedSpace.sweep();
    383388
     389    size_t usedCellCount = m_markedSpace.markedCells();
     390    size_t proportionalBytes = static_cast<size_t>(usedCellCount * 1.5 * HeapConstants::cellSize);
     391    m_markedSpace.setHighWaterMark(max(proportionalBytes, minBytesPerCycle));
     392
    384393    JAVASCRIPTCORE_GC_END();
    385394
Note: See TracChangeset for help on using the changeset viewer.