Title: [285653] trunk/Source
Revision
285653
Author
[email protected]
Date
2021-11-11 13:24:11 -0800 (Thu, 11 Nov 2021)

Log Message

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

Reviewed by Saam Barati.

Source/_javascript_Core:

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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (285652 => 285653)


--- trunk/Source/_javascript_Core/ChangeLog	2021-11-11 21:09:39 UTC (rev 285652)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-11-11 21:24:11 UTC (rev 285653)
@@ -1,3 +1,26 @@
+2021-11-11  Mark Lam  <[email protected]>
+
+        Rename Heap::isCurrentThreadBusy() to Heap::currentThreadIsDoingGCWork().
+        https://bugs.webkit.org/show_bug.cgi?id=233005
+        rdar://85307204
+
+        Reviewed by Saam Barati.
+
+        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):
+
 2021-11-11  Michael Saboff  <[email protected]>
 
         Inline RegExp.test JIT code in DFG and FTL

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (285652 => 285653)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2021-11-11 21:09:39 UTC (rev 285652)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2021-11-11 21:24:11 UTC (rev 285653)
@@ -2294,7 +2294,7 @@
         // This accomplishes (1), and does its own book-keeping about whether it has already happened.
         if (!jitCode()->dfgCommon()->invalidate()) {
             // We've already been invalidated.
-            RELEASE_ASSERT(this != replacement() || (vm.heap.isCurrentThreadBusy() && !vm.heap.isMarked(ownerExecutable())));
+            RELEASE_ASSERT(this != replacement() || (vm.heap.currentThreadIsDoingGCWork() && !vm.heap.isMarked(ownerExecutable())));
             return;
         }
     }
@@ -2326,7 +2326,7 @@
 
     // Jettison can happen during GC. We don't want to install code to a dead executable
     // because that would add a dead object to the remembered set.
-    if (vm.heap.isCurrentThreadBusy() && !vm.heap.isMarked(ownerExecutable()))
+    if (vm.heap.currentThreadIsDoingGCWork() && !vm.heap.isMarked(ownerExecutable()))
         return;
 
 #if ENABLE(JIT)

Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (285652 => 285653)


--- trunk/Source/_javascript_Core/heap/Heap.cpp	2021-11-11 21:09:39 UTC (rev 285652)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp	2021-11-11 21:24:11 UTC (rev 285653)
@@ -138,22 +138,6 @@
     return Options::largeHeapGrowthFactor() * heapSize;
 }
 
-bool isValidSharedInstanceThreadState(VM& vm)
-{
-    return vm.currentThreadIsHoldingAPILock();
-}
-
-bool isValidThreadState(VM& vm)
-{
-    if (vm.atomStringTable() != Thread::current().atomStringTable())
-        return false;
-
-    if (vm.isSharedInstance() && !isValidSharedInstanceThreadState(vm))
-        return false;
-
-    return true;
-}
-
 void recordType(VM& vm, TypeCountSet& set, JSCell* cell)
 {
     const char* typeName = "[unknown]";
@@ -2379,17 +2363,6 @@
     performIncrement(bytes);
 }
 
-bool Heap::isValidAllocation(size_t)
-{
-    if (!isValidThreadState(vm()))
-        return false;
-
-    if (isCurrentThreadBusy())
-        return false;
-    
-    return true;
-}
-
 void Heap::addFinalizer(JSCell* cell, CFinalizer finalizer)
 {
     WeakSet::allocate(cell, &m_cFinalizerOwner, bitwise_cast<void*>(finalizer)); // Balanced by CFinalizerOwner::finalize().
@@ -2536,7 +2509,7 @@
     addToRememberedSet(from);
 }
 
-bool Heap::isCurrentThreadBusy()
+bool Heap::currentThreadIsDoingGCWork()
 {
     return Thread::mayBeGCThread() || mutatorState() != MutatorState::Running;
 }

Modified: trunk/Source/_javascript_Core/heap/Heap.h (285652 => 285653)


--- trunk/Source/_javascript_Core/heap/Heap.h	2021-11-11 21:09:39 UTC (rev 285652)
+++ trunk/Source/_javascript_Core/heap/Heap.h	2021-11-11 21:24:11 UTC (rev 285653)
@@ -164,7 +164,7 @@
 
     // We're always busy on the collection threads. On the main thread, this returns true if we're
     // helping heap.
-    JS_EXPORT_PRIVATE bool isCurrentThreadBusy();
+    JS_EXPORT_PRIVATE bool currentThreadIsDoingGCWork();
     
     typedef void (*CFinalizer)(JSCell*);
     JS_EXPORT_PRIVATE void addFinalizer(JSCell*, CFinalizer);
@@ -426,7 +426,6 @@
         void finalize(Handle<Unknown>, void* context) final;
     };
 
-    JS_EXPORT_PRIVATE bool isValidAllocation(size_t);
     JS_EXPORT_PRIVATE void reportExtraMemoryAllocatedSlowCase(size_t);
     JS_EXPORT_PRIVATE void deprecatedReportExtraMemorySlowCase(size_t);
     

Modified: trunk/Source/_javascript_Core/jsc.cpp (285652 => 285653)


--- trunk/Source/_javascript_Core/jsc.cpp	2021-11-11 21:09:39 UTC (rev 285652)
+++ trunk/Source/_javascript_Core/jsc.cpp	2021-11-11 21:24:11 UTC (rev 285653)
@@ -3765,7 +3765,7 @@
         WTF::releaseFastMallocFreeMemory();
         vm.deleteAllCode(DeleteAllCodeIfNotCollecting);
 
-        if (!vm.heap.isCurrentThreadBusy()) {
+        if (!vm.heap.currentThreadIsDoingGCWork()) {
             if (isSynchronous) {
                 vm.heap.collectNow(Sync, CollectionScope::Full);
                 WTF::releaseFastMallocFreeMemory();

Modified: trunk/Source/_javascript_Core/runtime/VM.h (285652 => 285653)


--- trunk/Source/_javascript_Core/runtime/VM.h	2021-11-11 21:09:39 UTC (rev 285652)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2021-11-11 21:24:11 UTC (rev 285653)
@@ -1086,7 +1086,7 @@
 #endif
     JS_EXPORT_PRIVATE void dumpRegExpTrace();
 
-    bool isCollectorBusyOnCurrentThread() { return heap.isCurrentThreadBusy(); }
+    bool isCollectorBusyOnCurrentThread() { return heap.currentThreadIsDoingGCWork(); }
 
 #if ENABLE(GC_VALIDATION)
     bool isInitializingObject() const; 

Modified: trunk/Source/WebCore/ChangeLog (285652 => 285653)


--- trunk/Source/WebCore/ChangeLog	2021-11-11 21:09:39 UTC (rev 285652)
+++ trunk/Source/WebCore/ChangeLog	2021-11-11 21:24:11 UTC (rev 285653)
@@ -1,3 +1,17 @@
+2021-11-11  Mark Lam  <[email protected]>
+
+        Rename Heap::isCurrentThreadBusy() to Heap::currentThreadIsDoingGCWork().
+        https://bugs.webkit.org/show_bug.cgi?id=233005
+        rdar://85307204
+
+        Reviewed by Saam Barati.
+
+        * bindings/js/GCController.cpp:
+        (WebCore::GCController::garbageCollectNow):
+        (WebCore::GCController::garbageCollectNowIfNotDoneRecently):
+        * workers/WorkerGlobalScope.cpp:
+        (WebCore::WorkerGlobalScope::deleteJSCodeAndGC):
+
 2021-11-11  Michael Catanzaro  <[email protected]>
 
         -Warray-bounds, -Wstringop-truncation, -Wstringop-overread warnings in Packed.h

Modified: trunk/Source/WebCore/bindings/js/GCController.cpp (285652 => 285653)


--- trunk/Source/WebCore/bindings/js/GCController.cpp	2021-11-11 21:09:39 UTC (rev 285652)
+++ trunk/Source/WebCore/bindings/js/GCController.cpp	2021-11-11 21:24:11 UTC (rev 285653)
@@ -92,7 +92,7 @@
 void GCController::garbageCollectNow()
 {
     JSLockHolder lock(commonVM());
-    if (!commonVM().heap.isCurrentThreadBusy()) {
+    if (!commonVM().heap.currentThreadIsDoingGCWork()) {
         commonVM().heap.collectNow(Sync, CollectionScope::Full);
         WTF::releaseFastMallocFreeMemory();
     }
@@ -102,7 +102,7 @@
 {
 #if USE(CF) || USE(GLIB)
     JSLockHolder lock(commonVM());
-    if (!commonVM().heap.isCurrentThreadBusy())
+    if (!commonVM().heap.currentThreadIsDoingGCWork())
         commonVM().heap.collectNowFullIfNotDoneRecently(Async);
 #else
     garbageCollectSoon();

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (285652 => 285653)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2021-11-11 21:09:39 UTC (rev 285652)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2021-11-11 21:24:11 UTC (rev 285653)
@@ -575,7 +575,7 @@
     vm().deleteAllCode(JSC::DeleteAllCodeIfNotCollecting);
 
     if (synchronous == Synchronous::Yes) {
-        if (!vm().heap.isCurrentThreadBusy()) {
+        if (!vm().heap.currentThreadIsDoingGCWork()) {
             vm().heap.collectNow(JSC::Sync, JSC::CollectionScope::Full);
             WTF::releaseFastMallocFreeMemory();
             return;
@@ -582,7 +582,7 @@
         }
     }
 #if PLATFORM(IOS_FAMILY)
-    if (!vm().heap.isCurrentThreadBusy()) {
+    if (!vm().heap.currentThreadIsDoingGCWork()) {
         vm().heap.collectNowFullIfNotDoneRecently(JSC::Async);
         return;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to