Changeset 285653 in webkit


Ignore:
Timestamp:
Nov 11, 2021, 1:24:11 PM (4 years ago)
Author:
mark.lam@apple.com
Message:

Rename Heap::isCurrentThreadBusy() to Heap::currentThreadIsDoingGCWork().
https://bugs.webkit.org/show_bug.cgi?id=233005
rdar://85307204

Reviewed by Saam Barati.

Source/JavaScriptCore:

This rename clarifies what the "busy" part is about. Also remove some unused code:
Heap::isValidAllocation(), isValidThreadState(), and isValidSharedInstanceThreadState().

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::jettison):

  • heap/Heap.cpp:

(JSC::Heap::currentThreadIsDoingGCWork):
(JSC::Heap::isValidAllocation): Deleted.
(JSC::Heap::isCurrentThreadBusy): Deleted.

  • heap/Heap.h:
  • jsc.cpp:

(jscmain):

  • runtime/VM.h:

(JSC::VM::isCollectorBusyOnCurrentThread):

Source/WebCore:

  • bindings/js/GCController.cpp:

(WebCore::GCController::garbageCollectNow):
(WebCore::GCController::garbageCollectNowIfNotDoneRecently):

  • workers/WorkerGlobalScope.cpp:

(WebCore::WorkerGlobalScope::deleteJSCodeAndGC):

Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r285651 r285653  
     12021-11-11  Mark Lam  <mark.lam@apple.com>
     2
     3        Rename Heap::isCurrentThreadBusy() to Heap::currentThreadIsDoingGCWork().
     4        https://bugs.webkit.org/show_bug.cgi?id=233005
     5        rdar://85307204
     6
     7        Reviewed by Saam Barati.
     8
     9        This rename clarifies what the "busy" part is about.  Also remove some unused code:
     10        Heap::isValidAllocation(), isValidThreadState(), and isValidSharedInstanceThreadState().
     11
     12        * bytecode/CodeBlock.cpp:
     13        (JSC::CodeBlock::jettison):
     14        * heap/Heap.cpp:
     15        (JSC::Heap::currentThreadIsDoingGCWork):
     16        (JSC::Heap::isValidAllocation): Deleted.
     17        (JSC::Heap::isCurrentThreadBusy): Deleted.
     18        * heap/Heap.h:
     19        * jsc.cpp:
     20        (jscmain):
     21        * runtime/VM.h:
     22        (JSC::VM::isCollectorBusyOnCurrentThread):
     23
    1242021-11-11  Michael Saboff  <msaboff@apple.com>
    225
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r285636 r285653  
    22952295        if (!jitCode()->dfgCommon()->invalidate()) {
    22962296            // We've already been invalidated.
    2297             RELEASE_ASSERT(this != replacement() || (vm.heap.isCurrentThreadBusy() && !vm.heap.isMarked(ownerExecutable())));
     2297            RELEASE_ASSERT(this != replacement() || (vm.heap.currentThreadIsDoingGCWork() && !vm.heap.isMarked(ownerExecutable())));
    22982298            return;
    22992299        }
     
    23272327    // Jettison can happen during GC. We don't want to install code to a dead executable
    23282328    // because that would add a dead object to the remembered set.
    2329     if (vm.heap.isCurrentThreadBusy() && !vm.heap.isMarked(ownerExecutable()))
     2329    if (vm.heap.currentThreadIsDoingGCWork() && !vm.heap.isMarked(ownerExecutable()))
    23302330        return;
    23312331
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r285636 r285653  
    139139}
    140140
    141 bool isValidSharedInstanceThreadState(VM& vm)
    142 {
    143     return vm.currentThreadIsHoldingAPILock();
    144 }
    145 
    146 bool isValidThreadState(VM& vm)
    147 {
    148     if (vm.atomStringTable() != Thread::current().atomStringTable())
    149         return false;
    150 
    151     if (vm.isSharedInstance() && !isValidSharedInstanceThreadState(vm))
    152         return false;
    153 
    154     return true;
    155 }
    156 
    157141void recordType(VM& vm, TypeCountSet& set, JSCell* cell)
    158142{
     
    23802364}
    23812365
    2382 bool Heap::isValidAllocation(size_t)
    2383 {
    2384     if (!isValidThreadState(vm()))
    2385         return false;
    2386 
    2387     if (isCurrentThreadBusy())
    2388         return false;
    2389    
    2390     return true;
    2391 }
    2392 
    23932366void Heap::addFinalizer(JSCell* cell, CFinalizer finalizer)
    23942367{
     
    25372510}
    25382511
    2539 bool Heap::isCurrentThreadBusy()
     2512bool Heap::currentThreadIsDoingGCWork()
    25402513{
    25412514    return Thread::mayBeGCThread() || mutatorState() != MutatorState::Running;
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r285636 r285653  
    165165    // We're always busy on the collection threads. On the main thread, this returns true if we're
    166166    // helping heap.
    167     JS_EXPORT_PRIVATE bool isCurrentThreadBusy();
     167    JS_EXPORT_PRIVATE bool currentThreadIsDoingGCWork();
    168168   
    169169    typedef void (*CFinalizer)(JSCell*);
     
    427427    };
    428428
    429     JS_EXPORT_PRIVATE bool isValidAllocation(size_t);
    430429    JS_EXPORT_PRIVATE void reportExtraMemoryAllocatedSlowCase(size_t);
    431430    JS_EXPORT_PRIVATE void deprecatedReportExtraMemorySlowCase(size_t);
  • trunk/Source/JavaScriptCore/jsc.cpp

    r285636 r285653  
    37663766        vm.deleteAllCode(DeleteAllCodeIfNotCollecting);
    37673767
    3768         if (!vm.heap.isCurrentThreadBusy()) {
     3768        if (!vm.heap.currentThreadIsDoingGCWork()) {
    37693769            if (isSynchronous) {
    37703770                vm.heap.collectNow(Sync, CollectionScope::Full);
  • trunk/Source/JavaScriptCore/runtime/VM.h

    r285636 r285653  
    10871087    JS_EXPORT_PRIVATE void dumpRegExpTrace();
    10881088
    1089     bool isCollectorBusyOnCurrentThread() { return heap.isCurrentThreadBusy(); }
     1089    bool isCollectorBusyOnCurrentThread() { return heap.currentThreadIsDoingGCWork(); }
    10901090
    10911091#if ENABLE(GC_VALIDATION)
  • trunk/Source/WebCore/ChangeLog

    r285652 r285653  
     12021-11-11  Mark Lam  <mark.lam@apple.com>
     2
     3        Rename Heap::isCurrentThreadBusy() to Heap::currentThreadIsDoingGCWork().
     4        https://bugs.webkit.org/show_bug.cgi?id=233005
     5        rdar://85307204
     6
     7        Reviewed by Saam Barati.
     8
     9        * bindings/js/GCController.cpp:
     10        (WebCore::GCController::garbageCollectNow):
     11        (WebCore::GCController::garbageCollectNowIfNotDoneRecently):
     12        * workers/WorkerGlobalScope.cpp:
     13        (WebCore::WorkerGlobalScope::deleteJSCodeAndGC):
     14
    1152021-11-11  Michael Catanzaro  <mcatanzaro@gnome.org>
    216
  • trunk/Source/WebCore/bindings/js/GCController.cpp

    r285636 r285653  
    9393{
    9494    JSLockHolder lock(commonVM());
    95     if (!commonVM().heap.isCurrentThreadBusy()) {
     95    if (!commonVM().heap.currentThreadIsDoingGCWork()) {
    9696        commonVM().heap.collectNow(Sync, CollectionScope::Full);
    9797        WTF::releaseFastMallocFreeMemory();
     
    103103#if USE(CF) || USE(GLIB)
    104104    JSLockHolder lock(commonVM());
    105     if (!commonVM().heap.isCurrentThreadBusy())
     105    if (!commonVM().heap.currentThreadIsDoingGCWork())
    106106        commonVM().heap.collectNowFullIfNotDoneRecently(Async);
    107107#else
  • trunk/Source/WebCore/workers/WorkerGlobalScope.cpp

    r285566 r285653  
    576576
    577577    if (synchronous == Synchronous::Yes) {
    578         if (!vm().heap.isCurrentThreadBusy()) {
     578        if (!vm().heap.currentThreadIsDoingGCWork()) {
    579579            vm().heap.collectNow(JSC::Sync, JSC::CollectionScope::Full);
    580580            WTF::releaseFastMallocFreeMemory();
     
    583583    }
    584584#if PLATFORM(IOS_FAMILY)
    585     if (!vm().heap.isCurrentThreadBusy()) {
     585    if (!vm().heap.currentThreadIsDoingGCWork()) {
    586586        vm().heap.collectNowFullIfNotDoneRecently(JSC::Async);
    587587        return;
Note: See TracChangeset for help on using the changeset viewer.