Ignore:
Timestamp:
Feb 3, 2011, 11:41:33 PM (14 years ago)
Author:
[email protected]
Message:

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

Reviewed by Cameron Zwarich.

Changed MarkedSpace to delegate grow/shrink decisions to Heap
https://bugs.webkit.org/show_bug.cgi?id=53759


SunSpider reports no change.


  • runtime/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::reset):
  • runtime/Heap.h: Reorganized a few data members for better cache locality. Added a grow policy.


  • runtime/MarkedSpace.cpp: (JSC::MarkedSpace::allocate): (JSC::MarkedSpace::sweep): (JSC::MarkedSpace::reset): Don't shrink automatically. Instead, wait for the heap to make an explicit sweep call.
  • runtime/MarkedSpace.h: (JSC::MarkedSpace::highWaterMark): (JSC::MarkedSpace::setHighWaterMark): Use a watermark to determine how many bytes to allocate before failing and giving the heap an opportunity to collect garbage. This also means that we allocate blocks on demand, instead of ahead of time.
File:
1 edited

Legend:

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

    r77391 r77612  
    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 = 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.