1. 26 Aug, 2011 1 commit
    • fpizlo@apple.com's avatar
      The GC does not have a facility for profiling the kinds of objects · d6bcd37d
      fpizlo@apple.com authored
      that occupy the heap
      https://bugs.webkit.org/show_bug.cgi?id=66849
      
      Reviewed by Geoffrey Garen.
      
      Destructor calls and object scans are now optionally counted, per
      vtable. When the heap is destroyed and profiling is enabled, the
      counts are dumped, with care taken to print the names of classes
      (modulo C++ mangling) sorted in descending commonality.
      
      * GNUmakefile.list.am:
      * JavaScriptCore.exp:
      * JavaScriptCore.pro:
      * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * heap/Heap.cpp:
      (JSC::Heap::destroy):
      * heap/Heap.h:
      * heap/MarkStack.cpp:
      (JSC::SlotVisitor::visitChildren):
      (JSC::SlotVisitor::drain):
      * heap/MarkStack.h:
      * heap/MarkedBlock.cpp:
      (JSC::MarkedBlock::callDestructor):
      * heap/MarkedBlock.h:
      * heap/VTableSpectrum.cpp: Added.
      (JSC::VTableSpectrum::VTableSpectrum):
      (JSC::VTableSpectrum::~VTableSpectrum):
      (JSC::VTableSpectrum::countVPtr):
      (JSC::VTableSpectrum::count):
      (JSC::VTableAndCount::VTableAndCount):
      (JSC::VTableAndCount::operator<):
      (JSC::VTableSpectrum::dump):
      * heap/VTableSpectrum.h: Added.
      * wtf/Platform.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@93918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d6bcd37d
  2. 24 Aug, 2011 1 commit
    • fpizlo@apple.com's avatar
      There is no facility for profiling how the write barrier is used · aec7e0c4
      fpizlo@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=66747
      
      Reviewed by Geoffrey Garen.
      
      Added facilities for the JIT to specify the kind of write barrier
      being executed.  Added code for profiling the number of each kind
      of barrier encountered.
      
      * GNUmakefile.list.am:
      * JavaScriptCore.exp:
      * JavaScriptCore.pro:
      * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * dfg/DFGJITCodeGenerator.cpp:
      (JSC::DFG::JITCodeGenerator::writeBarrier):
      (JSC::DFG::JITCodeGenerator::cachedPutById):
      * dfg/DFGJITCodeGenerator.h:
      * dfg/DFGJITCompiler.cpp:
      (JSC::DFG::JITCompiler::emitCount):
      * dfg/DFGJITCompiler.h:
      (JSC::DFG::JITCompiler::emitCount):
      * dfg/DFGNonSpeculativeJIT.cpp:
      (JSC::DFG::NonSpeculativeJIT::compile):
      * dfg/DFGRepatch.cpp:
      (JSC::DFG::tryCachePutByID):
      * dfg/DFGSpeculativeJIT.cpp:
      (JSC::DFG::SpeculativeJIT::compile):
      * heap/Heap.h:
      (JSC::Heap::writeBarrier):
      * heap/WriteBarrierSupport.cpp: Added.
      (JSC::WriteBarrierCounters::initialize):
      * heap/WriteBarrierSupport.h: Added.
      (JSC::WriteBarrierCounters::WriteBarrierCounters):
      (JSC::WriteBarrierCounters::jitCounterFor):
      (JSC::WriteBarrierCounters::countWriteBarrier):
      * jit/JIT.h:
      * jit/JITPropertyAccess.cpp:
      (JSC::JIT::emit_op_put_by_id):
      (JSC::JIT::privateCompilePutByIdTransition):
      (JSC::JIT::emit_op_put_scoped_var):
      (JSC::JIT::emit_op_put_global_var):
      (JSC::JIT::emitWriteBarrier):
      * jit/JITPropertyAccess32_64.cpp:
      (JSC::JIT::emit_op_put_by_val):
      (JSC::JIT::emit_op_put_by_id):
      (JSC::JIT::privateCompilePutByIdTransition):
      (JSC::JIT::emit_op_put_scoped_var):
      (JSC::JIT::emit_op_put_global_var):
      (JSC::JIT::emitWriteBarrier):
      * runtime/InitializeThreading.cpp:
      (JSC::initializeThreadingOnce):
      * runtime/WriteBarrier.h:
      (JSC::WriteBarrierBase::setWithoutWriteBarrier):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@93698 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      aec7e0c4
  3. 02 Aug, 2011 2 commits
    • fpizlo@apple.com's avatar
      JSC GC is far too conservative about growing the heap size, particularly · f49ce5c9
      fpizlo@apple.com authored
      on desktop platforms
      https://bugs.webkit.org/show_bug.cgi?id=65438
      
      Reviewed by Oliver Hunt.
      
      Source/JavaScriptCore:
      
      The minimum heap size is now 16MB instead of 512KB, provided all of the
      following are true:
      a) ENABLE(LARGE_HEAP) is set, which currently only happens on
         x86 targets, but could reasonably happen on any platform that is
         known to have a decent amount of RAM.
      b) JSGlobalData is initialized with HeapSize = LargeHeap, which
         currently only happens when it's the JSDOMWindowBase in WebCore or
         in the jsc command-line tool.
      
      This is a 4.1% speed-up on SunSpider.
      
      * JavaScriptCore.exp:
      * heap/Heap.cpp:
      (JSC::Heap::Heap):
      (JSC::Heap::collect):
      * heap/Heap.h:
      * jsc.cpp:
      (main):
      * runtime/JSGlobalData.cpp:
      (JSC::JSGlobalData::JSGlobalData):
      (JSC::JSGlobalData::createContextGroup):
      (JSC::JSGlobalData::create):
      (JSC::JSGlobalData::createLeaked):
      (JSC::JSGlobalData::sharedInstance):
      * runtime/JSGlobalData.h:
      * wtf/Platform.h:
      
      Source/WebCore:
      
      No change in behavior, thus no new tests.
      
      Pass the LargeHeap hint to JSGlobalData when creating the JSC runtime
      instance corresponding to non-worker JS code.
      
      * bindings/js/JSDOMWindowBase.cpp:
      (WebCore::JSDOMWindowBase::commonJSGlobalData):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@92224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f49ce5c9
    • fpizlo@apple.com's avatar
      JSC does a GC even when the heap still has free pages · 5ee14281
      fpizlo@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=65445
      
      Reviewed by Oliver Hunt.
      
      If the high watermark is not reached, then we allocate new blocks as
      before.  If the current watermark does reach (or exceed) the high
      watermark, then we check if there is a block on the free block pool.
      If there is, we simply allocation from it.  If there isn't, we
      invoke a collectin as before.  This effectively couples the elastic
      scavenging to the collector's decision function.  That is, if an
      application rapidly varies its heap usage (sometimes using more and
      sometimes less) then the collector will not thrash as it used to.
      But if heap usage drops and stays low then the scavenger thread and
      the GC will eventually reach a kind of consensus: the GC will set
      the watermark low because of low heap usage, and the scavenger thread
      will steadily eliminate pages from the free page pool, until the size
      of the free pool is below the high watermark.
      
      On command-line, this is neutral on SunSpider and Kraken and a 3% win
      on V8.  In browser, this is a 1% win on V8 and neutral on the other
      two.
      
      * heap/Heap.cpp:
      (JSC::Heap::allocateSlowCase):
      (JSC::Heap::allocateBlock):
      * heap/Heap.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@92217 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      5ee14281
  4. 31 Jul, 2011 1 commit
    • fpizlo@apple.com's avatar
      The JSC garbage collector returns memory to the operating system too · 07148b12
      fpizlo@apple.com authored
      eagerly.
      https://bugs.webkit.org/show_bug.cgi?id=65382
      
      Reviewed by Oliver Hunt.
      
      This introduces a memory reuse model similar to the one in FastMalloc.
      A periodic scavenger thread runs in the background and returns half the
      free memory to the OS on each timer fire.  New block allocations first
      attempt to get the memory from the collector's internal pool, reverting
      to OS allocation only when this pool is empty.
      
      * heap/Heap.cpp:
      (JSC::Heap::Heap):
      (JSC::Heap::~Heap):
      (JSC::Heap::destroy):
      (JSC::Heap::waitForRelativeTimeWhileHoldingLock):
      (JSC::Heap::waitForRelativeTime):
      (JSC::Heap::blockFreeingThreadStartFunc):
      (JSC::Heap::blockFreeingThreadMain):
      (JSC::Heap::allocateBlock):
      (JSC::Heap::freeBlocks):
      (JSC::Heap::releaseFreeBlocks):
      * heap/Heap.h:
      * heap/MarkedBlock.cpp:
      (JSC::MarkedBlock::destroy):
      (JSC::MarkedBlock::MarkedBlock):
      (JSC::MarkedBlock::initForCellSize):
      (JSC::MarkedBlock::reset):
      * heap/MarkedBlock.h:
      * wtf/Platform.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@92084 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      07148b12
  5. 18 Jul, 2011 1 commit
    • commit-queue@webkit.org's avatar
      JSC JIT does not inline GC allocation fast paths · c9b19ab5
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=64582
      
      Patch by Filip Pizlo <fpizlo@apple.com> on 2011-07-18
      Reviewed by Oliver Hunt.
      
      This addresses inlining allocation for the easiest-to-allocate cases:
      op_new_object and op_create_this.  Inlining GC allocation fast paths
      required three changes.  First, the JSGlobalData now saves the vtable
      pointer of JSFinalObject, since that's what op_new_object and
      op_create_this allocate.  Second, the Heap exposes a reference to
      the appropriate SizeClass, so that the JIT may inline accesses
      directly to the SizeClass for JSFinalObject allocations.  And third,
      the JIT is extended with code to emit inline fast paths for GC
      allocation.  A stub call is emitted in the case where the inline fast
      path fails.
      
      * heap/Heap.h:
      (JSC::Heap::sizeClassFor):
      (JSC::Heap::allocate):
      * jit/JIT.cpp:
      (JSC::JIT::privateCompileSlowCases):
      * jit/JIT.h:
      * jit/JITInlineMethods.h:
      (JSC::JIT::emitAllocateJSFinalObject):
      * jit/JITOpcodes.cpp:
      (JSC::JIT::emit_op_new_object):
      (JSC::JIT::emitSlow_op_new_object):
      (JSC::JIT::emit_op_create_this):
      (JSC::JIT::emitSlow_op_create_this):
      * jit/JITOpcodes32_64.cpp:
      (JSC::JIT::emit_op_new_object):
      (JSC::JIT::emitSlow_op_new_object):
      (JSC::JIT::emit_op_create_this):
      (JSC::JIT::emitSlow_op_create_this):
      * runtime/JSGlobalData.cpp:
      (JSC::JSGlobalData::storeVPtrs):
      * runtime/JSGlobalData.h:
      * runtime/JSObject.h:
      (JSC::JSFinalObject::JSFinalObject):
      (JSC::JSObject::offsetOfInheritorID):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@91199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c9b19ab5
  6. 14 Jul, 2011 1 commit
    • commit-queue@webkit.org's avatar
      GC allocation fast path has too many operations. · e8dceaf2
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=64493
      
      Patch by Filip Pizlo <fpizlo@apple.com> on 2011-07-14
      Reviewed by Darin Adler.
      
      Changed the timing of the lazy sweep so that it occurs when we land on
      a previously-unsweeped block, rather than whenever we land on an unsweeped
      cell.  After the per-block lazy sweep occurs, the block is turned into a
      singly linked list of free cells.  The allocation fast path is now just a
      load-branch-store to remove a cell from the head of the list.
      
      Additionally, this changes the way new blocks are allocated.  Previously,
      they would be populated with dummy cells.  With this patch, they are
      turned into a free list, which means that there will never be destructor
      calls for allocations in fresh blocks.
      
      These changes result in a 1.9% speed-up on V8, and a 0.6% speed-up on
      SunSpider.  There are no observed statistically significant slow-downs
      on any individual benchmark.
      
      * JavaScriptCore.exp:
      * heap/Heap.cpp:
      (JSC::Heap::allocateSlowCase):
      (JSC::Heap::collect):
      (JSC::Heap::canonicalizeBlocks):
      (JSC::Heap::resetAllocator):
      * heap/Heap.h:
      (JSC::Heap::forEachProtectedCell):
      (JSC::Heap::forEachCell):
      (JSC::Heap::forEachBlock):
      (JSC::Heap::allocate):
      * heap/MarkedBlock.cpp:
      (JSC::MarkedBlock::MarkedBlock):
      (JSC::MarkedBlock::lazySweep):
      (JSC::MarkedBlock::blessNewBlockForFastPath):
      (JSC::MarkedBlock::blessNewBlockForSlowPath):
      (JSC::MarkedBlock::canonicalizeBlock):
      * heap/MarkedBlock.h:
      * heap/NewSpace.cpp:
      (JSC::NewSpace::addBlock):
      (JSC::NewSpace::canonicalizeBlocks):
      * heap/NewSpace.h:
      (JSC::NewSpace::allocate):
      (JSC::NewSpace::SizeClass::SizeClass):
      (JSC::NewSpace::SizeClass::canonicalizeBlock):
      * heap/OldSpace.cpp:
      (JSC::OldSpace::addBlock):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@91039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e8dceaf2
  7. 12 Jul, 2011 1 commit
    • commit-queue@webkit.org's avatar
      COLLECT_ON_EVERY_ALLOCATION no longer works. · f42601f4
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=64388
      
      Patch by Filip Pizlo <fpizlo@apple.com> on 2011-07-12
      Reviewed by Oliver Hunt.
      
      Added a flag to Heap that determines if it's safe to collect (which for now means that
      JSGlobalObject has actually been initialized, but it should work for other things, too).
      This allows JSGlobalObject to allocate even if the allocator wants to GC; instead of
      GCing it just grows the heap, if necessary.
      
      Then changed Heap::allocate() to not recurse ad infinitum when
      COLLECT_ON_EVERY_ALLOCATION is set.  This also makes the allocator generally more
      resilient against bugs; this change allowed me to put in handy assertions, such as that
      an allocation must succeed after either a collection or after a new block was added.
      
      * heap/Heap.cpp:
      (JSC::Heap::Heap):
      (JSC::Heap::tryAllocate):
      (JSC::Heap::allocate):
      (JSC::Heap::collectAllGarbage):
      (JSC::Heap::collect):
      * heap/Heap.h:
      (JSC::Heap::notifyIsSafeToCollect):
      * runtime/JSGlobalData.cpp:
      (JSC::JSGlobalData::JSGlobalData):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@90865 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f42601f4
  8. 27 Jun, 2011 1 commit
    • oliver@apple.com's avatar
      2011-06-27 Oliver Hunt <oliver@apple.com> · 1db480d3
      oliver@apple.com authored
              Reviewed by Geoffrey Garen.
      
              Support throwing away non-running code even while other code is running
              https://bugs.webkit.org/show_bug.cgi?id=63485
      
              Add a function to CodeBlock to support unlinking direct linked callsites,
              and then with that in place add logic to discard code from any function
              that is not currently on the stack.
      
              The unlinking completely reverts any optimized call sites, such that they
              may be relinked again in future.
      
              * JavaScriptCore.exp:
              * bytecode/CodeBlock.cpp:
              (JSC::CodeBlock::unlinkCalls):
              (JSC::CodeBlock::clearEvalCache):
              * bytecode/CodeBlock.h:
              (JSC::CallLinkInfo::CallLinkInfo):
              (JSC::CallLinkInfo::unlink):
              * bytecode/EvalCodeCache.h:
              (JSC::EvalCodeCache::clear):
              * heap/Heap.cpp:
              (JSC::Heap::getConservativeRegisterRoots):
              * heap/Heap.h:
              * jit/JIT.cpp:
              (JSC::JIT::privateCompile):
              * jit/JIT.h:
              * jit/JITCall.cpp:
              (JSC::JIT::compileOpCall):
              * jit/JITWriteBarrier.h:
              (JSC::JITWriteBarrierBase::clear):
              * jsc.cpp:
              (GlobalObject::GlobalObject):
              (functionReleaseExecutableMemory):
              * runtime/Executable.cpp:
              (JSC::EvalExecutable::unlinkCalls):
              (JSC::ProgramExecutable::unlinkCalls):
              (JSC::FunctionExecutable::discardCode):
              (JSC::FunctionExecutable::unlinkCalls):
              * runtime/Executable.h:
              * runtime/JSGlobalData.cpp:
              (JSC::SafeRecompiler::returnValue):
              (JSC::SafeRecompiler::operator()):
              (JSC::JSGlobalData::releaseExecutableMemory):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1db480d3
  9. 17 Jun, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-06-16 Geoffrey Garen <ggaren@apple.com> · 69f77964
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              Added some write barrier action, compiled out by default
              https://bugs.webkit.org/show_bug.cgi?id=62844
      
              * JavaScriptCore.exp: Build!
      
              * JavaScriptCore.xcodeproj/project.pbxproj: Fixed an incremental build
              issue with Heap.cpp.
      
              * heap/Heap.cpp:
              (JSC::Heap::writeBarrierSlowCase):
              * heap/Heap.h:
              (JSC::Heap::writeBarrier):
              * heap/MarkedBlock.h:
              (JSC::MarkedBlock::isAtomAligned):
              (JSC::MarkedBlock::blockFor):
              (JSC::MarkedBlock::atomNumber):
              (JSC::MarkedBlock::ownerSetNumber):
              (JSC::MarkedBlock::addOldSpaceOwner):
              (JSC::MarkedBlock::OwnerSet::OwnerSet):
              (JSC::MarkedBlock::OwnerSet::add):
              (JSC::MarkedBlock::OwnerSet::clear):
              (JSC::MarkedBlock::OwnerSet::size):
              (JSC::MarkedBlock::OwnerSet::didOverflow):
              (JSC::MarkedBlock::OwnerSet::owners): Added a basic write barrier that
              tracks owners for regions within blocks. Currently unused.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89156 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      69f77964
  10. 16 Jun, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-06-16 Geoffrey Garen <ggaren@apple.com> · 6e1f8c1b
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              Introduced SlotVisitor into the project
              https://bugs.webkit.org/show_bug.cgi?id=62820
              
              This resolves a class vs typedef forward declaration issue, and gives all
              exported symbols the correct names.
      
              * CMakeLists.txt:
              * GNUmakefile.list.am:
              * JavaScriptCore.exp:
              * JavaScriptCore.gypi:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
              * JavaScriptCore.xcodeproj/project.pbxproj: Build!
      
              * bytecode/EvalCodeCache.h:
              * heap/HandleHeap.h:
              * heap/Heap.cpp:
              (JSC::Heap::Heap):
              (JSC::Heap::markRoots):
              * heap/Heap.h:
              * heap/HeapRootVisitor.h: Replaced MarkStack with SlotVisitor. Now no
              clients operate on a MarkStack.
      
              * heap/MarkStack.cpp:
              (JSC::SlotVisitor::visitChildren):
              (JSC::SlotVisitor::drain):
              * heap/SlotVisitor.h: Added.
              (JSC::SlotVisitor::SlotVisitor): Used 'protected' and a little cheesy
              inheritance to give SlotVisitor all the attributes of MarkStack without
              making this change giant. Over time, we will move more behavior into
              SlotVisitor and its subclasses.
      
              * heap/MarkStack.h:
              * heap/NewSpace.h: Replaced MarkStack with SlotVisitor. Now no
              clients operate on a MarkStack.
      
              * runtime/ArgList.h:
              * runtime/JSCell.h:
              * runtime/JSObject.h:
              * runtime/ScopeChain.h:
              * runtime/SmallStrings.h:
              * runtime/Structure.h: Replaced MarkStack with SlotVisitor. Now no
              clients operate on a MarkStack.
      2011-06-16  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Oliver Hunt.
      
              Introduced SlotVisitor into the project
              https://bugs.webkit.org/show_bug.cgi?id=62820
      
              This resolves a class vs typedef forward declaration issue, and gives all
              exported symbols the correct names.
      
              * dom/EventListener.h:
              * dom/Node.h:
              * dom/NodeFilterCondition.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89069 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      6e1f8c1b
  11. 09 Jun, 2011 2 commits
    • ggaren@apple.com's avatar
      2011-06-09 Geoffrey Garen <ggaren@apple.com> · 28cfb358
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              Factored MarkedBlock set management into a helper class with a fast case Bloom filter
              https://bugs.webkit.org/show_bug.cgi?id=62413
              
              SunSpider reports a small speedup.
              
              This is in preparation for having ConservativeSet operate on arbitrary
              sets of MarkedBlocks, and in preparation for conservative scanning
              becoming proportionally more important than other GC activities.
      
              * GNUmakefile.list.am:
              * JavaScriptCore.gypi:
              * JavaScriptCore.xcodeproj/project.pbxproj: Build-o.
      
              * heap/ConservativeRoots.cpp:
              (JSC::ConservativeRoots::add):
              * heap/ConservativeRoots.h:
              (JSC::ConservativeRoots::ConservativeRoots): Operate on a MarkedBlockSet
              directly, instead of a Heap, so we can operate on subsets of the Heap
              instead.
              
              Use a TinyBloomFilter for single-cycle exclusion of most pointers. This
              is particularly important since we expect not to find our subject pointer
              in the MarkedBlock hash, and hash misses are more expensive than typical
              hash lookups because they have high collision rates.
              
              No need for single-pointer add() to be public anymore, since nobody uses it.
      
              * heap/Heap.cpp:
              (JSC::Heap::markRoots):
              * heap/Heap.h:
              (JSC::Heap::forEachCell):
              (JSC::Heap::forEachBlock): Use MarkedBlockSet since that's what
              ConservativeRoots relies on.
              
              Nixed contains(), since nobody uses it anymore.
      
              * heap/MarkedBlock.h:
              (WTF::MarkedBlockHash::hash): Added a faster hash taking advantage of
              the VM layout properties of MarkedBlocks.
      
              * heap/MarkedBlockSet.h: Added.
              (JSC::MarkedBlockSet::add):
              (JSC::MarkedBlockSet::remove):
              (JSC::MarkedBlockSet::recomputeFilter):
              (JSC::MarkedBlockSet::filter):
              (JSC::MarkedBlockSet::set):
              * heap/TinyBloomFilter.h: Added.
              (JSC::TinyBloomFilter::TinyBloomFilter):
              (JSC::TinyBloomFilter::add):
              (JSC::TinyBloomFilter::ruleOut): New helper class, used above.
      
              * interpreter/RegisterFile.cpp:
              (JSC::RegisterFile::gatherConservativeRoots): No need to specifically
              exclude values by tag -- the tiny bloom filter is already a register-register
              compare, so adding another "rule out" factor just slows things down.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      28cfb358
    • ggaren@apple.com's avatar
      2011-06-08 Geoffrey Garen <ggaren@apple.com> · 8a23d6ad
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              Factored a bunch of Heap functionality into stand-alone functors
              https://bugs.webkit.org/show_bug.cgi?id=62337
              
              This is in preparation for making these functors operate on arbitrary
              sets of MarkedBlocks.
      
              * JavaScriptCore.exp: This file is a small tragedy.
      
              * debugger/Debugger.cpp:
              (JSC::Debugger::recompileAllJSFunctions): Updated for type change and rename.
      
              * heap/HandleHeap.h:
              (JSC::HandleHeap::forEachStrongHandle): New function for iterating all
              strong handles, so we can play along in the functor game.
      
              * heap/Heap.cpp:
              (JSC::CountFunctor::CountFunctor::CountFunctor):
              (JSC::CountFunctor::CountFunctor::count):
              (JSC::CountFunctor::CountFunctor::returnValue):
              (JSC::CountFunctor::ClearMarks::operator()):
              (JSC::CountFunctor::ResetAllocator::operator()):
              (JSC::CountFunctor::Sweep::operator()):
              (JSC::CountFunctor::MarkCount::operator()):
              (JSC::CountFunctor::Size::operator()):
              (JSC::CountFunctor::Capacity::operator()):
              (JSC::CountFunctor::Count::operator()):
              (JSC::CountFunctor::CountIfGlobalObject::operator()):
              (JSC::CountFunctor::TakeIfEmpty::TakeIfEmpty):
              (JSC::CountFunctor::TakeIfEmpty::operator()):
              (JSC::CountFunctor::TakeIfEmpty::returnValue):
              (JSC::CountFunctor::RecordType::RecordType):
              (JSC::CountFunctor::RecordType::typeName):
              (JSC::CountFunctor::RecordType::operator()):
              (JSC::CountFunctor::RecordType::returnValue): These functors factor out
              behavior that used to be in the functions below.
      
              (JSC::Heap::clearMarks):
              (JSC::Heap::sweep):
              (JSC::Heap::objectCount):
              (JSC::Heap::size):
              (JSC::Heap::capacity):
              (JSC::Heap::protectedGlobalObjectCount):
              (JSC::Heap::protectedObjectCount):
              (JSC::Heap::protectedObjectTypeCounts):
              (JSC::Heap::objectTypeCounts):
              (JSC::Heap::resetAllocator):
              (JSC::Heap::freeBlocks):
              (JSC::Heap::shrink): Factored out behavior into the functors above.
      
              * heap/Heap.h:
              (JSC::Heap::forEachProtectedCell):
              (JSC::Heap::forEachCell):
              (JSC::Heap::forEachBlock): Added forEach* iteration templates. I chose
              functor-based templates instead of plain iterators because they're simpler
              to implement in this case and they require a lot less code at the call site.
      
              * heap/MarkedBlock.h:
              (JSC::MarkedBlock::VoidFunctor::returnValue): Default parent class for
              trivial functors.
      
              (JSC::MarkedBlock::forEachCell): Renamed forEach to forEachCell because
              we have a few different kind of "for each" now.
      
              * runtime/JSGlobalData.cpp:
              (WTF::Recompile::operator()):
              (JSC::JSGlobalData::JSGlobalData):
              (JSC::JSGlobalData::recompileAllJSFunctions): Updated for type change and rename.
      
              * runtime/JSGlobalData.h: Removed globalObjectCount because it was unused.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8a23d6ad
  12. 08 Jun, 2011 4 commits
    • ggaren@apple.com's avatar
      2011-06-08 Geoffrey Garen <ggaren@apple.com> · d7cca848
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              Took some responsibilities away from NewSpace
              https://bugs.webkit.org/show_bug.cgi?id=62325
              
              NewSpace is basically just an allocator now.
              
              Heap acts as a controller, responsible for managing the set of all
              MarkedBlocks.
              
              This is in preparation for moving parts of the controller logic into
              separate helper classes that can act on arbitrary sets of MarkedBlocks
              that may or may not be in NewSpace.
      
              * heap/Heap.cpp:
              (JSC::Heap::Heap):
              (JSC::Heap::destroy):
              (JSC::Heap::allocate):
              (JSC::Heap::markRoots):
              (JSC::Heap::clearMarks):
              (JSC::Heap::sweep):
              (JSC::Heap::objectCount):
              (JSC::Heap::size):
              (JSC::Heap::capacity):
              (JSC::Heap::collect):
              (JSC::Heap::resetAllocator):
              (JSC::Heap::allocateBlock):
              (JSC::Heap::freeBlocks):
              (JSC::Heap::shrink): Moved the set of MarkedBlocks from NewSpace to Heap,
              along with all functions that operate on the set of MarkedBlocks. Also
              moved responsibility for deciding whether to allocate a new MarkedBlock,
              and for allocating it.
      
              * heap/Heap.h:
              (JSC::Heap::contains):
              (JSC::Heap::forEach): Ditto.
      
              * heap/NewSpace.cpp:
              (JSC::NewSpace::addBlock):
              (JSC::NewSpace::removeBlock):
              (JSC::NewSpace::resetAllocator):
              * heap/NewSpace.h:
              (JSC::NewSpace::waterMark):
              (JSC::NewSpace::allocate): Ditto.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d7cca848
    • ggaren@apple.com's avatar
      2011-06-08 Geoffrey Garen <ggaren@apple.com> · 788b601d
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              Some more MarkedSpace => NewSpace renaming
              https://bugs.webkit.org/show_bug.cgi?id=62305
      
              * JavaScriptCore.exp:
              * JavaScriptCore.order:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
              * heap/Heap.cpp:
              (JSC::Heap::Heap):
              (JSC::Heap::destroy):
              (JSC::Heap::reportExtraMemoryCostSlowCase):
              (JSC::Heap::allocate):
              (JSC::Heap::markRoots):
              (JSC::Heap::objectCount):
              (JSC::Heap::size):
              (JSC::Heap::capacity):
              (JSC::Heap::collect):
              (JSC::Heap::isValidAllocation):
              * heap/Heap.h:
              (JSC::Heap::markedSpace):
              (JSC::Heap::contains):
              (JSC::Heap::forEach):
              (JSC::Heap::allocate):
              * runtime/JSCell.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88379 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      788b601d
    • ggaren@apple.com's avatar
      2011-06-08 Geoffrey Garen <ggaren@apple.com> · c13d0d86
      ggaren@apple.com authored
              Reviewed by Darin Adler.
      
              Moved MarkedSpace.* to NewSpace.* in preparation for more renaming
              https://bugs.webkit.org/show_bug.cgi?id=62268
      
              * CMakeLists.txt:
              * GNUmakefile.list.am:
              * JavaScriptCore.gypi:
              * JavaScriptCore.pro:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
              * JavaScriptCore.xcodeproj/project.pbxproj:
              * heap/Heap.h:
              * heap/MarkedBlock.h:
              * heap/MarkedSpace.cpp: Removed.
              * heap/MarkedSpace.h: Removed.
              * heap/NewSpace.cpp: Copied from Source/JavaScriptCore/heap/MarkedSpace.cpp.
              * heap/NewSpace.h: Copied from Source/JavaScriptCore/heap/MarkedSpace.h.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88368 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c13d0d86
    • ggaren@apple.com's avatar
      2011-06-07 Geoffrey Garen <ggaren@apple.com> · 4f1e836c
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              Split 'reset' into 'collect' and 'resetAllocator'
              https://bugs.webkit.org/show_bug.cgi?id=62267
      
              * heap/Heap.cpp:
              (JSC::Heap::allocate):
              (JSC::Heap::collectAllGarbage):
              (JSC::Heap::collect):
              * heap/Heap.h:
              * heap/MarkedBlock.h:
              (JSC::MarkedBlock::resetAllocator):
              * heap/MarkedSpace.cpp:
              (JSC::MarkedSpace::resetAllocator):
              * heap/MarkedSpace.h:
              (JSC::MarkedSpace::SizeClass::resetAllocator):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88328 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4f1e836c
  13. 29 May, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-05-29 Geoffrey Garen <ggaren@apple.com> · 58c6e459
      ggaren@apple.com authored
              Reviewed by Sam Weinig.
      
              Some heap refactoring
              https://bugs.webkit.org/show_bug.cgi?id=61704
              
              SunSpider says no change.
      
              * JavaScriptCore.exp: Export!
      
              * heap/Heap.cpp: COLLECT_ON_EVERY_ALLOCATION can actually do so now.
      
              (JSC::Heap::Heap): Changed Heap sub-objects to point to the heap.
      
              (JSC::Heap::allocate): Changed inline allocation code to only select the
              size class, since this can be optimized out at compile time -- everything
              else is now inlined into this out-of-line function.
              
              No need to duplicate ASSERTs made in our caller.
      
              * heap/Heap.h:
              (JSC::Heap::heap):
              (JSC::Heap::isMarked):
              (JSC::Heap::testAndSetMarked):
              (JSC::Heap::testAndClearMarked):
              (JSC::Heap::setMarked): Call directly into MarkedBlock instead of adding
              a layer of indirection through MarkedSpace.
      
              (JSC::Heap::allocate): See above.
      
              * heap/MarkedBlock.cpp:
              (JSC::MarkedBlock::create):
              (JSC::MarkedBlock::MarkedBlock):
              * heap/MarkedBlock.h: Changed Heap sub-objects to point to the heap.
      
              * heap/MarkedSpace.cpp:
              (JSC::MarkedSpace::MarkedSpace):
              (JSC::MarkedSpace::allocateBlock):
              * heap/MarkedSpace.h:
              (JSC::MarkedSpace::allocate): Updated to match changes above.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@87653 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      58c6e459
  14. 27 May, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-05-26 Geoffrey Garen <ggaren@apple.com> · d887ac60
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              Optimized ConservativeSet to avoid double-visiting objects
              https://bugs.webkit.org/show_bug.cgi?id=61592
              
              SunSpider thinks this might be a 1% speedup
      
              * heap/ConservativeRoots.h:
              (JSC::ConservativeRoots::add): Use testAndClearMarked to avoid double-visiting
              an object.
      
              * heap/Heap.h:
              (JSC::Heap::isMarked):
              (JSC::Heap::testAndSetMarked):
              (JSC::Heap::testAndClearMarked):
              (JSC::Heap::setMarked): Added testAndClearMarked. Changed argument type
              to void*, since clients want to ask questions about arbitrary pointers
              into the heap, even when they aren't known to be JSCells.
      
              * heap/MarkedBlock.h:
              (JSC::MarkedBlock::testAndClearMarked):
              * heap/MarkedSpace.h:
              (JSC::MarkedSpace::isMarked):
              (JSC::MarkedSpace::testAndSetMarked):
              (JSC::MarkedSpace::testAndClearMarked):
              (JSC::MarkedSpace::setMarked):
              (JSC::MarkedSpace::contains): Ditto.
      
              * wtf/Bitmap.h:
              (WTF::::testAndClear): New function for ConservativeRoots's inverted
              marking pass.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@87522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d887ac60
  15. 26 May, 2011 2 commits
  16. 11 May, 2011 1 commit
  17. 10 May, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-05-10 Geoffrey Garen <ggaren@apple.com> · 046c1e06
      ggaren@apple.com authored
              Reviewed by Darin Adler.
      
              Fixed up some #include dependencies so the WriteBarrier class can actually call Heap::writeBarrier
              https://bugs.webkit.org/show_bug.cgi?id=60532
      
              * GNUmakefile.list.am:
              * JavaScriptCore.gypi:
              * JavaScriptCore.xcodeproj/project.pbxproj: Build!
      
              * heap/Handle.h: Moved HandleTypes to its own header because that's the
              WebKit style, and it was necessary to resolve a circular dependency
              between Handle.h and WriteBarrier.h.
      
              * heap/Heap.h:
              (JSC::Heap::writeBarrier): Added an inline no-op writeBarrier(), to
              verify that all the code is in the right place.
      
              * heap/MarkStack.h: Moved WriteBarrier operations to WriteBarrier.h to
              resolve a circular dependency.
      
              * runtime/ArgList.h:
              * runtime/JSCell.h: #include WriteBarrier.h since we don't get it for
              free anymore.
      
              * runtime/PropertyMapHashTable.h:
              (JSC::PropertyTable::PropertyTable): Call the real writeBarrier()
              function, now that it exists.
      
              * runtime/SmallStrings.h: Removed a stray #include to resolve a circular
              dependency.
      
              * runtime/WriteBarrier.h:
              (JSC::WriteBarrierBase::set):
              (JSC::MarkStack::append):
              (JSC::MarkStack::appendValues): Updated to match the changes above.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86209 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      046c1e06
  18. 21 Apr, 2011 1 commit
    • oliver@apple.com's avatar
      2011-04-21 Oliver Hunt <oliver@apple.com> · 433d02f9
      oliver@apple.com authored
              Reviewed by Geoffrey Garen.
      
              Start moving to a general visitor pattern for GC traversal
              https://bugs.webkit.org/show_bug.cgi?id=59141
      
              This is just a rename:
                  markChildren -> visitChildren
                  markAggregate -> visitAggregate
                  markStack -> visitor
                  MarkStack -> typedef'd to SlotVisitor
      
              * API/JSCallbackObject.h:
              (JSC::JSCallbackObjectData::visitChildren):
              (JSC::JSCallbackObjectData::JSPrivatePropertyMap::visitChildren):
              (JSC::JSCallbackObject::visitChildren):
              * JavaScriptCore.exp:
              * bytecode/CodeBlock.cpp:
              (JSC::CodeBlock::visitStructures):
              (JSC::EvalCodeCache::visitAggregate):
              (JSC::CodeBlock::visitAggregate):
              * bytecode/CodeBlock.h:
              * bytecode/EvalCodeCache.h:
              * bytecode/Instruction.h:
              (JSC::PolymorphicAccessStructureList::visitAggregate):
              * bytecode/StructureStubInfo.cpp:
              (JSC::StructureStubInfo::visitAggregate):
              * bytecode/StructureStubInfo.h:
              * debugger/DebuggerActivation.cpp:
              (JSC::DebuggerActivation::visitChildren):
              * debugger/DebuggerActivation.h:
              * heap/HandleHeap.cpp:
              (JSC::WeakHandleOwner::isReachableFromOpaqueRoots):
              (JSC::HandleHeap::markStrongHandles):
              (JSC::HandleHeap::markWeakHandles):
              * heap/HandleHeap.h:
              * heap/HandleStack.cpp:
              (JSC::HandleStack::mark):
              * heap/HandleStack.h:
              * heap/Heap.cpp:
              (JSC::Heap::markProtectedObjects):
              (JSC::Heap::markTempSortVectors):
              (JSC::Heap::markRoots):
              * heap/Heap.h:
              * heap/MarkStack.cpp:
              (JSC::MarkStack::visitChildren):
              (JSC::MarkStack::drain):
              * heap/MarkStack.h:
              (JSC::HeapRootVisitor::HeapRootVisitor):
              (JSC::HeapRootVisitor::mark):
              (JSC::HeapRootVisitor::visitor):
              * heap/MarkedSpace.h:
              * runtime/ArgList.cpp:
              (JSC::MarkedArgumentBuffer::markLists):
              * runtime/ArgList.h:
              * runtime/Arguments.cpp:
              (JSC::Arguments::visitChildren):
              * runtime/Arguments.h:
              * runtime/Executable.cpp:
              (JSC::EvalExecutable::visitChildren):
              (JSC::ProgramExecutable::visitChildren):
              (JSC::FunctionExecutable::visitChildren):
              * runtime/Executable.h:
              * runtime/GetterSetter.cpp:
              (JSC::GetterSetter::visitChildren):
              * runtime/GetterSetter.h:
              (JSC::GetterSetter::createStructure):
              * runtime/JSAPIValueWrapper.h:
              (JSC::JSAPIValueWrapper::createStructure):
              * runtime/JSActivation.cpp:
              (JSC::JSActivation::visitChildren):
              * runtime/JSActivation.h:
              * runtime/JSArray.cpp:
              (JSC::JSArray::visitChildren):
              * runtime/JSArray.h:
              (JSC::JSArray::visitDirect):
              * runtime/JSCell.h:
              (JSC::JSCell::JSCell::visitChildren):
              * runtime/JSFunction.cpp:
              (JSC::JSFunction::visitChildren):
              * runtime/JSFunction.h:
              * runtime/JSGlobalObject.cpp:
              (JSC::visitIfNeeded):
              (JSC::JSGlobalObject::visitChildren):
              * runtime/JSGlobalObject.h:
              * runtime/JSONObject.cpp:
              * runtime/JSObject.cpp:
              (JSC::JSObject::visitChildren):
              * runtime/JSObject.h:
              (JSC::JSObject::visitDirect):
              * runtime/JSPropertyNameIterator.cpp:
              (JSC::JSPropertyNameIterator::visitChildren):
              * runtime/JSPropertyNameIterator.h:
              (JSC::JSPropertyNameIterator::createStructure):
              * runtime/JSStaticScopeObject.cpp:
              (JSC::JSStaticScopeObject::visitChildren):
              * runtime/JSStaticScopeObject.h:
              * runtime/JSTypeInfo.h:
              (JSC::TypeInfo::TypeInfo):
              (JSC::TypeInfo::overridesVisitChildren):
              * runtime/JSWrapperObject.cpp:
              (JSC::JSWrapperObject::visitChildren):
              * runtime/JSWrapperObject.h:
              * runtime/JSZombie.h:
              (JSC::JSZombie::visitChildren):
              * runtime/NativeErrorConstructor.cpp:
              (JSC::NativeErrorConstructor::visitChildren):
              * runtime/NativeErrorConstructor.h:
              * runtime/RegExpObject.cpp:
              (JSC::RegExpObject::visitChildren):
              * runtime/RegExpObject.h:
              * runtime/ScopeChain.cpp:
              (JSC::ScopeChainNode::visitChildren):
              * runtime/ScopeChain.h:
              * runtime/SmallStrings.cpp:
              (JSC::SmallStrings::visitChildren):
              * runtime/SmallStrings.h:
              * runtime/Structure.cpp:
              (JSC::Structure::Structure):
              (JSC::Structure::visitChildren):
              * runtime/Structure.h:
              * runtime/StructureChain.cpp:
              (JSC::StructureChain::visitChildren):
              * runtime/StructureChain.h:
              (JSC::StructureChain::createStructure):
      2011-04-21  Oliver Hunt  <oliver@apple.com>
      
              Reviewed by Geoffrey Garen.
      
              Start moving to a general visitor pattern for GC traversal
              https://bugs.webkit.org/show_bug.cgi?id=59141
      
              This is just a rename:
                  markChildren -> visitChildren
                  markAggregate -> visitAggregate
                  markStack -> visitor
                  MarkStack -> typedef'd to SlotVisitor
      
              * UserObjectImp.cpp:
              (UserObjectImp::visitChildren):
      2011-04-21  Oliver Hunt  <oliver@apple.com>
      
              Reviewed by Geoffrey Garen.
      
              Start moving to a general visitor pattern for GC traversal
              https://bugs.webkit.org/show_bug.cgi?id=59141
      
              This is just a rename:
                  markChildren -> visitChildren
                  markAggregate -> visitAggregate
                  markStack -> visitor
                  MarkStack -> typedef'd to SlotVisitor
      
              * bindings/js/JSAttrCustom.cpp:
              (WebCore::JSAttr::visitChildren):
              * bindings/js/JSAudioConstructor.cpp:
              (WebCore::constructAudio):
              * bindings/js/JSCSSRuleCustom.cpp:
              (WebCore::JSCSSRule::visitChildren):
              * bindings/js/JSCSSStyleDeclarationCustom.cpp:
              (WebCore::JSCSSStyleDeclaration::visitChildren):
              * bindings/js/JSDOMBinding.cpp:
              (WebCore::visitActiveObjectsForContext):
              (WebCore::markDOMObjectWrapper):
              * bindings/js/JSDOMBinding.h:
              * bindings/js/JSDOMGlobalObject.cpp:
              (WebCore::JSDOMGlobalObject::visitChildren):
              * bindings/js/JSDOMGlobalObject.h:
              * bindings/js/JSDOMImplementationCustom.cpp:
              (WebCore::JSDOMImplementation::visitChildren):
              * bindings/js/JSDOMWindowCustom.cpp:
              (WebCore::JSDOMWindow::visitChildren):
              * bindings/js/JSDOMWindowShell.cpp:
              (WebCore::JSDOMWindowShell::visitChildren):
              * bindings/js/JSDOMWindowShell.h:
              * bindings/js/JSDocumentCustom.cpp:
              (WebCore::JSDocument::visitChildren):
              * bindings/js/JSElementCustom.cpp:
              (WebCore::JSElement::visitChildren):
              * bindings/js/JSEventListener.cpp:
              (WebCore::JSEventListener::markJSFunction):
              * bindings/js/JSEventListener.h:
              * bindings/js/JSHTMLCanvasElementCustom.cpp:
              (WebCore::JSHTMLCanvasElement::visitChildren):
              * bindings/js/JSHTMLLinkElementCustom.cpp:
              (WebCore::JSHTMLLinkElement::visitChildren):
              * bindings/js/JSHTMLStyleElementCustom.cpp:
              (WebCore::JSHTMLStyleElement::visitChildren):
              * bindings/js/JSImageConstructor.cpp:
              (WebCore::constructImage):
              * bindings/js/JSJavaScriptAudioNodeCustom.cpp:
              (WebCore::JSJavaScriptAudioNode::visitChildren):
              * bindings/js/JSMessageChannelCustom.cpp:
              (WebCore::JSMessageChannel::visitChildren):
              * bindings/js/JSMessagePortCustom.cpp:
              (WebCore::JSMessagePort::visitChildren):
              * bindings/js/JSNamedNodeMapCustom.cpp:
              (WebCore::JSNamedNodeMapOwner::isReachableFromOpaqueRoots):
              (WebCore::JSNamedNodeMap::visitChildren):
              * bindings/js/JSNavigatorCustom.cpp:
              (WebCore::JSNavigator::visitChildren):
              * bindings/js/JSNodeCustom.cpp:
              (WebCore::isObservable):
              (WebCore::isReachableFromDOM):
              (WebCore::JSNodeOwner::isReachableFromOpaqueRoots):
              (WebCore::JSNode::visitChildren):
              * bindings/js/JSNodeCustom.h:
              * bindings/js/JSNodeFilterCondition.cpp:
              (WebCore::JSNodeFilterCondition::WeakOwner::isReachableFromOpaqueRoots):
              * bindings/js/JSNodeFilterCondition.h:
              * bindings/js/JSNodeFilterCustom.cpp:
              (WebCore::JSNodeFilter::visitChildren):
              * bindings/js/JSNodeIteratorCustom.cpp:
              (WebCore::JSNodeIterator::visitChildren):
              * bindings/js/JSNodeListCustom.cpp:
              (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):
              * bindings/js/JSProcessingInstructionCustom.cpp:
              (WebCore::JSProcessingInstruction::visitChildren):
              * bindings/js/JSSVGElementInstanceCustom.cpp:
              (WebCore::JSSVGElementInstance::visitChildren):
              * bindings/js/JSSharedWorkerCustom.cpp:
              (WebCore::JSSharedWorker::visitChildren):
              * bindings/js/JSStyleSheetCustom.cpp:
              (WebCore::JSStyleSheet::visitChildren):
              * bindings/js/JSTreeWalkerCustom.cpp:
              (WebCore::JSTreeWalker::visitChildren):
              * bindings/js/JSWebGLRenderingContextCustom.cpp:
              (WebCore::JSWebGLRenderingContext::visitChildren):
              * bindings/js/JSWebKitAnimationListCustom.cpp:
              (WebCore::JSWebKitAnimationList::visitChildren):
              * bindings/js/JSWorkerContextCustom.cpp:
              (WebCore::JSWorkerContext::visitChildren):
              * bindings/js/JSXMLHttpRequestCustom.cpp:
              (WebCore::JSXMLHttpRequest::visitChildren):
              * bindings/js/JSXMLHttpRequestUploadCustom.cpp:
              (WebCore::JSXMLHttpRequestUpload::visitChildren):
              * bindings/scripts/CodeGeneratorJS.pm:
              * bridge/qt/qt_instance.cpp:
              (JSC::Bindings::QtRuntimeObject::visitChildren):
              (JSC::Bindings::QtInstance::markAggregate):
              * bridge/qt/qt_instance.h:
              * bridge/qt/qt_pixmapruntime.cpp:
              * bridge/qt/qt_runtime.cpp:
              (JSC::Bindings::QtRuntimeMetaMethod::visitChildren):
              * bridge/qt/qt_runtime.h:
              * dom/EventListener.h:
              (WebCore::EventListener::visitJSFunction):
              * dom/EventTarget.h:
              (WebCore::EventTarget::visitJSEventListeners):
              * dom/Node.h:
              * dom/NodeFilterCondition.h:
              (WebCore::NodeFilterCondition::visitAggregate):
              * page/DOMWindow.h:
              * workers/WorkerContext.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@84556 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      433d02f9
  19. 10 Apr, 2011 1 commit
    • ggaren@apple.com's avatar
      Moved Heap.h and Heap.cpp to the heap folder, because anything less · 0c5bd6e1
      ggaren@apple.com authored
      would be uncivilized.
      
      Rubber-stamped by Beth Dakin.
      
      Source/JavaScriptCore: 
      
      * Android.mk:
      * CMakeLists.txt:
      * GNUmakefile.list.am:
      * JavaScriptCore.gypi:
      * JavaScriptCore.pro:
      * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * heap/Heap.cpp: Copied from JavaScriptCore/runtime/Heap.cpp.
      * heap/Heap.h: Copied from JavaScriptCore/runtime/Heap.h.
      * runtime/Heap.cpp: Removed.
      * runtime/Heap.h: Removed.
      
      Source/WebCore: 
      
      * ForwardingHeaders/heap/Heap.h: Copied from WebCore/ForwardingHeaders/runtime/Heap.h.
      * ForwardingHeaders/runtime/Heap.h: Removed.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@83418 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      0c5bd6e1
  20. 15 Mar, 2011 2 commits
    • ggaren@apple.com's avatar
      2011-03-15 Geoffrey Garen <ggaren@apple.com> · 1c5376a9
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              Removed a few more deprecatedAppends, and removed HeapRoot<T>
              https://bugs.webkit.org/show_bug.cgi?id=56422
              
              Added HeapRootMarker, a privileged class for marking direct heap roots
              that are iterated during each garbage collection. This is easier to use
              and more reliable than HeapRoot<T>, so I've removed HeapRoot<T>.
      
              * debugger/Debugger.cpp:
              (JSC::evaluateInGlobalCallFrame):
              * debugger/DebuggerCallFrame.cpp:
              (JSC::DebuggerCallFrame::evaluate):
              * interpreter/CallFrame.h:
              (JSC::ExecState::exception):
              * jit/JITStubs.cpp:
              (JSC::DEFINE_STUB_FUNCTION):
              * runtime/Completion.cpp:
              (JSC::evaluate): exception is no longer a HeapRoot<T>, so no need to
              call .get() on it.
      
              * runtime/Heap.cpp:
              (JSC::Heap::markProtectedObjects):
              (JSC::Heap::markTempSortVectors):
              (JSC::Heap::markRoots):
              * runtime/Heap.h: Updated to use HeapRootMarker.
      
              * runtime/JSCell.h:
              (JSC::JSCell::MarkStack::append): Added private functions for
              HeapRootMarker to use.
      
              * runtime/JSGlobalData.h: exception is no longer a HeapRoot<T>.
      
              * runtime/MarkStack.h:
              (JSC::HeapRootMarker::HeapRootMarker):
              (JSC::HeapRootMarker::mark): Added private functions for
              HeapRootMarker to use.
      
              * runtime/SmallStrings.cpp:
              (JSC::SmallStrings::markChildren): Updated to use HeapRootMarker.
      
              * runtime/SmallStrings.h:
              (JSC::SmallStrings::emptyString):
              (JSC::SmallStrings::singleCharacterString):
              (JSC::SmallStrings::singleCharacterStrings): Updated to use HeapRootMarker.
      
              * runtime/WriteBarrier.h: Removed HeapRoot<T>.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1c5376a9
    • oliver@apple.com's avatar
      2011-03-15 Oliver Hunt <oliver@apple.com> · 7b1725a7
      oliver@apple.com authored
              Reviewed by Geoffrey Garen.
      
              Introduce Local<T> to allow us to start moving to precise marking of locals
              https://bugs.webkit.org/show_bug.cgi?id=56394
      
              Introduce a new handle type, Local<T> and a scoping mechanism
              LocalScope to allow us to start moving towards precise marking
              of temporaries and local variables.
      
              We also start to use the new Local<> type in the JSON stringifier
              so that we can have some coverage of their behaviour in the initial
              checkin.
      
              * GNUmakefile.am:
              * JavaScriptCore.gypi:
              * JavaScriptCore.pro:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
              * JavaScriptCore.xcodeproj/project.pbxproj:
              * collector/handles/Handle.h:
              (JSC::::asObject):
              * collector/handles/HandleStack.cpp: Added.
              (JSC::HandleStack::HandleStack):
              (JSC::HandleStack::mark):
              (JSC::HandleStack::grow):
              * collector/handles/HandleStack.h: Added.
              (JSC::HandleStack::enterScope):
              (JSC::HandleStack::zapTo):
              (JSC::HandleStack::leaveScope):
              (JSC::HandleStack::push):
              * collector/handles/Local.h: Added.
              (JSC::Local::internalSet):
              (JSC::::Local):
              (JSC::::operator):
              (JSC::LocalStack::LocalStack):
              (JSC::LocalStack::peek):
              (JSC::LocalStack::pop):
              (JSC::LocalStack::push):
              (JSC::LocalStack::isEmpty):
              (JSC::LocalStack::size):
              * collector/handles/LocalScope.h: Added.
              (JSC::LocalScope::LocalScope):
              (JSC::LocalScope::~LocalScope):
              (JSC::LocalScope::release):
              * runtime/Heap.cpp:
              (JSC::Heap::markRoots):
              * runtime/Heap.h:
              (JSC::Heap::allocateLocalHandle):
              (JSC::Heap::handleStack):
              * runtime/JSCell.h:
              (JSC::JSCell::::getString):
              * runtime/JSGlobalData.cpp:
              (JSC::JSGlobalData::JSGlobalData):
              * runtime/JSGlobalData.h:
              (JSC::JSGlobalData::allocateLocalHandle):
              * runtime/JSONObject.cpp:
              (JSC::Stringifier::Stringifier):
              (JSC::Stringifier::stringify):
              (JSC::Stringifier::appendStringifiedValue):
              (JSC::Stringifier::Holder::Holder):
              (JSC::Walker::Walker):
              (JSC::Walker::walk):
              (JSC::JSONProtoFuncParse):
              (JSC::JSONProtoFuncStringify):
              (JSC::JSONStringify):
              * runtime/JSONObject.h:
              * runtime/MarkStack.h:
              (JSC::MarkStack::appendValues):
              (JSC::MarkStack::appendSlots):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7b1725a7
  21. 13 Mar, 2011 1 commit
    • ggaren@apple.com's avatar
      A few Heap-related renames (sans file moves, which should come next) · 123f685d
      ggaren@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=56283
              
      Reviewed by Sam Weinig.
      
      ConservativeSet => ConservativeRoots. "Set" was misleading, since items
      are not uniqued. Also, "Roots" is more specific about what's in the set.
              
      MachineStackMarker => MachineThreads. "Threads" is more descriptive of
      the fact that this class maintains a set of all threads using JSC.
      "Stack" was misleading, since this class traverses stacks and registers.
      "Mark" was misleading, since this class doesn't mark anything anymore.
              
      registerThread => addCurrentThread. "Current" is more specific.
      unregisterThread => removeCurrentThread. "Current" is more specific.
              
      "currentThreadRegistrar" => threadSpecific. The only point of this data
      structure is to register a thread-specific destructor with a pointer to
      this.
              
      "mark...Conservatively" => "gather". "Mark" is not true, since these
      functions don't mark anything. "Conservatively" is redundant, since they
      take "ConservativeRoots" as an argument.
      
      * API/APIShims.h:
      (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
      * JavaScriptCore.exp:
      * runtime/ConservativeSet.cpp:
      (JSC::ConservativeRoots::grow):
      (JSC::ConservativeRoots::add):
      * runtime/ConservativeSet.h:
      (JSC::ConservativeRoots::ConservativeRoots):
      (JSC::ConservativeRoots::~ConservativeRoots):
      (JSC::ConservativeRoots::size):
      (JSC::ConservativeRoots::roots):
      * runtime/Heap.cpp:
      (JSC::Heap::Heap):
      (JSC::Heap::markRoots):
      * runtime/Heap.h:
      (JSC::Heap::machineThreads):
      * runtime/JSGlobalData.h:
      (JSC::JSGlobalData::makeUsableFromMultipleThreads):
      * runtime/MachineStackMarker.cpp:
      (JSC::MachineThreads::MachineThreads):
      (JSC::MachineThreads::~MachineThreads):
      (JSC::MachineThreads::makeUsableFromMultipleThreads):
      (JSC::MachineThreads::addCurrentThread):
      (JSC::MachineThreads::removeThread):
      (JSC::MachineThreads::removeCurrentThread):
      (JSC::MachineThreads::gatherFromCurrentThreadInternal):
      (JSC::MachineThreads::gatherFromCurrentThread):
      (JSC::MachineThreads::gatherFromOtherThread):
      (JSC::MachineThreads::gatherConservativeRoots):
      * runtime/MachineStackMarker.h:
      * runtime/MarkStack.h:
      (JSC::MarkStack::append):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80995 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      123f685d
  22. 08 Mar, 2011 1 commit
    • oliver@apple.com's avatar
      2011-03-07 Oliver Hunt <oliver@apple.com> · ba10bec9
      oliver@apple.com authored
              Reviewed by Gavin Barraclough.
      
              Make CodeBlock GC write barrier safe
              https://bugs.webkit.org/show_bug.cgi?id=55910
      
              In order to make CodeBlock WriteBarrier safe it was necessary
              to make it have a single GC owner, and for that reason I have
              made ExecutableBase a GC allocated object.  This required
              updating their creation routines as well as all sites that hold
              a reference to them.  GC objects that held Executable's have been
              converted to WriteBarriers, and all other sites now use Global<>.
      
              As an added benefit this gets rid of JSGlobalData's list of
              GlobalCodeBlocks.
      
              Perf testing shows a 0.5% progression on v8, vs. a 0.3% regression
              on SunSpider.  Given none of the tests that show regressions
              demonstrate a regression on their own, and sampling shows up nothing.
              I suspect we're just getting one or two additional gc passes at
              the end of the run.
      
              * bytecode/CodeBlock.cpp:
              (JSC::CodeBlock::dump):
              (JSC::CodeBlock::CodeBlock):
              (JSC::EvalCodeCache::markAggregate):
              (JSC::CodeBlock::markAggregate):
              * bytecode/CodeBlock.h:
              (JSC::CodeBlock::ownerExecutable):
              (JSC::CodeBlock::addConstant):
              (JSC::CodeBlock::constantRegister):
              (JSC::CodeBlock::getConstant):
              (JSC::CodeBlock::addFunctionDecl):
              (JSC::CodeBlock::addFunctionExpr):
              (JSC::GlobalCodeBlock::GlobalCodeBlock):
              (JSC::ExecState::r):
              * bytecode/EvalCodeCache.h:
              (JSC::EvalCodeCache::get):
              * bytecode/SamplingTool.h:
              (JSC::ScriptSampleRecord::ScriptSampleRecord):
              * bytecompiler/BytecodeGenerator.cpp:
              (JSC::BytecodeGenerator::addConstantValue):
              (JSC::BytecodeGenerator::emitEqualityOp):
              * bytecompiler/BytecodeGenerator.h:
              (JSC::BytecodeGenerator::makeFunction):
              * debugger/Debugger.cpp:
              (JSC::evaluateInGlobalCallFrame):
              * debugger/DebuggerCallFrame.cpp:
              (JSC::DebuggerCallFrame::evaluate):
              * interpreter/Interpreter.cpp:
              (JSC::Interpreter::callEval):
              * jit/JITInlineMethods.h:
              (JSC::JIT::emitLoadDouble):
              (JSC::JIT::emitLoadInt32ToDouble):
              * jit/JITStubs.cpp:
              (JSC::JITThunks::JITThunks):
              (JSC::JITThunks::hostFunctionStub):
              (JSC::JITThunks::clearHostFunctionStubs):
              * jit/JITStubs.h:
              * runtime/Completion.cpp:
              (JSC::checkSyntax):
              (JSC::evaluate):
              * runtime/Executable.cpp:
              (JSC::EvalExecutable::EvalExecutable):
              (JSC::ProgramExecutable::ProgramExecutable):
              (JSC::FunctionExecutable::FunctionExecutable):
              (JSC::FunctionExecutable::~FunctionExecutable):
              (JSC::EvalExecutable::markChildren):
              (JSC::ProgramExecutable::markChildren):
              (JSC::FunctionExecutable::markChildren):
              (JSC::FunctionExecutable::fromGlobalCode):
              * runtime/Executable.h:
              (JSC::ExecutableBase::ExecutableBase):
              (JSC::ExecutableBase::createStructure):
              (JSC::NativeExecutable::create):
              (JSC::NativeExecutable::NativeExecutable):
              (JSC::VPtrHackExecutable::VPtrHackExecutable):
              (JSC::ScriptExecutable::ScriptExecutable):
              (JSC::EvalExecutable::create):
              (JSC::EvalExecutable::createStructure):
              (JSC::ProgramExecutable::create):
              (JSC::ProgramExecutable::createStructure):
              (JSC::FunctionExecutable::create):
              (JSC::FunctionExecutable::createStructure):
              * runtime/FunctionConstructor.cpp:
              (JSC::constructFunction):
              * runtime/Heap.cpp:
              (JSC::Heap::destroy):
              (JSC::Heap::markRoots):
              * runtime/Heap.h:
              * runtime/JSActivation.cpp:
              (JSC::JSActivation::JSActivation):
              (JSC::JSActivation::markChildren):
              * runtime/JSActivation.h:
              (JSC::JSActivation::JSActivationData::JSActivationData):
              * runtime/JSCell.h:
              * runtime/JSFunction.cpp:
              (JSC::JSFunction::JSFunction):
              (JSC::JSFunction::~JSFunction):
              (JSC::JSFunction::markChildren):
              * runtime/JSFunction.h:
              * runtime/JSGlobalData.cpp:
              (JSC::JSGlobalData::storeVPtrs):
              (JSC::JSGlobalData::JSGlobalData):
              (JSC::JSGlobalData::getHostFunction):
              * runtime/JSGlobalData.h:
              * runtime/JSGlobalObjectFunctions.cpp:
              (JSC::globalFuncEval):
              * runtime/JSObject.cpp:
              * runtime/JSStaticScopeObject.cpp:
              (JSC::JSStaticScopeObject::markChildren):
              * runtime/JSStaticScopeObject.h:
              (JSC::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
              (JSC::JSStaticScopeObject::JSStaticScopeObject):
              * runtime/JSZombie.cpp:
              (JSC::JSZombie::leakedZombieStructure):
              * runtime/JSZombie.h:
              (JSC::JSZombie::createStructure):
              * runtime/MarkedSpace.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ba10bec9
  23. 01 Mar, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-03-01 Geoffrey Garen <ggaren@apple.com> · 2006beef
      ggaren@apple.com authored
              Reviewed by Sam Weinig.
      
              Rolled back in r79627 now that the underlying cause for it crashing is fixed.
              https://bugs.webkit.org/show_bug.cgi?id=55159
      
              * JavaScriptCore.exp:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
              * JavaScriptCore.xcodeproj/project.pbxproj:
              * runtime/Heap.cpp:
              (JSC::Heap::allocateSlowCase):
              * runtime/Heap.h:
              * runtime/JSCell.h:
              (JSC::JSCell::MarkedSpace::sizeClassFor):
              (JSC::JSCell::Heap::allocate):
              (JSC::JSCell::JSCell::operator new):
              * runtime/MarkedBlock.h:
              * runtime/MarkedSpace.cpp:
              (JSC::MarkedSpace::MarkedSpace):
              (JSC::MarkedSpace::allocateBlock):
              (JSC::MarkedSpace::reset):
              * runtime/MarkedSpace.h:
              (JSC::MarkedSpace::SizeClass::SizeClass):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80052 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2006beef
  24. 25 Feb, 2011 1 commit
  25. 24 Feb, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-02-24 Geoffrey Garen <ggaren@apple.com> · c4bbdf58
      ggaren@apple.com authored
              Reviewed by Darin Adler.
      
              Variable-sized allocation (but still capped at 64 bytes)
              https://bugs.webkit.org/show_bug.cgi?id=55159
              
              SunSpider reports no change.
      
              * JavaScriptCore.exp: Some day, I hope not to have to edit this file.
      
              * runtime/Heap.cpp:
              (JSC::Heap::allocateSlowCase): Split allocation into a fast and slow
              case, so the fast case can inline size class selection and turn it into
              a compile-time constant.
              
              Changed the collect-on-every allocation debugging switch to collect only
              on every slow allocation, so you can still flip the switch without
              recompiling the world. This may also be preferable for debugging purposes,
              since collecting after every single allocation can be unusably slow,
              and can mask problems by running destructors early.
      
              * runtime/Heap.h: Ditto.
      
              * runtime/JSCell.h:
              (JSC::JSCell::MarkedSpace::sizeClassFor):
              (JSC::JSCell::Heap::allocate):
              (JSC::JSCell::JSCell::operator new): The inlining mentioned above.
      
              * runtime/MarkedBlock.h: Dropped the block size from 256KB to 16KB. With
              multiple size classes, allocating a full 256KB for the first allocation
              in a given class can be pathologically wasteful. (8KB, or 4KB Mac and
              8KB Windows, would be even better, but that seems to be a peformance
              regression for now.)
              
              * runtime/MarkedSpace.cpp:
              (JSC::MarkedSpace::MarkedSpace):
              (JSC::MarkedSpace::allocateBlock):
              (JSC::MarkedSpace::reset): There's more than one size class now, and its
              cell size is not constant.
      
              * runtime/MarkedSpace.h:
              (JSC::MarkedSpace::SizeClass::SizeClass): Ditto.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c4bbdf58
  26. 18 Feb, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-02-18 Geoffrey Garen <ggaren@apple.com> · c45f46ae
      ggaren@apple.com authored
              Reviewed by Sam Weinig.
      
              Tightened some usage accounting code in MarkedSpace
              https://bugs.webkit.org/show_bug.cgi?id=54761
              
              SunSpider reports no change.
      
              * runtime/Heap.cpp:
              (JSC::Heap::Heap): Initialize the marked space high water mark on
              construction, instead of relying on some implicit subtleties to make
              not initializing it work out OK.
      
              * runtime/Heap.h: Fixed up includes.
      
              * runtime/MarkedBlock.h: Made firstAtom() static so clients can call it
              even without having allocated a block.
      
              * runtime/MarkedSpace.cpp:
              (JSC::MarkedSpace::MarkedSpace): Don't pre-allocate a block, since this
              would be prohibitively expensive with multiple size classes.
      
              (JSC::MarkedSpace::allocateBlock):
              (JSC::MarkedSpace::freeBlock): Track allocated blocks in a hash set,
              since linear search in the contains check will be prohibitively
              expensive once we're using lots of smaller blocks.
      
              (JSC::MarkedSpace::allocate): Don't assume that we always have a block
              allocated, since we don't anymore. (See above.)
      
              (JSC::MarkedSpace::reset):
              * runtime/MarkedSpace.h: Updated for changes mentioned above.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79017 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c45f46ae
  27. 15 Feb, 2011 1 commit
    • oliver@apple.com's avatar
      2011-02-14 Oliver Hunt <oliver@apple.com> · 8d85705e
      oliver@apple.com authored
              Reviewed by Gavin Barraclough and Geoff Garen.
      
              Refactor handles and weak pointers to become nicer and more automatic
              https://bugs.webkit.org/show_bug.cgi?id=54415
      
              Move to a true handle based mechanism for GC value protection.  This
              also allows us to switch to a more sensible behaviour for weak pointers
              in which weak pointers are automatically updated.
      
              This allows us to remove the old (and convoluted) that required all
              objects that may be held by a weak reference to be aware of the reference
              and manually clear them in their destructors.
      
              This also adds a few new data types to JSC that we use to efficiently
              allocate and return the underlying handle storage.
      
              This patch is largely renaming and removing now unnecessary destructors
              from objects.
      
              * API/JSClassRef.cpp:
              (OpaqueJSClass::create):
              (OpaqueJSClassContextData::OpaqueJSClassContextData):
              (OpaqueJSClass::contextData):
              (OpaqueJSClass::prototype):
              * API/JSClassRef.h:
              * CMakeLists.txt:
              * GNUmakefile.am:
              * JavaScriptCore.exp:
              * JavaScriptCore.gypi:
              * JavaScriptCore.pro:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
              * JavaScriptCore.vcproj/WTF/WTF.vcproj:
              * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
              * JavaScriptCore.xcodeproj/project.pbxproj:
              * collector/handles/Global.h: Added.
                  New Global handle type used to keep gc objects live, even if they're not
                  marked.
              (JSC::Global::Global):
              (JSC::Global::~Global):
              (JSC::Global::set):
                  We can only assign directly to a global from another global.
                  In all other cases we need the JSGlobalData to be provided
                  explicitly so we use a set function.
              (JSC::Global::operator=):
              (JSC::Global::clear):
              (JSC::Global::isHashTableDeletedValue):
              (JSC::Global::internalSet):
              * collector/handles/Handle.h: Added.
                  Root "Handle" type used for immutable handles and to provide the basic
                  APIs needed for pointer-like behaviour.
              (JSC::HandleBase::operator!):
              (JSC::HandleBase::operator UnspecifiedBoolType*):
              (JSC::HandleBase::isEmpty):
              (JSC::HandleBase::HandleBase):
              (JSC::HandleBase::slot):
              (JSC::HandleBase::invalidate):
              (JSC::HandleBase::setSlot):
              (JSC::HandleTypes::getFromSlot):
              (JSC::HandleTypes::toJSValue):
              (JSC::HandleTypes::validateUpcast):
              (JSC::HandleConverter::operator->):
              (JSC::HandleConverter::operator*):
              (JSC::Handle::Handle):
              (JSC::Handle::get):
              (JSC::Handle::wrapSlot):
              (JSC::operator==):
              (JSC::operator!=):
              * collector/handles/HandleHeap.cpp: Added.
                  New heap for global handles.
              (JSC::HandleHeap::HandleHeap):
              (JSC::HandleHeap::grow):
              (JSC::HandleHeap::markStrongHandles):
              (JSC::HandleHeap::updateAfterMark):
              (JSC::HandleHeap::clearWeakPointers):
              (JSC::HandleHeap::writeBarrier):
              * collector/handles/HandleHeap.h: Added.
              (JSC::HandleHeap::heapFor):
              (JSC::HandleHeap::toHandle):
              (JSC::HandleHeap::toNode):
              (JSC::HandleHeap::allocate):
              (JSC::HandleHeap::deallocate):
              (JSC::HandleHeap::makeWeak):
                  Convert a hard handle into weak handle that does not
                  protect the object it points to.
              (JSC::HandleHeap::makeSelfDestroying):
                  Converts a handle to a weak handle that will be returned
                  to the free list when the referenced object dies.
              (JSC::HandleHeap::Node::Node):
              (JSC::HandleHeap::Node::slot):
              (JSC::HandleHeap::Node::handleHeap):
              (JSC::HandleHeap::Node::setFinalizer):
              (JSC::HandleHeap::Node::makeWeak):
              (JSC::HandleHeap::Node::isWeak):
              (JSC::HandleHeap::Node::makeSelfDestroying):
              (JSC::HandleHeap::Node::isSelfDestroying):
              (JSC::HandleHeap::Node::finalizer):
              (JSC::HandleHeap::Node::setPrev):
              (JSC::HandleHeap::Node::prev):
              (JSC::HandleHeap::Node::setNext):
              (JSC::HandleHeap::Node::next):
              * interpreter/Interpreter.cpp:
              (JSC::Interpreter::Interpreter):
              * interpreter/Interpreter.h:
              * interpreter/RegisterFile.cpp:
              (JSC::RegisterFile::globalObjectCollected):
              * interpreter/RegisterFile.h:
              (JSC::RegisterFile::RegisterFile):
              * runtime/GCHandle.cpp: Removed.
              * runtime/GCHandle.h: Removed.
              * runtime/Heap.cpp:
              (JSC::Heap::Heap):
              (JSC::Heap::destroy):
              (JSC::Heap::markRoots):
              * runtime/Heap.h:
              (JSC::Heap::allocateGlobalHandle):
              (JSC::Heap::reportExtraMemoryCost):
              * runtime/JSGlobalData.cpp:
              (JSC::JSGlobalData::JSGlobalData):
              * runtime/JSGlobalData.h:
              (JSC::JSGlobalData::allocateGlobalHandle):
              * runtime/JSGlobalObject.cpp:
              (JSC::JSGlobalObject::~JSGlobalObject):
              * runtime/JSPropertyNameIterator.cpp:
              (JSC::JSPropertyNameIterator::create):
              (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
              * runtime/JSPropertyNameIterator.h:
              (JSC::JSPropertyNameIterator::createStructure):
              (JSC::Structure::setEnumerationCache):
              (JSC::Structure::clearEnumerationCache):
              * runtime/Protect.h:
              * runtime/Structure.cpp:
              (JSC::Structure::~Structure):
              * runtime/Structure.h:
              * runtime/WeakGCPtr.h:
              (JSC::WeakGCPtrBase::get):
              (JSC::WeakGCPtrBase::clear):
              (JSC::WeakGCPtrBase::operator!):
              (JSC::WeakGCPtrBase::operator UnspecifiedBoolType*):
              (JSC::WeakGCPtrBase::~WeakGCPtrBase):
              (JSC::WeakGCPtrBase::WeakGCPtrBase):
              (JSC::WeakGCPtrBase::internalSet):
              (JSC::LazyWeakGCPtr::LazyWeakGCPtr):
              (JSC::LazyWeakGCPtr::set):
              (JSC::WeakGCPtr::WeakGCPtr):
              (JSC::WeakGCPtr::operator=):
              * runtime/WriteBarrier.h:
              * wtf/BlockStack.h: Added.
              (WTF::::BlockStack):
              (WTF::::~BlockStack):
              (WTF::::blocks):
              (WTF::::grow):
              (WTF::::shrink):
              * wtf/SentinelLinkedList.h: Added.
              (WTF::::SentinelLinkedList):
              (WTF::::begin):
              (WTF::::end):
              (WTF::::push):
              (WTF::::remove):
              * wtf/SinglyLinkedList.h: Added.
              (WTF::::SinglyLinkedList):
              (WTF::::isEmpty):
              (WTF::::push):
              (WTF::::pop):
      2011-02-14  Oliver Hunt  <oliver@apple.com>
      
              Reviewed by Gavin Barraclough and Geoff Garen.
      
              Refactor handles and weak pointers to become nicer and more automatic
              https://bugs.webkit.org/show_bug.cgi?id=54415
      
              Update to use new Global<> type
      
              * JSRun.cpp:
              (JSRun::JSRun):
              (JSRun::GlobalObject):
              * JSRun.h:
              * JSValueWrapper.cpp:
              (JSValueWrapper::JSValueWrapper):
              * JSValueWrapper.h:
      2011-02-14  Oliver Hunt  <oliver@apple.com>
      
              Reviewed by Gavin Barraclough and Geoff Garen.
      
              Refactor handles and weak pointers to become nicer and more automatic
              https://bugs.webkit.org/show_bug.cgi?id=54415
      
              Update WebCore to use the new Global<> type rather than ProtectedJSValue
              and gc[Un]Protect.  Also update to use new WeakGCPtr APIs, and remove now
              unnecessary destructors.
      
              * ForwardingHeaders/collector/handles/Global.h: Added.
              * WebCore.vcproj/WebCore.vcproj:
              * WebCore.vcproj/copyForwardingHeaders.cmd:
              * bindings/js/JSCallbackData.h:
              (WebCore::JSCallbackData::JSCallbackData):
              * bindings/js/JSCustomVoidCallback.h:
              * bindings/js/JSDOMBinding.cpp:
              (WebCore::forgetDOMNode):
              (WebCore::cacheDOMNodeWrapper):
              * bindings/js/JSDOMWindowBase.h:
              * bindings/js/JSDOMWindowShell.cpp:
              (WebCore::JSDOMWindowShell::setWindow):
              * bindings/js/JSDataGridDataSource.h:
              * bindings/js/JSEventListener.cpp:
              (WebCore::JSEventListener::JSEventListener):
              * bindings/js/JSEventListener.h:
              (WebCore::JSEventListener::setWrapper):
              * bindings/js/JSLazyEventListener.cpp:
              (WebCore::JSLazyEventListener::initializeJSFunction):
              * bindings/js/ScheduledAction.cpp:
              (WebCore::ScheduledAction::ScheduledAction):
              (WebCore::ScheduledAction::executeFunctionInContext):
              * bindings/js/ScheduledAction.h:
              (WebCore::ScheduledAction::ScheduledAction):
              * bindings/js/ScriptCachedFrameData.cpp:
              (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
              (WebCore::ScriptCachedFrameData::restore):
              * bindings/js/ScriptCachedFrameData.h:
              * bindings/js/ScriptCallStackFactory.cpp:
              (WebCore::createScriptArguments):
              * bindings/js/ScriptController.cpp:
              (WebCore::ScriptController::createWindowShell):
              (WebCore::ScriptController::evaluateInWorld):
              (WebCore::ScriptController::clearWindowShell):
              (WebCore::ScriptController::attachDebugger):
              * bindings/js/ScriptController.h:
              * bindings/js/ScriptFunctionCall.cpp:
              (WebCore::ScriptFunctionCall::call):
              (WebCore::ScriptCallback::call):
              * bindings/js/ScriptObject.cpp:
              (WebCore::ScriptObject::ScriptObject):
              * bindings/js/ScriptObject.h:
              * bindings/js/ScriptState.cpp:
              (WebCore::ScriptStateProtectedPtr::ScriptStateProtectedPtr):
              (WebCore::ScriptStateProtectedPtr::get):
              * bindings/js/ScriptState.h:
              * bindings/js/ScriptValue.cpp:
              (WebCore::ScriptValue::isFunction):
              (WebCore::ScriptValue::deserialize):
              * bindings/js/ScriptValue.h:
              (WebCore::ScriptValue::ScriptValue):
              (WebCore::ScriptValue::hasNoValue):
              * bindings/js/ScriptWrappable.h:
              (WebCore::ScriptWrappable::ScriptWrappable):
              (WebCore::ScriptWrappable::setWrapper):
              * bindings/js/WorkerScriptController.cpp:
              (WebCore::WorkerScriptController::WorkerScriptController):
              (WebCore::WorkerScriptController::~WorkerScriptController):
              (WebCore::WorkerScriptController::initScript):
              (WebCore::WorkerScriptController::evaluate):
              * bindings/js/WorkerScriptController.h:
              (WebCore::WorkerScriptController::workerContextWrapper):
              * bindings/scripts/CodeGeneratorJS.pm:
              * bridge/NP_jsobject.cpp:
              (_NPN_InvokeDefault):
              (_NPN_Invoke):
              (_NPN_Evaluate):
              (_NPN_Construct):
              * bridge/jsc/BridgeJSC.cpp:
              (JSC::Bindings::Instance::Instance):
              (JSC::Bindings::Instance::~Instance):
              (JSC::Bindings::Instance::willDestroyRuntimeObject):
              (JSC::Bindings::Instance::willInvalidateRuntimeObject):
              * bridge/jsc/BridgeJSC.h:
              * bridge/runtime_object.cpp:
              (JSC::Bindings::RuntimeObject::invalidate):
              * bridge/runtime_root.cpp:
              (JSC::Bindings::RootObject::RootObject):
              (JSC::Bindings::RootObject::invalidate):
              (JSC::Bindings::RootObject::globalObject):
              (JSC::Bindings::RootObject::updateGlobalObject):
              * bridge/runtime_root.h:
              * dom/EventListener.h:
              * dom/EventTarget.h:
              (WebCore::EventTarget::markJSEventListeners):
              * xml/XMLHttpRequest.cpp:
      
              Qt bindings courtesy of Csaba Osztrogonác
              * bridge/qt/qt_runtime.cpp:
              (JSC::Bindings::QtRuntimeConnectionMethod::call):
              (JSC::Bindings::QtConnectionObject::QtConnectionObject):
              (JSC::Bindings::QtConnectionObject::execute):
              (JSC::Bindings::QtConnectionObject::match):
              * bridge/qt/qt_runtime.h:
      2011-02-14  Oliver Hunt  <oliver@apple.com>
      
              Reviewed by Gavin Barraclough and Geoff Garen.
      
              Refactor handles and weak pointers to become nicer and more automatic
              https://bugs.webkit.org/show_bug.cgi?id=54415
      
              Update to use Global<> instead of ProtectedPtr, and refactored slightly
              to get global data to places it's needed for when we're assigning to
              Global<>s
      
              * ForwardingHeaders/collector/handles/Global.h: Added.
              * Plugins/Hosted/NetscapePluginInstanceProxy.h:
              * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
              (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::get):
              (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::idForObject):
              (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::forget):
              (WebKit::NetscapePluginInstanceProxy::getWindowNPObject):
              (WebKit::NetscapePluginInstanceProxy::getPluginElementNPObject):
              (WebKit::NetscapePluginInstanceProxy::evaluate):
              (WebKit::NetscapePluginInstanceProxy::invoke):
              (WebKit::NetscapePluginInstanceProxy::invokeDefault):
              (WebKit::NetscapePluginInstanceProxy::construct):
              (WebKit::NetscapePluginInstanceProxy::addValueToArray):
              * WebView/WebScriptDebugger.h:
              * WebView/WebScriptDebugger.mm:
              (WebScriptDebugger::WebScriptDebugger):
      2011-02-14  Oliver Hunt  <oliver@apple.com>
      
              Reviewed by Gavin Barraclough and Geoff Garen.
      
              Refactor handles and weak pointers to become nicer and more automatic
              https://bugs.webkit.org/show_bug.cgi?id=54415
      
              Update code to new Global<> API, and refactor to get global data to
              necessary points.
      
              * WebProcess/Plugins/Netscape/NPJSObject.cpp:
              (WebKit::NPJSObject::create):
              (WebKit::NPJSObject::NPJSObject):
              (WebKit::NPJSObject::initialize):
              (WebKit::NPJSObject::invokeDefault):
              (WebKit::NPJSObject::construct):
              (WebKit::NPJSObject::invoke):
              * WebProcess/Plugins/Netscape/NPJSObject.h:
              * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
              (WebKit::NPRuntimeObjectMap::getOrCreateNPObject):
              (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
              (WebKit::NPRuntimeObjectMap::evaluate):
              * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
              * WebProcess/Plugins/PluginView.cpp:
              (WebKit::PluginView::windowScriptNPObject):
              (WebKit::PluginView::pluginElementNPObject):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@78634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8d85705e
  28. 11 Feb, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-02-11 Geoffrey Garen <ggaren@apple.com> · b843ba85
      ggaren@apple.com authored
              Reviewed by Oliver Hunt.
      
              A little more encapsulation for the heap: Removed CollectorHeapIterator
              https://bugs.webkit.org/show_bug.cgi?id=54298
              
              CollectorHeapIterator is a God object that knows the internals of each
              of the pieces of the heap. This undermines the encapsulation I'm trying
              to achieve by splitting concepts into different classes.
              
              As an alternative, I've given each class a forEach iteration function,
              which takes a functor as an argument. Now, each class just needs to
              know how to iterate the things it knows about.
      
              * GNUmakefile.am:
              * JavaScriptCore.exp:
              * JavaScriptCore.gypi:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed CollectorHeapIterator.
      
              * debugger/Debugger.cpp:
              (JSC::Recompiler::Recompiler):
              (JSC::Recompiler::~Recompiler):
              (JSC::Recompiler::operator()):
              (JSC::Debugger::recompileAllJSFunctions): Updated to use forEach interface
              instead of an iterator.
      
              * runtime/CollectorHeapIterator.h: Removed.
      
              * runtime/Heap.cpp:
              (JSC::TypeCounter::TypeCounter):
              (JSC::TypeCounter::typeName):
              (JSC::TypeCounter::operator()):
              (JSC::TypeCounter::take):
              (JSC::Heap::protectedObjectTypeCounts):
              (JSC::Heap::objectTypeCounts): Added forEach and removed iterator.
      
              * runtime/Heap.h:
              (JSC::Heap::forEach):
              * runtime/JSGlobalData.cpp:
              (JSC::Recompiler::operator()):
              (JSC::JSGlobalData::recompileAllJSFunctions):
      
              * runtime/MarkedBlock.h:
              (JSC::MarkedBlock::forEach): Added forEach. Removed friend declaration
              for CollectorHeapIterator. Now, we can make all our data private and
              change it without breaking any other classes.
      
              * runtime/MarkedSpace.cpp:
              * runtime/MarkedSpace.h:
              (JSC::MarkedSpace::forEach): Added forEach and removed iterator.
      2011-02-11  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Oliver Hunt.
      
              A little more encapsulation for the heap: Removed CollectorHeapIterator
              https://bugs.webkit.org/show_bug.cgi?id=54298
      
              * WebCoreStatistics.cpp:
              (WebCoreStatistics::javaScriptProtectedObjectTypeCounts):
      2011-02-11  Geoffrey Garen  <ggaren@apple.com>
      
              Reviewed by Oliver Hunt.
      
              A little more encapsulation for the heap: Removed CollectorHeapIterator
              https://bugs.webkit.org/show_bug.cgi?id=54298
      
              * Misc/WebCoreStatistics.mm:
              (+[WebCoreStatistics javaScriptProtectedObjectTypeCounts]):
              (+[WebCoreStatistics javaScriptObjectTypeCounts]): Updated for new typedef.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@78382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b843ba85
  29. 10 Feb, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-02-10 Geoffrey Garen <ggaren@apple.com> · 12a5a423
      ggaren@apple.com authored
              Reviewed by Sam Weinig.
      
              A little more encapsulation for MarkedBlock: Made all constants private
              so clients don't know whether allocations are fixed-sized or not
              https://bugs.webkit.org/show_bug.cgi?id=54270
              
              SunSpider reports no change.
      
              * runtime/CollectorHeapIterator.h:
              (JSC::CollectorHeapIterator::advance): Updated for removal of HeapConstants.
      
              * runtime/Error.cpp: Switched to using ASSERT_CLASS_FITS_IN_CELL, like
              all other classes.
      
              * runtime/Heap.cpp:
              (JSC::Heap::allocate): Updated for removal of HeapConstants.
              (JSC::Heap::reset): Updated to use size(), instead of calculating size
              on our own.
      
              * runtime/Heap.h: Moved the ASSERT here to MarkedBlock, since it enforces
              on special knowledge of fixed-sizery, which only MarkedBlock is supposed
              to know about.
      
              * runtime/JSCell.h:
              (JSC::JSCell::MarkedBlock::allocate): Updated for removal of HeapConstants.
              Also changed to reset nextCell to 0 at the end of a block, since that
              seems more consistent.
      
              * runtime/JSGlobalData.cpp:
              (JSC::JSGlobalData::storeVPtrs): Changed to use a fixed array of char.
              This hard-coded size is a little wonky, but the compiler will tell us
              if it's ever wrong, so I think it's OK.
      
              * runtime/MarkedBlock.cpp:
              (JSC::MarkedBlock::destroy):
              (JSC::MarkedBlock::MarkedBlock):
              (JSC::MarkedBlock::sweep): Updated for removal of HeapConstants.
      
              * runtime/MarkedBlock.h:
              (JSC::MarkedBlock::isEmpty):
              (JSC::MarkedBlock::clearMarks):
              (JSC::MarkedBlock::size):
              (JSC::MarkedBlock::capacity): Made constants private to this class.
              Removed HeapConstants. Added size() and capacity() functions.
      
              * runtime/MarkedSpace.cpp:
              (JSC::MarkedSpace::allocate):
              (JSC::MarkedSpace::objectCount):
              (JSC::MarkedSpace::size):
              (JSC::MarkedSpace::capacity):
              * runtime/MarkedSpace.h: Use MarkedBlock helper functions instead of
              direct knowledge of MarkedBlock internals.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@78312 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      12a5a423
  30. 04 Feb, 2011 3 commits
    • ggaren@apple.com's avatar
      2011-02-04 Geoffrey Garen <ggaren@apple.com> · f2663494
      ggaren@apple.com authored
              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):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f2663494
    • loislo@chromium.org's avatar
      2011-02-04 Ilya Tikhonovsky <loislo@chromium.org> · c436d330
      loislo@chromium.org authored
              Unreviewed rollout two patches r77614 and r77612.
      
              REGRESSION: Snow Leopard Intell Release anumber of failing tests.
      
              * runtime/Heap.cpp:
              (JSC::Heap::Heap):
              (JSC::Heap::reset):
              * runtime/Heap.h:
              * runtime/MarkedSpace.cpp:
              (JSC::MarkedSpace::allocate):
              (JSC::MarkedSpace::sweep):
              (JSC::MarkedSpace::reset):
              * runtime/MarkedSpace.h:
      
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c436d330
    • ggaren@apple.com's avatar
      2011-02-03 Geoffrey Garen <ggaren@apple.com> · b0a1ae15
      ggaren@apple.com authored
              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.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b0a1ae15
  31. 02 Feb, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-02-01 Geoffrey Garen <ggaren@apple.com> · 4e08b9b5
      ggaren@apple.com authored
              Reviewed by Sam Weinig.
      
              A little more Heap refactoring
              https://bugs.webkit.org/show_bug.cgi?id=53577
              
              SunSpider reports no change.
              
              Split out MarkedBlock into its own file / class.
              
              Did the following renames:
                  isCellMarked => isMarked
                  checkMarkCell => testAndSetMarked
                  markCell => setMarked
                  cellOffset => cellNumber
                  collectorBlock => blockFor
      
              * Android.mk:
              * CMakeLists.txt:
              * GNUmakefile.am:
              * JavaScriptCore.gypi:
              * JavaScriptCore.pro:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
              * JavaScriptCore.xcodeproj/project.pbxproj:
              * runtime/Heap.cpp:
              (JSC::WeakGCHandlePool::update):
              * runtime/Heap.h:
              (JSC::Heap::isMarked):
              (JSC::Heap::testAndSetMarked):
              (JSC::Heap::setMarked):
              * runtime/JSArray.h:
              (JSC::MarkStack::markChildren):
              (JSC::MarkStack::drain):
              * runtime/JSCell.h:
              (JSC::JSCell::MarkStack::internalAppend):
              * runtime/MarkedBlock.cpp: Added.
              * runtime/MarkedBlock.h: Added.
              (JSC::MarkedBlock::blockFor):
              (JSC::MarkedBlock::cellNumber):
              (JSC::MarkedBlock::isMarked):
              (JSC::MarkedBlock::testAndSetMarked):
              (JSC::MarkedBlock::setMarked):
              (JSC::MarkedBlock::isCellAligned):
              (JSC::MarkedBlock::isPossibleCell):
              * runtime/MarkedSpace.h:
              (JSC::MarkedSpace::isMarked):
              (JSC::MarkedSpace::testAndSetMarked):
              (JSC::MarkedSpace::setMarked):
              * runtime/SmallStrings.cpp:
              (JSC::isMarked):
              * runtime/WeakGCMap.h:
              (JSC::WeakGCMap::isValid):
              (JSC::::get):
              (JSC::::take):
              (JSC::::set):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77391 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4e08b9b5