Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f057e7bc12bee1ce5870e2a290f3658bf186d477
      
https://github.com/WebKit/WebKit/commit/f057e7bc12bee1ce5870e2a290f3658bf186d477
  Author: Keith Miller <[email protected]>
  Date:   2026-08-24 (Mon, 24 Aug 2026)

  Changed paths:
    M Source/JavaScriptCore/SaferCPPExpectations/ForwardDeclCheckerExpectations
    M Source/JavaScriptCore/b3/air/opcode_generator.rb
    M Source/JavaScriptCore/bytecode/BytecodeUseDef.h
    M Source/JavaScriptCore/bytecode/Watchpoint.h
    M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
    M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
    M Source/JavaScriptCore/dfg/DFGAdaptiveInferredPropertyValueWatchpoint.cpp
    M Source/JavaScriptCore/dfg/DFGAdaptiveStructureWatchpoint.cpp
    M Source/JavaScriptCore/dfg/DFGForAllKills.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
    M Source/JavaScriptCore/ftl/FTLCompile.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/ftl/FTLState.cpp
    M Source/JavaScriptCore/ftl/FTLState.h
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/heap/HeapInlines.h
    M Source/JavaScriptCore/heap/MarkingConstraintSolver.cpp
    M Source/JavaScriptCore/jit/JITCall.cpp
    M Source/JavaScriptCore/jit/JITPropertyAccess.cpp
    M Source/JavaScriptCore/lol/LOLJIT.cpp
    M Source/JavaScriptCore/runtime/InitializeThreading.h
    M Source/JavaScriptCore/runtime/Options.h
    M Source/JavaScriptCore/runtime/VMManager.cpp
    M Source/JavaScriptCore/runtime/VMManager.h
    M Source/JavaScriptCore/tools/HeapVerifier.cpp
    M Source/JavaScriptCore/wasm/WasmIRGeneratorHelpers.h
    M Source/JavaScriptCore/wasm/WasmOMGPlan.cpp
    M Source/JavaScriptCore/wasm/WasmOSREntryPlan.cpp
    M Source/WTF/wtf/ParkingLot.h
    M Source/WTF/wtf/ScopedLambda.h
    M Source/WTF/wtf/StdLibExtras.h
    M Source/WTF/wtf/ThreadMessage.h
    M Source/WebCore/bindings/js/JSDOMConvertSequences.h
    M Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp
    M Tools/TestWebKitAPI/Tests/WTF/ScopedLambda.cpp

  Log Message:
  -----------
  Clean up ScopedLambda API for modern C++
https://bugs.webkit.org/show_bug.cgi?id=322406
rdar://185695582

Reviewed by Yusuke Suzuki.

ScopedLambda required every caller to name the function signature at the
call site by wrapping the lambda in a scopedLambda<Sig>() call. This is
because ScopedLambda could only be constructed from a raw
(void*, Args...) thunk. Give ScopedLambda a converting constructor from
any invocable, so a callee declared as taking a const ScopedLambda<Sig>&
can simply be passed a lambda. The parameter is marked LIFETIME_BOUND so
that clang diagnoses the cases where that does not hold: binding a
temporary lambda to a named ScopedLambda, returning one, or initializing
a member from one are all caught by -Wdangling, -Wreturn-stack-address,
and -Wdangling-field respectively.

Convert every caller to pass its lambda directly, which additionally
drops a needless copy of the functor at the sites that were wrapping an
already-live reference. This left scopedLambda(), ScopedLambdaFunctor,
scopedLambdaRef() and ScopedLambdaRefFunctor with no users, so I removed
them. The new constructor does what scopedLambdaRef() did and also
accepts functors whose call operator is not const, which
scopedLambdaRef() could not. The last user of the owning form was
LazyFireDetail, which stored a non-const ScopedLambda& and so forced its
callers to keep one in a variable. I made it a template constrained on
ConstInvocable<void(PrintStream&)> that owns its functor instead, which
is both simpler at its two call sites and removes the borrowed reference
altogether. opcode_generator.rb now emits forEachArgCustom(functor)
directly. Export ConstInvocable from StdLibExtras.h alongside Invocable
so it can be named unqualified, and drop the WTF:: qualification in
DFGForAllKills.h accordingly.

Test: Tools/TestWebKitAPI/Tests/WTF/ScopedLambda.cpp
Canonical link: https://commits.webkit.org/319727@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to