Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0051847d2a3954b88fc4669e9238f730df68cfd4
      
https://github.com/WebKit/WebKit/commit/0051847d2a3954b88fc4669e9238f730df68cfd4
  Author: Mark Lam <[email protected]>
  Date:   2023-02-21 (Tue, 21 Feb 2023)

  Changed paths:
    M Source/JavaScriptCore/jsc.cpp
    M Source/JavaScriptCore/runtime/InitializeThreading.cpp
    M Source/JavaScriptCore/runtime/VMEntryScope.cpp
    M Source/JavaScriptCore/tools/JSDollarVM.cpp
    M Source/JavaScriptCore/wasm/WasmCapabilities.h
    M Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h
    M Source/JavaScriptCore/wasm/WasmMachineThreads.h
    M Source/WTF/wtf/threads/Signals.cpp
    M Source/WTF/wtf/threads/Signals.h
    M Tools/TestWebKitAPI/Tests/WTF/Signals.cpp

  Log Message:
  -----------
  Don't initialize signal handing machinery if we're not going to use it.
https://bugs.webkit.org/show_bug.cgi?id=252651
rdar://105712893

Reviewed by Yusuke Suzuki.

This saves some memory when the signal handling machinery is not needed.

1. Move the handling of JS_SHELL_WAIT_FOR_SIGUSR2_TO_EXIT in jsc.cpp into 
jscmain.
   This is because addSignalHandler() depends on JSC Options, and the Options 
have
   not be initialized yet at its previous location.

2. Make signal handling stages explicit with an InitState in WTF::Config.  The
   InitState can go from Uninitialized to InitializedHandlerThread, and then to
   AddedHandlers.  The InitState cannot go in reverse.

   The client must call initializeSignalHandling() to advance the InitState from
   Uninitialized to InitializedHandlerThread.

   The client must have called addSignalHandler() in order to advance the 
InitState
   from InitializedHandlerThread to AddedHandlers.  If addSignalHandler() is 
called
   without first calling initializeSignalHandling(), a RELEASE_ASSERT will fail.

   The client can only call registerThreadForMachExceptionHandling() after one 
or
   more addSignalHandler() has been called.  
registerThreadForMachExceptionHandling()
   will not RELEASE_ASSERT that the InitState is AddedHandlers.

3. Added stub functions for Wasm::isSupported(), 
Wasm::activateSignalingMemory(),
   Wasm::prepareSignalingMemory(), Wasm::startTrackingCurrentThread(), and
   Wasm::resetInstructionCacheOnAllThreads() so that they can be called without 
first
   checking #if on some WASM #define variable.

* Source/JavaScriptCore/jsc.cpp:
(main):
(CommandLine::parseArguments):
(jscmain):
* Source/JavaScriptCore/runtime/InitializeThreading.cpp:
(JSC::initialize):
* Source/JavaScriptCore/runtime/VMEntryScope.cpp:
(JSC::VMEntryScope::VMEntryScope):
* Source/JavaScriptCore/tools/JSDollarVM.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/wasm/WasmCapabilities.h:
(JSC::Wasm::isSupported):
* Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h:
(JSC::Wasm::activateSignalingMemory):
(JSC::Wasm::prepareSignalingMemory):
* Source/JavaScriptCore/wasm/WasmMachineThreads.h:
(JSC::Wasm::startTrackingCurrentThread):
(JSC::Wasm::resetInstructionCacheOnAllThreads):
* Source/WTF/wtf/threads/Signals.cpp:
(WTF::SignalHandlers::add):
(WTF::initMachExceptionHandlerThread):
(WTF::registerThreadForMachExceptionHandling):
(WTF::addSignalHandler):
(WTF::activateSignalHandlersFor):
(WTF::startMachExceptionHandlerThread): Deleted.
* Source/WTF/wtf/threads/Signals.h:
(WTF::initializeSignalHandling):
(WTF::disableSignalHandling):
(WTF::registerThreadForMachExceptionHandling):
* Tools/TestWebKitAPI/Tests/WTF/Signals.cpp:
(TEST):

Canonical link: https://commits.webkit.org/260623@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to