Skip to content
Permalink
Browse files
Remove the UnconditionalFinalizer class
https://bugs.webkit.org/show_bug.cgi?id=185881

Reviewed by Filip Pizlo.

The only remaining user of this API is
JSWebAssemblyCodeBlock. This patch changes, JSWebAssemblyCodeBlock
to use the newer template based API and removes the old class.

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.h:
* heap/Heap.cpp:
(JSC::Heap::finalizeUnconditionalFinalizers):
* heap/Heap.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::addUnconditionalFinalizer): Deleted.
* heap/SlotVisitor.h:
* heap/UnconditionalFinalizer.h: Removed.
* wasm/js/JSWebAssemblyCodeBlock.cpp:
(JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock):
(JSC::JSWebAssemblyCodeBlock::visitChildren):
(JSC::JSWebAssemblyCodeBlock::finalizeUnconditionally):
(JSC::JSWebAssemblyCodeBlock::UnconditionalFinalizer::finalizeUnconditionally): Deleted.
* wasm/js/JSWebAssemblyCodeBlock.h:
* wasm/js/JSWebAssemblyModule.h:

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.h:
* heap/Heap.cpp:
(JSC::Heap::finalizeUnconditionalFinalizers):
* heap/Heap.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::addUnconditionalFinalizer): Deleted.
* heap/SlotVisitor.h:
* heap/UnconditionalFinalizer.h: Removed.
* wasm/js/JSWebAssemblyCodeBlock.cpp:
(JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock):
(JSC::JSWebAssemblyCodeBlock::visitChildren):
(JSC::JSWebAssemblyCodeBlock::finalizeUnconditionally):
(JSC::JSWebAssemblyCodeBlock::UnconditionalFinalizer::finalizeUnconditionally): Deleted.
* wasm/js/JSWebAssemblyCodeBlock.h:
* wasm/js/JSWebAssemblyModule.h:


Canonical link: https://commits.webkit.org/201331@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232080 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
kmiller68 committed May 22, 2018
1 parent 0a010ac commit 661ca7ff93e32d3e3508be1ece6d8a45f57d122b
@@ -557,7 +557,6 @@ set(JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS
heap/SubspaceInlines.h
heap/Synchronousness.h
heap/TinyBloomFilter.h
heap/UnconditionalFinalizer.h
heap/VisitRaceKey.h
heap/Weak.h
heap/WeakBlock.h
@@ -1,3 +1,49 @@
2018-05-22 Keith Miller <keith_miller@apple.com>

Remove the UnconditionalFinalizer class
https://bugs.webkit.org/show_bug.cgi?id=185881

Reviewed by Filip Pizlo.

The only remaining user of this API is
JSWebAssemblyCodeBlock. This patch changes, JSWebAssemblyCodeBlock
to use the newer template based API and removes the old class.

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.h:
* heap/Heap.cpp:
(JSC::Heap::finalizeUnconditionalFinalizers):
* heap/Heap.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::addUnconditionalFinalizer): Deleted.
* heap/SlotVisitor.h:
* heap/UnconditionalFinalizer.h: Removed.
* wasm/js/JSWebAssemblyCodeBlock.cpp:
(JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock):
(JSC::JSWebAssemblyCodeBlock::visitChildren):
(JSC::JSWebAssemblyCodeBlock::finalizeUnconditionally):
(JSC::JSWebAssemblyCodeBlock::UnconditionalFinalizer::finalizeUnconditionally): Deleted.
* wasm/js/JSWebAssemblyCodeBlock.h:
* wasm/js/JSWebAssemblyModule.h:

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.h:
* heap/Heap.cpp:
(JSC::Heap::finalizeUnconditionalFinalizers):
* heap/Heap.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::addUnconditionalFinalizer): Deleted.
* heap/SlotVisitor.h:
* heap/UnconditionalFinalizer.h: Removed.
* wasm/js/JSWebAssemblyCodeBlock.cpp:
(JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock):
(JSC::JSWebAssemblyCodeBlock::visitChildren):
(JSC::JSWebAssemblyCodeBlock::finalizeUnconditionally):
(JSC::JSWebAssemblyCodeBlock::UnconditionalFinalizer::finalizeUnconditionally): Deleted.
* wasm/js/JSWebAssemblyCodeBlock.h:
* wasm/js/JSWebAssemblyModule.h:

2018-05-22 Keith Miller <keith_miller@apple.com>

Unreviewed, fix internal build.
@@ -348,7 +348,6 @@
0F5E0FD8207C72730097F0DE /* DFGAbstractInterpreterClobberState.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5E0FD6207C72710097F0DE /* DFGAbstractInterpreterClobberState.h */; };
0F5E0FE72086AD480097F0DE /* IsoSubspacePerVM.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5E0FE52086AD460097F0DE /* IsoSubspacePerVM.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F5EF91F16878F7D003E5C25 /* JITThunks.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5EF91C16878F78003E5C25 /* JITThunks.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F5F08CF146C7633000472A9 /* UnconditionalFinalizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5F08CE146C762F000472A9 /* UnconditionalFinalizer.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F60FE901FFC37020003320A /* ExecutableToCodeBlockEdge.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F60FE8E1FFC36FD0003320A /* ExecutableToCodeBlockEdge.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F61832A1C45BF070072450B /* AirCCallingConvention.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6183211C45BF070072450B /* AirCCallingConvention.h */; };
0F61832D1C45BF070072450B /* AirEmitShuffle.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6183241C45BF070072450B /* AirEmitShuffle.h */; };
@@ -2365,7 +2364,6 @@
0F5E0FE62086AD470097F0DE /* IsoSubspacePerVM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IsoSubspacePerVM.cpp; sourceTree = "<group>"; };
0F5EF91B16878F78003E5C25 /* JITThunks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITThunks.cpp; sourceTree = "<group>"; };
0F5EF91C16878F78003E5C25 /* JITThunks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITThunks.h; sourceTree = "<group>"; };
0F5F08CE146C762F000472A9 /* UnconditionalFinalizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnconditionalFinalizer.h; sourceTree = "<group>"; };
0F60FE8D1FFC36FC0003320A /* ExecutableToCodeBlockEdge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableToCodeBlockEdge.cpp; sourceTree = "<group>"; };
0F60FE8E1FFC36FD0003320A /* ExecutableToCodeBlockEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutableToCodeBlockEdge.h; sourceTree = "<group>"; };
0F6183201C45BF070072450B /* AirCCallingConvention.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirCCallingConvention.cpp; path = b3/air/AirCCallingConvention.cpp; sourceTree = "<group>"; };
@@ -5773,7 +5771,6 @@
0F1FB38A1E173A6200A9BE50 /* SynchronousStopTheWorldMutatorScheduler.cpp */,
0F1FB38B1E173A6200A9BE50 /* SynchronousStopTheWorldMutatorScheduler.h */,
141448CC13A1783700F5BA1A /* TinyBloomFilter.h */,
0F5F08CE146C762F000472A9 /* UnconditionalFinalizer.h */,
0F4D8C721FC7A973001D32AC /* VisitCounter.h */,
0F952A9F1DF7860700E06FBD /* VisitRaceKey.cpp */,
0F952AA01DF7860700E06FBD /* VisitRaceKey.h */,
@@ -8861,6 +8858,7 @@
FE1BD0251E72053800134BC9 /* HeapVerifier.h in Headers */,
0F4680D514BBD24B00BFE272 /* HostCallReturnValue.h in Headers */,
DC2143071CA32E55000A8869 /* ICStats.h in Headers */,
0FB399BE20AF6B3D0017E213 /* ICStatusUtils.h in Headers */,
BC18C40F0E16F5CD00B34460 /* Identifier.h in Headers */,
8606DDEA18DA44AB00A383D0 /* IdentifierInlines.h in Headers */,
A5FD0076189B038C00633231 /* IdentifiersFactory.h in Headers */,
@@ -8908,6 +8906,8 @@
A50E4B6218809DD50068A46D /* InspectorRuntimeAgent.h in Headers */,
A55165D31BDF0B9E003B75C1 /* InspectorScriptProfilerAgent.h in Headers */,
0F49E9AA20AB4D00001CA0AA /* InstanceOfAccessCase.h in Headers */,
0FB399BF20AF6B3F0017E213 /* InstanceOfStatus.h in Headers */,
0FB399C020AF6B430017E213 /* InstanceOfVariant.h in Headers */,
969A07990ED1D3AE00F1F681 /* Instruction.h in Headers */,
A7A8AF3B17ADB5F3005AB174 /* Int16Array.h in Headers */,
A7A8AF3C17ADB5F3005AB174 /* Int32Array.h in Headers */,
@@ -9066,7 +9066,6 @@
A503FA1E188E0FB000110F14 /* JSJavaScriptCallFramePrototype.h in Headers */,
7013CA8C1B491A9400CAE613 /* JSJob.h in Headers */,
BC18C4160E16F5CD00B34460 /* JSLexicalEnvironment.h in Headers */,
0FB399C020AF6B430017E213 /* InstanceOfVariant.h in Headers */,
BC18C4230E16F5CD00B34460 /* JSLock.h in Headers */,
C25D709C16DE99F400FCA6BC /* JSManagedValue.h in Headers */,
2A4BB7F318A41179008A0FCD /* JSManagedValueInternal.h in Headers */,
@@ -9191,7 +9190,6 @@
0F4680CD14BBB17D00BFE272 /* LowLevelInterpreter.h in Headers */,
981ED82328234D91BAECCADE /* MachineContext.h in Headers */,
14B723B812D7DA6F003BD5ED /* MachineStackMarker.h in Headers */,
0FB399BF20AF6B3F0017E213 /* InstanceOfStatus.h in Headers */,
86C36EEA0EE1289D00B3DF59 /* MacroAssembler.h in Headers */,
86D3B2C610156BDE002865E7 /* MacroAssemblerARM.h in Headers */,
A1A009C01831A22D00CF8711 /* MacroAssemblerARM64.h in Headers */,
@@ -9448,7 +9446,6 @@
705B41AE1A6E501E00716757 /* SymbolConstructor.h in Headers */,
996B73271BDA08EF00331B84 /* SymbolConstructor.lut.h in Headers */,
705B41B01A6E501E00716757 /* SymbolObject.h in Headers */,
0FB399BE20AF6B3D0017E213 /* ICStatusUtils.h in Headers */,
705B41B21A6E501E00716757 /* SymbolPrototype.h in Headers */,
996B73281BDA08EF00331B84 /* SymbolPrototype.lut.h in Headers */,
BC18C46B0E16F5CD00B34460 /* SymbolTable.h in Headers */,
@@ -9489,7 +9486,6 @@
A7A8AF4217ADB5F3005AB174 /* Uint32Array.h in Headers */,
A7A8AF3F17ADB5F3005AB174 /* Uint8Array.h in Headers */,
A7A8AF4017ADB5F3005AB174 /* Uint8ClampedArray.h in Headers */,
0F5F08CF146C7633000472A9 /* UnconditionalFinalizer.h in Headers */,
A7B601821639FD2A00372BA3 /* UnlinkedCodeBlock.h in Headers */,
14AD91241DCA9FA40014F9FE /* UnlinkedEvalCodeBlock.h in Headers */,
14AD91231DCA9FA40014F9FE /* UnlinkedFunctionCodeBlock.h in Headers */,
@@ -63,7 +63,6 @@
#include "ProfilerJettisonReason.h"
#include "ProgramExecutable.h"
#include "PutPropertySlot.h"
#include "UnconditionalFinalizer.h"
#include "ValueProfile.h"
#include "VirtualRegister.h"
#include "Watchpoint.h"
@@ -591,11 +591,10 @@ void Heap::finalizeUnconditionalFinalizers()
finalizeMarkedUnconditionalFinalizers<ExecutableToCodeBlockEdge>(vm()->executableToCodeBlockEdgesWithFinalizers);
finalizeMarkedUnconditionalFinalizers<JSWeakSet>(vm()->weakSetSpace);
finalizeMarkedUnconditionalFinalizers<JSWeakMap>(vm()->weakMapSpace);

while (m_unconditionalFinalizers.hasNext()) {
UnconditionalFinalizer* finalizer = m_unconditionalFinalizers.removeNext();
finalizer->finalizeUnconditionally();
}

#if ENABLE(WEBASSEMBLY)
finalizeMarkedUnconditionalFinalizers<JSWebAssemblyCodeBlock>(vm()->webAssemblyCodeBlockSpace);
#endif
}

void Heap::willStartIterating()
@@ -39,7 +39,6 @@
#include "Options.h"
#include "StructureIDTable.h"
#include "Synchronousness.h"
#include "UnconditionalFinalizer.h"
#include "WeakHandleOwner.h"
#include "WeakReferenceHarvester.h"
#include <wtf/AutomaticThread.h>
@@ -670,7 +669,6 @@ class Heap {
static const size_t s_blockFragmentLength = 32;

ListableHandler<WeakReferenceHarvester>::List m_weakReferenceHarvesters;
ListableHandler<UnconditionalFinalizer>::List m_unconditionalFinalizers;

ParallelHelperClient m_helperClient;
RefPtr<SharedTask<void(SlotVisitor&)>> m_bonusVisitorTask;
@@ -758,11 +758,6 @@ void SlotVisitor::addWeakReferenceHarvester(WeakReferenceHarvester* weakReferenc
m_heap.m_weakReferenceHarvesters.addThreadSafe(weakReferenceHarvester);
}

void SlotVisitor::addUnconditionalFinalizer(UnconditionalFinalizer* unconditionalFinalizer)
{
m_heap.m_unconditionalFinalizers.addThreadSafe(unconditionalFinalizer);
}

void SlotVisitor::didRace(const VisitRaceKey& race)
{
if (Options::verboseVisitRace())
@@ -44,7 +44,6 @@ class HeapSnapshotBuilder;
class MarkedBlock;
class MarkingConstraint;
class MarkingConstraintSolver;
class UnconditionalFinalizer;
template<typename T> class Weak;
class WeakReferenceHarvester;
template<typename T, typename Traits> class WriteBarrierBase;
@@ -142,7 +141,6 @@ class SlotVisitor {
#endif

void addWeakReferenceHarvester(WeakReferenceHarvester*);
void addUnconditionalFinalizer(UnconditionalFinalizer*);

void dump(PrintStream&) const;

This file was deleted.

@@ -50,8 +50,6 @@ JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock(VM& vm, Ref<Wasm::CodeBlock>&& co
: Base(vm, vm.webAssemblyCodeBlockStructure.get())
, m_codeBlock(WTFMove(codeBlock))
{
m_unconditionalFinalizer = PoisonedUniquePtr<JSWebAssemblyCodeBlockPoison, UnconditionalFinalizer>::create(*this);

// FIXME: We should not need to do this synchronously.
// https://bugs.webkit.org/show_bug.cgi?id=170567
m_wasmToJSExitStubs.reserveCapacity(m_codeBlock->functionImportCount());
@@ -92,14 +90,12 @@ void JSWebAssemblyCodeBlock::visitChildren(JSCell* cell, SlotVisitor& visitor)
ASSERT_GC_OBJECT_INHERITS(thisObject, info());

Base::visitChildren(thisObject, visitor);

visitor.addUnconditionalFinalizer(thisObject->m_unconditionalFinalizer.get());
}

void JSWebAssemblyCodeBlock::UnconditionalFinalizer::finalizeUnconditionally()
void JSWebAssemblyCodeBlock::finalizeUnconditionally(VM& vm)
{
for (auto iter = codeBlock.m_callLinkInfos.begin(); !!iter; ++iter)
(*iter)->visitWeak(*codeBlock.vm());
for (auto iter = m_callLinkInfos.begin(); !!iter; ++iter)
(*iter)->visitWeak(vm);
}

} // namespace JSC
@@ -32,7 +32,6 @@
#include "JSCast.h"
#include "PromiseDeferredTimer.h"
#include "Structure.h"
#include "UnconditionalFinalizer.h"
#include "WasmCallee.h"
#include "WasmFormat.h"
#include "WasmModule.h"
@@ -82,24 +81,17 @@ class JSWebAssemblyCodeBlock final : public JSCell {
return m_errorMessage;
}

void finalizeUnconditionally(VM&);

private:
JSWebAssemblyCodeBlock(VM&, Ref<Wasm::CodeBlock>&&, const Wasm::ModuleInformation&);
DECLARE_EXPORT_INFO;
static const bool needsDestruction = true;
static void destroy(JSCell*);
static void visitChildren(JSCell*, SlotVisitor&);

struct UnconditionalFinalizer : public JSC::UnconditionalFinalizer {
UnconditionalFinalizer(JSWebAssemblyCodeBlock& codeBlock)
: codeBlock(codeBlock)
{ }
void finalizeUnconditionally() override;
JSWebAssemblyCodeBlock& codeBlock;
};

PoisonedRef<JSWebAssemblyCodeBlockPoison, Wasm::CodeBlock> m_codeBlock;
Vector<MacroAssemblerCodeRef<WasmEntryPtrTag>> m_wasmToJSExitStubs;
PoisonedUniquePtr<JSWebAssemblyCodeBlockPoison, UnconditionalFinalizer> m_unconditionalFinalizer;
Bag<CallLinkInfo> m_callLinkInfos;
String m_errorMessage;
};
@@ -30,7 +30,6 @@
#include "JSCPoison.h"
#include "JSDestructibleObject.h"
#include "JSObject.h"
#include "UnconditionalFinalizer.h"
#include "WasmMemoryMode.h"
#include <wtf/Bag.h>
#include <wtf/Expected.h>

0 comments on commit 661ca7f

Please sign in to comment.