[JSC] Put ModuleRecords in IsoSubspace
https://bugs.webkit.org/show_bug.cgi?id=204972
Reviewed by Mark Lam.
This patch is putting JSModuleRecord and WebAssemblyModuleRecord in IsoSubspace.
* runtime/AbstractModuleRecord.cpp:
(JSC::AbstractModuleRecord::destroy): Deleted.
* runtime/AbstractModuleRecord.h:
(JSC::AbstractModuleRecord::subspaceFor):
* runtime/JSModuleRecord.h:
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
* wasm/js/WebAssemblyModuleRecord.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@253237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 3394a8d..b45ab22 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,22 @@
+2019-12-06 Yusuke Suzuki <ysuzuki@apple.com>
+
+ [JSC] Put ModuleRecords in IsoSubspace
+ https://bugs.webkit.org/show_bug.cgi?id=204972
+
+ Reviewed by Mark Lam.
+
+ This patch is putting JSModuleRecord and WebAssemblyModuleRecord in IsoSubspace.
+
+ * runtime/AbstractModuleRecord.cpp:
+ (JSC::AbstractModuleRecord::destroy): Deleted.
+ * runtime/AbstractModuleRecord.h:
+ (JSC::AbstractModuleRecord::subspaceFor):
+ * runtime/JSModuleRecord.h:
+ * runtime/VM.cpp:
+ (JSC::VM::VM):
+ * runtime/VM.h:
+ * wasm/js/WebAssemblyModuleRecord.h:
+
2019-12-06 Per Arne Vollan <pvollan@apple.com>
Unreviewed build fix. Initialize local variable.
diff --git a/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp b/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp
index 6896012..8bf1cfb 100644
--- a/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp
+++ b/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp
@@ -50,12 +50,6 @@
{
}
-void AbstractModuleRecord::destroy(JSCell* cell)
-{
- AbstractModuleRecord* thisObject = static_cast<AbstractModuleRecord*>(cell);
- thisObject->AbstractModuleRecord::~AbstractModuleRecord();
-}
-
void AbstractModuleRecord::finishCreation(JSGlobalObject* globalObject, VM& vm)
{
Base::finishCreation(vm);
diff --git a/Source/JavaScriptCore/runtime/AbstractModuleRecord.h b/Source/JavaScriptCore/runtime/AbstractModuleRecord.h
index 6e93943..519dcd6 100644
--- a/Source/JavaScriptCore/runtime/AbstractModuleRecord.h
+++ b/Source/JavaScriptCore/runtime/AbstractModuleRecord.h
@@ -37,10 +37,19 @@
// Based on the Source Text Module Record
// http://www.ecma-international.org/ecma-262/6.0/#sec-source-text-module-records
-class AbstractModuleRecord : public JSDestructibleObject {
+class AbstractModuleRecord : public JSNonFinalObject {
friend class LLIntOffsetsExtractor;
public:
- typedef JSDestructibleObject Base;
+ using Base = JSNonFinalObject;
+
+ static constexpr bool needsDestruction = true;
+
+ template<typename CellType, SubspaceAccess>
+ static IsoSubspace* subspaceFor(VM&)
+ {
+ RELEASE_ASSERT_NOT_REACHED();
+ return nullptr;
+ }
// https://tc39.github.io/ecma262/#sec-source-text-module-records
struct ExportEntry {
@@ -127,7 +136,6 @@
void finishCreation(JSGlobalObject*, VM&);
static void visitChildren(JSCell*, SlotVisitor&);
- static void destroy(JSCell*);
WriteBarrier<JSModuleEnvironment> m_moduleEnvironment;
diff --git a/Source/JavaScriptCore/runtime/JSModuleRecord.h b/Source/JavaScriptCore/runtime/JSModuleRecord.h
index fab86c1..90012c0 100644
--- a/Source/JavaScriptCore/runtime/JSModuleRecord.h
+++ b/Source/JavaScriptCore/runtime/JSModuleRecord.h
@@ -38,10 +38,19 @@
class JSModuleRecord final : public AbstractModuleRecord {
friend class LLIntOffsetsExtractor;
public:
- typedef AbstractModuleRecord Base;
+ using Base = AbstractModuleRecord;
DECLARE_EXPORT_INFO;
+ static constexpr bool needsDestruction = true;
+ static void destroy(JSCell*);
+
+ template<typename CellType, SubspaceAccess mode>
+ static IsoSubspace* subspaceFor(VM& vm)
+ {
+ return vm.jsModuleRecordSpace<mode>();
+ }
+
static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
static JSModuleRecord* create(JSGlobalObject*, VM&, Structure*, const Identifier&, const SourceCode&, const VariableEnvironment&, const VariableEnvironment&);
@@ -58,7 +67,6 @@
void finishCreation(JSGlobalObject*, VM&);
static void visitChildren(JSCell*, SlotVisitor&);
- static void destroy(JSCell*);
void instantiateDeclarations(JSGlobalObject*, ModuleProgramExecutable*, JSValue scriptFetcher);
diff --git a/Source/JavaScriptCore/runtime/VM.cpp b/Source/JavaScriptCore/runtime/VM.cpp
index a7de6af..18c3b59 100644
--- a/Source/JavaScriptCore/runtime/VM.cpp
+++ b/Source/JavaScriptCore/runtime/VM.cpp
@@ -95,6 +95,7 @@
#include "JSLock.h"
#include "JSMap.h"
#include "JSMapIterator.h"
+#include "JSModuleRecord.h"
#include "JSPromise.h"
#include "JSPropertyNameEnumerator.h"
#include "JSScriptFetchParameters.h"
@@ -162,6 +163,7 @@
#include "Watchdog.h"
#include "WeakGCMapInlines.h"
#include "WebAssemblyFunction.h"
+#include "WebAssemblyModuleRecord.h"
#include "WebAssemblyWrapperFunction.h"
#include <wtf/ProcessID.h>
#include <wtf/ReadWriteLock.h>
@@ -286,6 +288,7 @@
, destructibleCellHeapCellType(makeUnique<HeapCellType>(CellAttributes(NeedsDestruction, HeapCell::JSCell)))
, dateInstanceHeapCellType(makeUnique<IsoHeapCellType<DateInstance>>())
, errorInstanceHeapCellType(makeUnique<IsoHeapCellType<ErrorInstance>>())
+ , jsModuleRecordHeapCellType(makeUnique<IsoHeapCellType<JSModuleRecord>>())
, stringHeapCellType(makeUnique<IsoHeapCellType<JSString>>())
, weakMapHeapCellType(makeUnique<IsoHeapCellType<JSWeakMap>>())
, weakSetHeapCellType(makeUnique<IsoHeapCellType<JSWeakSet>>())
@@ -309,6 +312,7 @@
, webAssemblyInstanceHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyInstance>>())
, webAssemblyMemoryHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyMemory>>())
, webAssemblyModuleHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyModule>>())
+ , webAssemblyModuleRecordHeapCellType(makeUnique<IsoHeapCellType<WebAssemblyModuleRecord>>())
, webAssemblyTableHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyTable>>())
#endif
, primitiveGigacageAuxiliarySpace("Primitive Gigacage Auxiliary", heap, auxiliaryHeapCellType.get(), primitiveGigacageAllocator.get()) // Hash:0x3e7cd762
@@ -1356,6 +1360,7 @@
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(float64ArraySpace, cellHeapCellType.get(), JSFloat64Array)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(functionRareDataSpace, destructibleCellHeapCellType.get(), FunctionRareData)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(generatorSpace, cellHeapCellType.get(), JSGenerator)
+DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(jsModuleRecordSpace, jsModuleRecordHeapCellType.get(), JSModuleRecord)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(int8ArraySpace, cellHeapCellType.get(), JSInt8Array)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(int16ArraySpace, cellHeapCellType.get(), JSInt16Array)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(int32ArraySpace, cellHeapCellType.get(), JSInt32Array)
@@ -1396,6 +1401,7 @@
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyInstanceSpace, webAssemblyInstanceHeapCellType.get(), JSWebAssemblyInstance)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyMemorySpace, webAssemblyMemoryHeapCellType.get(), JSWebAssemblyMemory)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyModuleSpace, webAssemblyModuleHeapCellType.get(), JSWebAssemblyModule)
+DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyModuleRecordSpace, webAssemblyModuleRecordHeapCellType.get(), WebAssemblyModuleRecord)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyTableSpace, webAssemblyTableHeapCellType.get(), JSWebAssemblyTable)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyWrapperFunctionSpace, cellHeapCellType.get(), WebAssemblyWrapperFunction) // Hash:0xd4a5ff01
#endif
diff --git a/Source/JavaScriptCore/runtime/VM.h b/Source/JavaScriptCore/runtime/VM.h
index 4f94ed0..54217ad 100644
--- a/Source/JavaScriptCore/runtime/VM.h
+++ b/Source/JavaScriptCore/runtime/VM.h
@@ -130,6 +130,7 @@
class JSCustomGetterSetterFunction;
class JSDestructibleObjectHeapCellType;
class JSGlobalObject;
+class JSModuleRecord;
class JSObject;
class JSPromise;
class JSPropertyNameEnumerator;
@@ -176,6 +177,7 @@
class Watchpoint;
class WatchpointSet;
class WebAssemblyFunction;
+class WebAssemblyModuleRecord;
template<typename CellType> class IsoHeapCellType;
@@ -357,6 +359,7 @@
std::unique_ptr<HeapCellType> destructibleCellHeapCellType;
std::unique_ptr<IsoHeapCellType<DateInstance>> dateInstanceHeapCellType;
std::unique_ptr<IsoHeapCellType<ErrorInstance>> errorInstanceHeapCellType;
+ std::unique_ptr<IsoHeapCellType<JSModuleRecord>> jsModuleRecordHeapCellType;
std::unique_ptr<IsoHeapCellType<JSString>> stringHeapCellType;
std::unique_ptr<IsoHeapCellType<JSWeakMap>> weakMapHeapCellType;
std::unique_ptr<IsoHeapCellType<JSWeakSet>> weakSetHeapCellType;
@@ -380,6 +383,7 @@
std::unique_ptr<IsoHeapCellType<JSWebAssemblyInstance>> webAssemblyInstanceHeapCellType;
std::unique_ptr<IsoHeapCellType<JSWebAssemblyMemory>> webAssemblyMemoryHeapCellType;
std::unique_ptr<IsoHeapCellType<JSWebAssemblyModule>> webAssemblyModuleHeapCellType;
+ std::unique_ptr<IsoHeapCellType<WebAssemblyModuleRecord>> webAssemblyModuleRecordHeapCellType;
std::unique_ptr<IsoHeapCellType<JSWebAssemblyTable>> webAssemblyTableHeapCellType;
#endif
@@ -465,6 +469,7 @@
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(int8ArraySpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(int16ArraySpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(int32ArraySpace)
+ DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(jsModuleRecordSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(mapSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(nativeStdFunctionSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(proxyObjectSpace)
@@ -496,6 +501,7 @@
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyInstanceSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyMemorySpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyModuleSpace)
+ DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyModuleRecordSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyTableSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyWrapperFunctionSpace)
#endif
diff --git a/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.h b/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.h
index 14a2849..751f1bb 100644
--- a/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.h
+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.h
@@ -42,7 +42,16 @@
class WebAssemblyModuleRecord final : public AbstractModuleRecord {
friend class LLIntOffsetsExtractor;
public:
- typedef AbstractModuleRecord Base;
+ using Base = AbstractModuleRecord;
+
+ static constexpr bool needsDestruction = true;
+ static void destroy(JSCell*);
+
+ template<typename CellType, SubspaceAccess mode>
+ static IsoSubspace* subspaceFor(VM& vm)
+ {
+ return vm.webAssemblyModuleRecordSpace<mode>();
+ }
DECLARE_EXPORT_INFO;
@@ -57,7 +66,6 @@
WebAssemblyModuleRecord(VM&, Structure*, const Identifier&);
void finishCreation(JSGlobalObject*, VM&, const Wasm::ModuleInformation&);
- static void destroy(JSCell*);
static void visitChildren(JSCell*, SlotVisitor&);