Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2753fb281412cc9fb004ec07c07c27c4f5c592d7
      
https://github.com/WebKit/WebKit/commit/2753fb281412cc9fb004ec07c07c27c4f5c592d7
  Author: Yusuke Suzuki <ysuz...@apple.com>
  Date:   2024-12-20 (Fri, 20 Dec 2024)

  Changed paths:
    M Source/JavaScriptCore/API/JSContextRef.cpp
    M Source/JavaScriptCore/jsc.cpp
    M Source/JavaScriptCore/runtime/VM.h
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/CMakeLists.txt
    A Source/WTF/wtf/ThreadSafeRefCountedWithSuppressingSaferCPPChecking.h

  Log Message:
  -----------
  [JSC] Suppress Safer CPP Checking report for JSC::VM
https://bugs.webkit.org/show_bug.cgi?id=285050
rdar://141847850

Reviewed by Geoffrey Garen.

Safer CPP Checking cannot understand the lifetime modeling of JSC::VM:
JSC::VM is retained before entering JSC world, and inside JSC world, it
should be seen as always alive. Appropriate checking requires threading
lifetime information from the entrance of the JSC world, and it is not
done. As a result, the checker is reporting errors which is against how
JSC works.

This patch integrates a workaround class 
ThreadSafeRefCountedWithSuppressingSaferCPPChecking,
which uses refSuppressingSaferCPPChecking / derefSuppressingSaferCPPChecking 
instead of ref / deref,
so that it suppresses the checkers since checker uses ref / deref function 
names.
The implementation is copy of ThreadSafeRefCounted right now. But once
checker supports suppression mechanism, we will use it instead. Or once
checker understands how JSC::VM's lifetime management works, we do not
need suppression.

* Source/JavaScriptCore/API/JSContextRef.cpp:
(JSContextGroupRetain):
(JSContextGroupRelease):
(JSGlobalContextRetain):
(JSGlobalContextRelease):
* Source/JavaScriptCore/jsc.cpp:
(runJSC):
* Source/JavaScriptCore/runtime/VM.h:
(WTF::DefaultRefDerefTraits<JSC::VM>::refIfNotNull):
(WTF::DefaultRefDerefTraits<JSC::VM>::ref):
(WTF::DefaultRefDerefTraits<JSC::VM>::derefIfNotNull):
* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/ThreadSafeRefCountedWithSuppressingSaferCPPChecking.h: Added.
(WTF::ThreadSafeRefCountedWithSuppressingSaferCPPCheckingBase::refSuppressingSaferCPPChecking
 const):
(WTF::ThreadSafeRefCountedWithSuppressingSaferCPPCheckingBase::hasOneRef const):
(WTF::ThreadSafeRefCountedWithSuppressingSaferCPPCheckingBase::refCount const):
(WTF::ThreadSafeRefCountedWithSuppressingSaferCPPCheckingBase::derefBaseWithoutDeletionCheck
 const):
(WTF::ThreadSafeRefCountedWithSuppressingSaferCPPCheckingBase::derefBase const):
(WTF::ThreadSafeRefCountedWithSuppressingSaferCPPCheckingBase::applyRefDuringDestructionCheck
 const):
(WTF::ThreadSafeRefCountedWithSuppressingSaferCPPCheckingBase::~ThreadSafeRefCountedWithSuppressingSaferCPPCheckingBase):
(WTF::ThreadSafeRefCountedWithSuppressingSaferCPPChecking::derefSuppressingSaferCPPChecking
 const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to