Skip to content

Commit e92b51e

Browse files
committed
[JSC] Use DestructionMode instead of bool for JSCell::needsDestruction
https://bugs.webkit.org/show_bug.cgi?id=287207 rdar://problem/144349726 Reviewed by Yijia Huang and Keith Miller. This patch changes needsDestruction from bool to DestructionMode. We would like to add a third variant later, like, "MayNeedDestruction" for optimization, so this is a preparation for that. * Source/JavaScriptCore/API/JSAPIGlobalObject.h: * Source/JavaScriptCore/API/JSAPIWrapperObject.mm: * Source/JavaScriptCore/API/JSCallbackConstructor.h: * Source/JavaScriptCore/API/JSCallbackObject.cpp: * Source/JavaScriptCore/API/JSCallbackObject.h: * Source/JavaScriptCore/API/ObjCCallbackFunction.h: * Source/JavaScriptCore/API/glib/JSAPIWrapperGlobalObject.cpp: * Source/JavaScriptCore/API/glib/JSAPIWrapperObjectGLib.cpp: * Source/JavaScriptCore/API/glib/JSCCallbackFunction.h: * Source/JavaScriptCore/bytecode/CodeBlock.h: * Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h: * Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h: * Source/JavaScriptCore/heap/BlockDirectory.h: (JSC::BlockDirectory::needsDestruction const): * Source/JavaScriptCore/heap/MarkedBlock.cpp: (JSC::MarkedBlock::Handle::sweep): * Source/JavaScriptCore/inspector/JSInjectedScriptHost.h: * Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h: * Source/JavaScriptCore/runtime/AbstractModuleRecord.h: * Source/JavaScriptCore/runtime/DateInstance.h: * Source/JavaScriptCore/runtime/ErrorInstance.h: * Source/JavaScriptCore/runtime/Exception.h: * Source/JavaScriptCore/runtime/ExecutableBase.h: * Source/JavaScriptCore/runtime/FunctionRareData.h: * Source/JavaScriptCore/runtime/IntlCollator.h: * Source/JavaScriptCore/runtime/IntlDateTimeFormat.h: * Source/JavaScriptCore/runtime/IntlDisplayNames.h: * Source/JavaScriptCore/runtime/IntlDurationFormat.h: * Source/JavaScriptCore/runtime/IntlListFormat.h: * Source/JavaScriptCore/runtime/IntlLocale.h: * Source/JavaScriptCore/runtime/IntlNumberFormat.h: * Source/JavaScriptCore/runtime/IntlPluralRules.h: * Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.h: * Source/JavaScriptCore/runtime/IntlSegmentIterator.h: * Source/JavaScriptCore/runtime/IntlSegmenter.h: * Source/JavaScriptCore/runtime/IntlSegments.h: * Source/JavaScriptCore/runtime/JSCell.h: * Source/JavaScriptCore/runtime/JSCustomGetterFunction.h: * Source/JavaScriptCore/runtime/JSCustomSetterFunction.h: * Source/JavaScriptCore/runtime/JSDestructibleObject.h: * Source/JavaScriptCore/runtime/JSFinalizationRegistry.h: * Source/JavaScriptCore/runtime/JSGlobalLexicalEnvironment.h: * Source/JavaScriptCore/runtime/JSGlobalObject.h: * Source/JavaScriptCore/runtime/JSModuleNamespaceObject.h: * Source/JavaScriptCore/runtime/JSModuleRecord.h: * Source/JavaScriptCore/runtime/JSNativeStdFunction.h: * Source/JavaScriptCore/runtime/JSScriptFetchParameters.h: * Source/JavaScriptCore/runtime/JSScriptFetcher.h: * Source/JavaScriptCore/runtime/JSSegmentedVariableObject.h: * Source/JavaScriptCore/runtime/JSSourceCode.h: * Source/JavaScriptCore/runtime/JSString.h: * Source/JavaScriptCore/runtime/JSTemplateObjectDescriptor.h: * Source/JavaScriptCore/runtime/PropertyTable.h: * Source/JavaScriptCore/runtime/RegExp.h: * Source/JavaScriptCore/runtime/ScopedArgumentsTable.h: * Source/JavaScriptCore/runtime/SparseArrayValueMap.h: * Source/JavaScriptCore/runtime/Structure.h: * Source/JavaScriptCore/runtime/StructureRareData.h: * Source/JavaScriptCore/runtime/Symbol.h: * Source/JavaScriptCore/runtime/SymbolTable.h: * Source/JavaScriptCore/runtime/SyntheticModuleRecord.h: * Source/JavaScriptCore/runtime/WeakMapImpl.h: * Source/JavaScriptCore/tools/JSDollarVM.cpp: * Source/JavaScriptCore/wasm/js/JSWebAssemblyArray.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyException.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyGlobal.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyStruct.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyTag.h: * Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h: * Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.h: * Source/WebCore/bindings/js/JSDOMConstructorBase.h: * Source/WebCore/bindings/js/JSDOMConstructorNotCallable.h: * Source/WebCore/bindings/js/JSDOMWindowProperties.h: * Source/WebCore/bindings/js/JSObservableArray.h: * Source/WebCore/bindings/js/JSWindowProxy.h: * Source/WebCore/bridge/objc/objc_runtime.h: * Source/WebCore/bridge/runtime_array.h: * Source/WebCore/bridge/runtime_object.h: Canonical link: https://commits.webkit.org/289983@main
1 parent 5a4c7f2 commit e92b51e

78 files changed

Lines changed: 83 additions & 80 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/API/JSAPIGlobalObject.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class JSAPIGlobalObject final : public JSGlobalObject {
3737

3838
DECLARE_EXPORT_INFO;
3939

40-
static constexpr bool needsDestruction = true;
40+
static constexpr DestructionMode needsDestruction = NeedsDestruction;
4141
template<typename CellType, SubspaceAccess mode>
4242
static GCClient::IsoSubspace* subspaceFor(VM& vm)
4343
{

‎Source/JavaScriptCore/API/JSAPIWrapperObject.mm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
DEFINE_VISIT_CHILDREN_WITH_MODIFIER(template<>, JSCallbackObject<JSAPIWrapperObject>);
7777

7878
template <> const ClassInfo JSCallbackObject<JSAPIWrapperObject>::s_info = { "JSAPIWrapperObject"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCallbackObject) };
79-
template <> const bool JSCallbackObject<JSAPIWrapperObject>::needsDestruction = true;
79+
template <> const JSC::DestructionMode JSCallbackObject<JSAPIWrapperObject>::needsDestruction = JSC::NeedsDestruction;
8080

8181
template <>
8282
NativeFunction::Ptr JSCallbackObject<JSAPIWrapperObject>::getCallFunction()

‎Source/JavaScriptCore/API/JSCallbackConstructor.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class JSCallbackConstructor final : public JSNonFinalObject {
3838
public:
3939
using Base = JSNonFinalObject;
4040
static constexpr unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance | ImplementsDefaultHasInstance;
41-
static constexpr bool needsDestruction = true;
41+
static constexpr DestructionMode needsDestruction = NeedsDestruction;
4242

4343
template<typename CellType, SubspaceAccess mode>
4444
static GCClient::IsoSubspace* subspaceFor(VM& vm)

‎Source/JavaScriptCore/API/JSCallbackObject.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ DEFINE_VISIT_CHILDREN_WITH_MODIFIER(template<>, JSCallbackObject<JSGlobalObject>
4747
// Define the two types of JSCallbackObjects we support.
4848
template <> const ClassInfo JSCallbackObject<JSNonFinalObject>::s_info = { "CallbackObject"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCallbackObject) };
4949
template <> const ClassInfo JSCallbackObject<JSGlobalObject>::s_info = { "CallbackGlobalObject"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCallbackObject) };
50-
template<> const bool JSCallbackObject<JSNonFinalObject>::needsDestruction = true;
51-
template<> const bool JSCallbackObject<JSGlobalObject>::needsDestruction = true;
50+
template<> const DestructionMode JSCallbackObject<JSNonFinalObject>::needsDestruction = NeedsDestruction;
51+
template<> const DestructionMode JSCallbackObject<JSGlobalObject>::needsDestruction = NeedsDestruction;
5252

5353
template<>
5454
NativeFunction::Ptr JSCallbackObject<JSNonFinalObject>::getCallFunction()

‎Source/JavaScriptCore/API/JSCallbackObject.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class JSCallbackObject final : public Parent {
145145
}
146146
static JSCallbackObject<Parent>* create(VM&, JSClassRef, Structure*);
147147

148-
static const bool needsDestruction;
148+
static const DestructionMode needsDestruction;
149149
static void destroy(JSCell* cell)
150150
{
151151
static_cast<JSCallbackObject*>(cell)->JSCallbackObject::~JSCallbackObject();

‎Source/JavaScriptCore/API/ObjCCallbackFunction.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ObjCCallbackFunction : public InternalFunction {
6060
}
6161

6262
static ObjCCallbackFunction* create(VM&, JSGlobalObject*, const String& name, std::unique_ptr<ObjCCallbackFunctionImpl>);
63-
static constexpr bool needsDestruction = true;
63+
static constexpr DestructionMode needsDestruction = NeedsDestruction;
6464
static void destroy(JSCell*);
6565

6666
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)

‎Source/JavaScriptCore/API/glib/JSAPIWrapperGlobalObject.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static JSC_DECLARE_CUSTOM_GETTER(staticFunctionGetterJSAPIWrapperGlobalObjectCal
6363
DEFINE_VISIT_CHILDREN_WITH_MODIFIER(template<>, JSCallbackObject<JSAPIWrapperGlobalObject>);
6464

6565
template <> const ClassInfo JSCallbackObject<JSAPIWrapperGlobalObject>::s_info = { "JSAPIWrapperGlobalObject"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCallbackObject) };
66-
template<> const bool JSCallbackObject<JSAPIWrapperGlobalObject>::needsDestruction = true;
66+
template<> const DestructionMode JSCallbackObject<JSAPIWrapperGlobalObject>::needsDestruction = NeedsDestruction;
6767

6868
template <>
6969
NativeFunction::Ptr JSCallbackObject<JSAPIWrapperGlobalObject>::getCallFunction()

‎Source/JavaScriptCore/API/glib/JSAPIWrapperObjectGLib.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static JSC_DECLARE_CUSTOM_GETTER(staticFunctionGetterJSAPIWrapperObjectCallbackO
7676
DEFINE_VISIT_CHILDREN_WITH_MODIFIER(template<>, JSCallbackObject<JSAPIWrapperObject>);
7777

7878
template <> const ClassInfo JSCallbackObject<JSAPIWrapperObject>::s_info = { "JSAPIWrapperObject"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCallbackObject) };
79-
template<> const bool JSCallbackObject<JSAPIWrapperObject>::needsDestruction = true;
79+
template<> const DestructionMode JSCallbackObject<JSAPIWrapperObject>::needsDestruction = NeedsDestruction;
8080

8181
template <>
8282
NativeFunction::Ptr JSCallbackObject<JSAPIWrapperObject>::getCallFunction()

‎Source/JavaScriptCore/API/glib/JSCCallbackFunction.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class JSCCallbackFunction final : public InternalFunction {
5353
};
5454

5555
static JSCCallbackFunction* create(VM&, JSGlobalObject*, const String& name, Type, JSCClass*, GRefPtr<GClosure>&&, GType, std::optional<Vector<GType>>&&);
56-
static constexpr bool needsDestruction = true;
56+
static constexpr DestructionMode needsDestruction = NeedsDestruction;
5757
static void destroy(JSCell*);
5858

5959
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)

‎Source/JavaScriptCore/bytecode/CodeBlock.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class CodeBlock : public JSCell {
118118
enum CopyParsedBlockTag { CopyParsedBlock };
119119

120120
static constexpr unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
121-
static constexpr bool needsDestruction = true;
121+
static constexpr DestructionMode needsDestruction = NeedsDestruction;
122122

123123
template<typename, SubspaceAccess>
124124
static void subspaceFor(VM&)

0 commit comments

Comments
 (0)