Changeset 95507 in webkit


Ignore:
Timestamp:
Sep 19, 2011 6:53:00 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r95493 and r95496.
http://trac.webkit.org/changeset/95493
http://trac.webkit.org/changeset/95496
https://bugs.webkit.org/show_bug.cgi?id=68418

Broke Windows build (Requested by rniwa on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2011-09-19

Source/JavaScriptCore:

(JSC::Debugger::recompileAllJSFunctions):

  • heap/AllocationSpace.cpp: Removed.
  • heap/AllocationSpace.h: Removed.
  • heap/Heap.cpp:

(JSC::CountFunctor::TakeIfEmpty::TakeIfEmpty):
(JSC::CountFunctor::TakeIfEmpty::operator()):
(JSC::CountFunctor::TakeIfEmpty::returnValue):
(JSC::Heap::Heap):
(JSC::Heap::reportExtraMemoryCostSlowCase):
(JSC::Heap::tryAllocate):
(JSC::Heap::allocateSlowCase):
(JSC::Heap::getConservativeRegisterRoots):
(JSC::Heap::markRoots):
(JSC::Heap::clearMarks):
(JSC::Heap::sweep):
(JSC::Heap::objectCount):
(JSC::Heap::size):
(JSC::Heap::capacity):
(JSC::Heap::globalObjectCount):
(JSC::Heap::objectTypeCounts):
(JSC::Heap::collect):
(JSC::Heap::canonicalizeBlocks):
(JSC::Heap::resetAllocator):
(JSC::Heap::allocateBlock):
(JSC::Heap::freeBlocks):
(JSC::Heap::shrink):

  • heap/Heap.h:

(JSC::Heap::markedSpace):
(JSC::Heap::forEachCell):
(JSC::Heap::forEachBlock):
(JSC::Heap::sizeClassFor):
(JSC::Heap::allocate):

  • jit/JITInlineMethods.h:

(JSC::JIT::emitAllocateBasicJSObject):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::recompileAllJSFunctions):
(JSC::JSGlobalData::releaseExecutableMemory):

Source/WebCore:

  • ForwardingHeaders/heap/AllocationSpace.h: Removed.
Location:
trunk/Source
Files:
3 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r95493 r95507  
    4646    bytecompiler/NodesCodegen.cpp
    4747
    48     heap/AllocationSpace.cpp
    4948    heap/Heap.cpp
    5049    heap/HandleHeap.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r95505 r95507  
     12011-09-19  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r95493 and r95496.
     4        http://trac.webkit.org/changeset/95493
     5        http://trac.webkit.org/changeset/95496
     6        https://bugs.webkit.org/show_bug.cgi?id=68418
     7
     8        Broke Windows build (Requested by rniwa on #webkit).
     9
     10        * CMakeLists.txt:
     11        * GNUmakefile.list.am:
     12        * JavaScriptCore.exp:
     13        * JavaScriptCore.gypi:
     14        * JavaScriptCore.pro:
     15        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
     16        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
     17        * JavaScriptCore.xcodeproj/project.pbxproj:
     18        * debugger/Debugger.cpp:
     19        (JSC::Debugger::recompileAllJSFunctions):
     20        * heap/AllocationSpace.cpp: Removed.
     21        * heap/AllocationSpace.h: Removed.
     22        * heap/Heap.cpp:
     23        (JSC::CountFunctor::TakeIfEmpty::TakeIfEmpty):
     24        (JSC::CountFunctor::TakeIfEmpty::operator()):
     25        (JSC::CountFunctor::TakeIfEmpty::returnValue):
     26        (JSC::Heap::Heap):
     27        (JSC::Heap::reportExtraMemoryCostSlowCase):
     28        (JSC::Heap::tryAllocate):
     29        (JSC::Heap::allocateSlowCase):
     30        (JSC::Heap::getConservativeRegisterRoots):
     31        (JSC::Heap::markRoots):
     32        (JSC::Heap::clearMarks):
     33        (JSC::Heap::sweep):
     34        (JSC::Heap::objectCount):
     35        (JSC::Heap::size):
     36        (JSC::Heap::capacity):
     37        (JSC::Heap::globalObjectCount):
     38        (JSC::Heap::objectTypeCounts):
     39        (JSC::Heap::collect):
     40        (JSC::Heap::canonicalizeBlocks):
     41        (JSC::Heap::resetAllocator):
     42        (JSC::Heap::allocateBlock):
     43        (JSC::Heap::freeBlocks):
     44        (JSC::Heap::shrink):
     45        * heap/Heap.h:
     46        (JSC::Heap::markedSpace):
     47        (JSC::Heap::forEachCell):
     48        (JSC::Heap::forEachBlock):
     49        (JSC::Heap::sizeClassFor):
     50        (JSC::Heap::allocate):
     51        * jit/JITInlineMethods.h:
     52        (JSC::JIT::emitAllocateBasicJSObject):
     53        * runtime/JSGlobalData.cpp:
     54        (JSC::JSGlobalData::recompileAllJSFunctions):
     55        (JSC::JSGlobalData::releaseExecutableMemory):
     56
    1572011-09-19  Gavin Barraclough  <barraclough@apple.com>
    258
  • trunk/Source/JavaScriptCore/GNUmakefile.list.am

    r95493 r95507  
    134134        Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp \
    135135        Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h \
    136         Source/JavaScriptCore/heap/AllocationSpace.cpp \
    137         Source/JavaScriptCore/heap/AllocationSpace.h \
    138136        Source/JavaScriptCore/heap/ConservativeRoots.cpp \
    139137        Source/JavaScriptCore/heap/ConservativeRoots.h \
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r95493 r95507  
    119119__ZN3JSC11JSByteArray15createStructureERNS_12JSGlobalDataEPNS_14JSGlobalObjectENS_7JSValueEPKNS_9ClassInfoE
    120120__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEPNS_9StructureEPN3WTF9ByteArrayE
    121 __ZN3JSC15AllocationSpace16allocateSlowCaseERNS_11MarkedSpace9SizeClassE
    122121__ZN3JSC11ParserArena5resetEv
    123122__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeEPNS_7JSValueE
     
    235234__ZN3JSC4Heap11objectCountEv
    236235__ZN3JSC4Heap16activityCallbackEv
     236__ZN3JSC4Heap16allocateSlowCaseERNS_11MarkedSpace9SizeClassE
    237237__ZN3JSC4Heap16objectTypeCountsEv
    238238__ZN3JSC4Heap17collectAllGarbageEv
  • trunk/Source/JavaScriptCore/JavaScriptCore.gypi

    r95493 r95507  
    2828            'assembler/MacroAssemblerCodeRef.h',
    2929            'bytecode/Opcode.h',
    30             'heap/AllocationSpace.h',
    3130            'heap/ConservativeRoots.h',
    3231            'heap/Handle.h',
     
    326325            'bytecompiler/NodesCodegen.cpp',
    327326            'bytecompiler/RegisterID.h',
    328             'heap/AllocationSpace.cpp',
    329327            'heap/ConservativeRoots.cpp',
    330328            'heap/HandleHeap.cpp',
  • trunk/Source/JavaScriptCore/JavaScriptCore.pro

    r95493 r95507  
    7373    bytecompiler/BytecodeGenerator.cpp \
    7474    bytecompiler/NodesCodegen.cpp \
    75     heap/AllocationSpace.cpp \
    7675    heap/ConservativeRoots.cpp \
    7776    heap/HandleHeap.cpp \
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r95496 r95507  
    6060    ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PAVStringImpl@4@@Z
    6161    ?addStaticGlobals@JSGlobalObject@JSC@@IAEXPAUGlobalPropertyInfo@12@H@Z
    62     ?allocate@AllocationSpace@JSC@@QAEPAXAAUSizeClass@MarkedSpace@2@@Z
     62    ?allocate@Heap@JSC@@QAEPAXAAUSizeClass@MarkedSpace@2@@Z
    6363    ?allocatePropertyStorage@JSObject@JSC@@QAEXAAVJSGlobalData@2@II@Z
    64     ?allocateSlowCase@AllocationSpace@JSC@@AAEPAXAAUSizeClass@MarkedSpace@2@@Z
     64    ?allocateSlowCase@Heap@JSC@@AAEPAXAAUSizeClass@MarkedSpace@2@@Z
    6565    ?append@StringBuilder@WTF@@QAEXPBDI@Z
    6666    ?append@StringBuilder@WTF@@QAEXPB_WI@Z
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj

    r95493 r95507  
    18911891                        >
    18921892                            <File
    1893                                     RelativePath="..\..\heap\AllocationSpace.cpp"
    1894                                     >
    1895                             </File>
    1896                             <File
    1897                                     RelativePath="..\..\heap\AllocationSpace.h"
    1898                                     >
    1899                             </File>
    1900                             <File
    19011893                                    RelativePath="..\..\heap\ConservativeRoots.cpp"
    19021894                                    >
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r95493 r95507  
    407407                A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B4011C7B235007A5315 /* RegExpKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
    408408                A1D764521354448B00C5C7C0 /* Alignment.h in Headers */ = {isa = PBXBuildFile; fileRef = A1D764511354448B00C5C7C0 /* Alignment.h */; settings = {ATTRIBUTES = (Private, ); }; };
    409                 A70456B01427FB910037DA68 /* AllocationSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = A70456AF1427FB150037DA68 /* AllocationSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
    410                 A70456B11427FB950037DA68 /* AllocationSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70456AE1427FB030037DA68 /* AllocationSpace.cpp */; };
    411409                A71236E51195F33C00BD2174 /* JITOpcodes32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */; };
    412410                A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72700780DAC605600E548D7 /* JSNotAnObject.cpp */; };
     
    11851183                A1712B4011C7B235007A5315 /* RegExpKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpKey.h; sourceTree = "<group>"; };
    11861184                A1D764511354448B00C5C7C0 /* Alignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Alignment.h; sourceTree = "<group>"; };
    1187                 A70456AE1427FB030037DA68 /* AllocationSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AllocationSpace.cpp; sourceTree = "<group>"; };
    1188                 A70456AF1427FB150037DA68 /* AllocationSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllocationSpace.h; sourceTree = "<group>"; };
    11891185                A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITOpcodes32_64.cpp; sourceTree = "<group>"; };
    11901186                A718F61A11754A21002465A7 /* RegExpJitTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpJitTables.h; sourceTree = "<group>"; };
     
    16221618                        isa = PBXGroup;
    16231619                        children = (
    1624                                 A70456AF1427FB150037DA68 /* AllocationSpace.h */,
    1625                                 A70456AE1427FB030037DA68 /* AllocationSpace.cpp */,
    16261620                                0F242DA513F3B1BB007ADD4C /* WeakReferenceHarvester.h */,
    16271621                                0FC815141405118D00CFA603 /* VTableSpectrum.h */,
     
    28002794                                A781E359141970C700094D90 /* StorageBarrier.h in Headers */,
    28012795                                1A08277A142168D70090CCAC /* BinarySemaphore.h in Headers */,
    2802                                 A70456B01427FB910037DA68 /* AllocationSpace.h in Headers */,
    28032796                        );
    28042797                        runOnlyForDeploymentPostprocessing = 0;
     
    33063299                                C22C531313FAF6EF00B7DC0D /* strtod.cc in Sources */,
    33073300                                1A082779142168D70090CCAC /* BinarySemaphore.cpp in Sources */,
    3308                                 A70456B11427FB950037DA68 /* AllocationSpace.cpp in Sources */,
    33093301                        );
    33103302                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/JavaScriptCore/debugger/Debugger.cpp

    r95493 r95507  
    119119
    120120    Recompiler recompiler(this);
    121     globalData->heap.objectSpace().forEachCell(recompiler);
     121    globalData->heap.forEachCell(recompiler);
    122122}
    123123
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r95493 r95507  
    3434#include <algorithm>
    3535
     36#define COLLECT_ON_EVERY_ALLOCATION 0
    3637
    3738using namespace std;
     
    175176}
    176177
     178class TakeIfEmpty {
     179public:
     180    typedef MarkedBlock* ReturnType;
     181
     182    TakeIfEmpty(MarkedSpace*);
     183    void operator()(MarkedBlock*);
     184    ReturnType returnValue();
     185
     186private:
     187    MarkedSpace* m_markedSpace;
     188    DoublyLinkedList<MarkedBlock> m_empties;
     189};
     190
     191inline TakeIfEmpty::TakeIfEmpty(MarkedSpace* newSpace)
     192    : m_markedSpace(newSpace)
     193{
     194}
     195
     196inline void TakeIfEmpty::operator()(MarkedBlock* block)
     197{
     198    if (!block->isEmpty())
     199        return;
     200
     201    m_markedSpace->removeBlock(block);
     202    m_empties.append(block);
     203}
     204
     205inline TakeIfEmpty::ReturnType TakeIfEmpty::returnValue()
     206{
     207    return m_empties.head();
     208}
     209
    177210class RecordType {
    178211public:
     
    217250    , m_minBytesPerCycle(heapSizeForHint(heapSize))
    218251    , m_operationInProgress(NoOperation)
    219     , m_objectSpace(this)
     252    , m_markedSpace(this)
    220253    , m_extraCost(0)
    221254    , m_markListSet(0)
     
    227260    , m_globalData(globalData)
    228261{
    229     m_objectSpace.setHighWaterMark(m_minBytesPerCycle);
     262    m_markedSpace.setHighWaterMark(m_minBytesPerCycle);
    230263    (*m_activityCallback)();
    231264#if ENABLE(LAZY_BLOCK_FREEING)
     
    369402    // collecting more frequently as long as it stays alive.
    370403
    371     if (m_extraCost > maxExtraCost && m_extraCost > m_objectSpace.highWaterMark() / 2)
     404    if (m_extraCost > maxExtraCost && m_extraCost > m_markedSpace.highWaterMark() / 2)
    372405        collectAllGarbage();
    373406    m_extraCost += cost;
     407}
     408
     409inline void* Heap::tryAllocate(MarkedSpace::SizeClass& sizeClass)
     410{
     411    m_operationInProgress = Allocation;
     412    void* result = m_markedSpace.allocate(sizeClass);
     413    m_operationInProgress = NoOperation;
     414    return result;
     415}
     416
     417void* Heap::allocateSlowCase(MarkedSpace::SizeClass& sizeClass)
     418{
     419#if COLLECT_ON_EVERY_ALLOCATION
     420    collectAllGarbage();
     421    ASSERT(m_operationInProgress == NoOperation);
     422#endif
     423
     424    void* result = tryAllocate(sizeClass);
     425
     426    if (LIKELY(result != 0))
     427        return result;
     428
     429    AllocationEffort allocationEffort;
     430   
     431    if (m_markedSpace.waterMark() < m_markedSpace.highWaterMark() || !m_isSafeToCollect)
     432        allocationEffort = AllocationMustSucceed;
     433    else
     434        allocationEffort = AllocationCanFail;
     435   
     436    MarkedBlock* block = allocateBlock(sizeClass.cellSize, allocationEffort);
     437    if (block) {
     438        m_markedSpace.addBlock(sizeClass, block);
     439        void* result = tryAllocate(sizeClass);
     440        ASSERT(result);
     441        return result;
     442    }
     443
     444    collect(DoNotSweep);
     445   
     446    result = tryAllocate(sizeClass);
     447   
     448    if (result)
     449        return result;
     450   
     451    ASSERT(m_markedSpace.waterMark() < m_markedSpace.highWaterMark());
     452   
     453    m_markedSpace.addBlock(sizeClass, allocateBlock(sizeClass.cellSize, AllocationMustSucceed));
     454   
     455    result = tryAllocate(sizeClass);
     456    ASSERT(result);
     457    return result;
    374458}
    375459
     
    446530        CRASH();
    447531    m_operationInProgress = Collection;
    448     ConservativeRoots registerFileRoots(&m_objectSpace.blocks());
     532    ConservativeRoots registerFileRoots(&m_blocks);
    449533    registerFile().gatherConservativeRoots(registerFileRoots);
    450534    size_t registerFileRootCount = registerFileRoots.size();
     
    468552    // We gather conservative roots before clearing mark bits because conservative
    469553    // gathering uses the mark bits to determine whether a reference is valid.
    470     ConservativeRoots machineThreadRoots(&m_objectSpace.blocks());
     554    ConservativeRoots machineThreadRoots(&m_blocks);
    471555    m_machineThreads.gatherConservativeRoots(machineThreadRoots, &dummy);
    472556
    473     ConservativeRoots registerFileRoots(&m_objectSpace.blocks());
     557    ConservativeRoots registerFileRoots(&m_blocks);
    474558    registerFile().gatherConservativeRoots(registerFileRoots);
    475559
     
    524608void Heap::clearMarks()
    525609{
    526     m_objectSpace.forEachBlock<ClearMarks>();
     610    forEachBlock<ClearMarks>();
    527611}
    528612
    529613void Heap::sweep()
    530614{
    531     m_objectSpace.forEachBlock<Sweep>();
     615    forEachBlock<Sweep>();
    532616}
    533617
    534618size_t Heap::objectCount()
    535619{
    536     return m_objectSpace.forEachBlock<MarkCount>();
     620    return forEachBlock<MarkCount>();
    537621}
    538622
    539623size_t Heap::size()
    540624{
    541     return m_objectSpace.forEachBlock<Size>();
     625    return forEachBlock<Size>();
    542626}
    543627
    544628size_t Heap::capacity()
    545629{
    546     return m_objectSpace.forEachBlock<Capacity>();
     630    return forEachBlock<Capacity>();
    547631}
    548632
     
    554638size_t Heap::globalObjectCount()
    555639{
    556     return m_objectSpace.forEachCell<CountIfGlobalObject>();
     640    return forEachCell<CountIfGlobalObject>();
    557641}
    558642
     
    569653PassOwnPtr<TypeCountSet> Heap::objectTypeCounts()
    570654{
    571     return m_objectSpace.forEachCell<RecordType>();
     655    return forEachCell<RecordType>();
    572656}
    573657
     
    608692    // new bytes allocated) proportion, and seems to work well in benchmarks.
    609693    size_t proportionalBytes = 2 * size();
    610     m_objectSpace.setHighWaterMark(max(proportionalBytes, m_minBytesPerCycle));
     694    m_markedSpace.setHighWaterMark(max(proportionalBytes, m_minBytesPerCycle));
    611695    JAVASCRIPTCORE_GC_END();
    612696
     
    616700void Heap::canonicalizeBlocks()
    617701{
    618     m_objectSpace.canonicalizeBlocks();
     702    m_markedSpace.canonicalizeBlocks();
    619703}
    620704
     
    622706{
    623707    m_extraCost = 0;
    624     m_objectSpace.resetAllocator();
     708    m_markedSpace.resetAllocator();
    625709}
    626710
     
    649733}
    650734
     735MarkedBlock* Heap::allocateBlock(size_t cellSize, Heap::AllocationEffort allocationEffort)
     736{
     737    MarkedBlock* block;
     738   
     739#if !ENABLE(LAZY_BLOCK_FREEING)
     740    if (allocationEffort == AllocationCanFail)
     741        return 0;
     742   
     743    block = MarkedBlock::create(this, cellSize);
     744#else
     745    {
     746        MutexLocker locker(m_freeBlockLock);
     747        if (m_numberOfFreeBlocks) {
     748            block = m_freeBlocks.removeHead();
     749            ASSERT(block);
     750            m_numberOfFreeBlocks--;
     751        } else
     752            block = 0;
     753    }
     754    if (block)
     755        block->initForCellSize(cellSize);
     756    else if (allocationEffort == AllocationCanFail)
     757        return 0;
     758    else
     759        block = MarkedBlock::create(this, cellSize);
     760#endif
     761   
     762    m_blocks.add(block);
     763
     764    return block;
     765}
     766
    651767void Heap::freeBlocks(MarkedBlock* head)
    652768{
    653     m_objectSpace.freeBlocks(head);
     769    MarkedBlock* next;
     770    for (MarkedBlock* block = head; block; block = next) {
     771        next = block->next();
     772
     773        m_blocks.remove(block);
     774        block->reset();
     775#if !ENABLE(LAZY_BLOCK_FREEING)
     776        MarkedBlock::destroy(block);
     777#else
     778        MutexLocker locker(m_freeBlockLock);
     779        m_freeBlocks.append(block);
     780        m_numberOfFreeBlocks++;
     781#endif
     782    }
    654783}
    655784
    656785void Heap::shrink()
    657786{
    658     m_objectSpace.shrink();
     787    // We record a temporary list of empties to avoid modifying m_blocks while iterating it.
     788    TakeIfEmpty takeIfEmpty(&m_markedSpace);
     789    freeBlocks(forEachBlock(takeIfEmpty));
    659790}
    660791
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r95493 r95507  
    2323#define Heap_h
    2424
    25 #include "AllocationSpace.h"
    2625#include "HandleHeap.h"
    2726#include "HandleStack.h"
     
    3938    class GCActivityCallback;
    4039    class GlobalCodeBlock;
    41     class Heap;
    4240    class HeapRootVisitor;
    4341    class JSCell;
     
    5957    // Heap size hint.
    6058    enum HeapSize { SmallHeap, LargeHeap };
    61 
     59   
    6260    class Heap {
    6361        WTF_MAKE_NONCOPYABLE(Heap);
    6462    public:
    65         friend class JIT;
    6663        static Heap* heap(JSValue); // 0 for immediate values
    6764        static Heap* heap(JSCell*);
     
    8077
    8178        JSGlobalData* globalData() const { return m_globalData; }
    82         AllocationSpace& objectSpace() { return m_objectSpace; }
     79        MarkedSpace& markedSpace() { return m_markedSpace; }
    8380        MachineThreads& machineThreads() { return m_machineThreads; }
    8481
     
    8885        // true if an allocation or collection is in progress
    8986        inline bool isBusy();
    90        
    91         MarkedSpace::SizeClass& sizeClassForObject(size_t bytes) { return m_objectSpace.sizeClassFor(bytes); }
     87
    9288        void* allocate(size_t);
    93 
     89        MarkedSpace::SizeClass& sizeClassFor(size_t);
     90        void* allocate(MarkedSpace::SizeClass&);
    9491        void notifyIsSafeToCollect() { m_isSafeToCollect = true; }
    9592        void collectAllGarbage();
     
    116113        template<typename Functor> typename Functor::ReturnType forEachProtectedCell(Functor&);
    117114        template<typename Functor> typename Functor::ReturnType forEachProtectedCell();
     115        template<typename Functor> typename Functor::ReturnType forEachCell(Functor&);
     116        template<typename Functor> typename Functor::ReturnType forEachCell();
     117        template<typename Functor> typename Functor::ReturnType forEachBlock(Functor&);
     118        template<typename Functor> typename Functor::ReturnType forEachBlock();
    118119       
    119120        HandleSlot allocateGlobalHandle() { return m_handleHeap.allocate(); }
     
    125126    private:
    126127        friend class MarkedBlock;
    127         friend class AllocationSpace;
     128       
     129        typedef HashSet<MarkedBlock*>::iterator BlockIterator;
    128130
    129131        static const size_t minExtraCost = 256;
    130132        static const size_t maxExtraCost = 1024 * 1024;
     133       
     134        enum AllocationEffort { AllocationMustSucceed, AllocationCanFail };
    131135       
    132136#if ENABLE(GGC)
     
    139143        void resetAllocator();
    140144
     145        MarkedBlock* allocateBlock(size_t cellSize, AllocationEffort);
    141146        void freeBlocks(MarkedBlock*);
    142147
     
    146151        void markTempSortVectors(HeapRootVisitor&);
    147152        void harvestWeakReferences();
     153
     154        void* tryAllocate(MarkedSpace::SizeClass&);
     155        void* allocateSlowCase(MarkedSpace::SizeClass&);
    148156       
    149157        enum SweepToggle { DoNotSweep, DoSweep };
     
    168176       
    169177        OperationInProgress m_operationInProgress;
    170         AllocationSpace m_objectSpace;
     178        MarkedSpace m_markedSpace;
     179        MarkedBlockSet m_blocks;
    171180
    172181#if ENABLE(LAZY_BLOCK_FREEING)
     
    298307    }
    299308
     309    template<typename Functor> inline typename Functor::ReturnType Heap::forEachCell(Functor& functor)
     310    {
     311        canonicalizeBlocks();
     312        BlockIterator end = m_blocks.set().end();
     313        for (BlockIterator it = m_blocks.set().begin(); it != end; ++it)
     314            (*it)->forEachCell(functor);
     315        return functor.returnValue();
     316    }
     317
     318    template<typename Functor> inline typename Functor::ReturnType Heap::forEachCell()
     319    {
     320        Functor functor;
     321        return forEachCell(functor);
     322    }
     323
     324    template<typename Functor> inline typename Functor::ReturnType Heap::forEachBlock(Functor& functor)
     325    {
     326        canonicalizeBlocks();
     327        BlockIterator end = m_blocks.set().end();
     328        for (BlockIterator it = m_blocks.set().begin(); it != end; ++it)
     329            functor(*it);
     330        return functor.returnValue();
     331    }
     332
     333    template<typename Functor> inline typename Functor::ReturnType Heap::forEachBlock()
     334    {
     335        Functor functor;
     336        return forEachBlock(functor);
     337    }
     338   
     339    inline MarkedSpace::SizeClass& Heap::sizeClassFor(size_t bytes)
     340    {
     341        return m_markedSpace.sizeClassFor(bytes);
     342    }
     343   
     344    inline void* Heap::allocate(MarkedSpace::SizeClass& sizeClass)
     345    {
     346        // This is a light-weight fast path to cover the most common case.
     347        MarkedBlock::FreeCell* firstFreeCell = sizeClass.firstFreeCell;
     348        if (UNLIKELY(!firstFreeCell))
     349            return allocateSlowCase(sizeClass);
     350       
     351        sizeClass.firstFreeCell = firstFreeCell->next;
     352        return firstFreeCell;
     353    }
     354
    300355    inline void* Heap::allocate(size_t bytes)
    301356    {
    302357        ASSERT(isValidAllocation(bytes));
    303         return m_objectSpace.allocate(bytes);
     358        MarkedSpace::SizeClass& sizeClass = sizeClassFor(bytes);
     359        return allocate(sizeClass);
    304360    }
    305361
  • trunk/Source/JavaScriptCore/jit/JITInlineMethods.h

    r95493 r95507  
    395395template <typename ClassType, typename StructureType> inline void JIT::emitAllocateBasicJSObject(StructureType structure, void* vtable, RegisterID result, RegisterID storagePtr)
    396396{
    397     MarkedSpace::SizeClass* sizeClass = &m_globalData->heap.sizeClassForObject(sizeof(ClassType));
     397    MarkedSpace::SizeClass* sizeClass = &m_globalData->heap.sizeClassFor(sizeof(ClassType));
    398398    loadPtr(&sizeClass->firstFreeCell, result);
    399399    addSlowCase(branchTestPtr(Zero, result));
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp

    r95493 r95507  
    455455    ASSERT(!dynamicGlobalObject);
    456456   
    457     heap.objectSpace().forEachCell<Recompiler>();
     457    heap.forEachCell<Recompiler>();
    458458}
    459459
     
    496496               
    497497        }
    498         heap.objectSpace().forEachCell<StackPreservingRecompiler>(recompiler);
     498        heap.forEachCell<StackPreservingRecompiler>(recompiler);
    499499    }
    500500    m_regExpCache->invalidateCode();
  • trunk/Source/WebCore/ChangeLog

    r95506 r95507  
     12011-09-19  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r95493 and r95496.
     4        http://trac.webkit.org/changeset/95493
     5        http://trac.webkit.org/changeset/95496
     6        https://bugs.webkit.org/show_bug.cgi?id=68418
     7
     8        Broke Windows build (Requested by rniwa on #webkit).
     9
     10        * ForwardingHeaders/heap/AllocationSpace.h: Removed.
     11
    1122011-09-19  James Robinson  <jamesr@chromium.org>
    213
Note: See TracChangeset for help on using the changeset viewer.