Title: [253237] trunk/Source/_javascript_Core
Revision
253237
Author
[email protected]
Date
2019-12-06 20:20:54 -0800 (Fri, 06 Dec 2019)

Log Message

[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:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (253236 => 253237)


--- trunk/Source/_javascript_Core/ChangeLog	2019-12-07 03:50:47 UTC (rev 253236)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-12-07 04:20:54 UTC (rev 253237)
@@ -1,3 +1,22 @@
+2019-12-06  Yusuke Suzuki  <[email protected]>
+
+        [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  <[email protected]>
 
         Unreviewed build fix. Initialize local variable.

Modified: trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.cpp (253236 => 253237)


--- trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.cpp	2019-12-07 03:50:47 UTC (rev 253236)
+++ trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.cpp	2019-12-07 04:20:54 UTC (rev 253237)
@@ -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);

Modified: trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.h (253236 => 253237)


--- trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.h	2019-12-07 03:50:47 UTC (rev 253236)
+++ trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.h	2019-12-07 04:20:54 UTC (rev 253237)
@@ -37,11 +37,20 @@
 
 // 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 {
         enum class Type {
@@ -127,7 +136,6 @@
     void finishCreation(JSGlobalObject*, VM&);
 
     static void visitChildren(JSCell*, SlotVisitor&);
-    static void destroy(JSCell*);
 
     WriteBarrier<JSModuleEnvironment> m_moduleEnvironment;
 

Modified: trunk/Source/_javascript_Core/runtime/JSModuleRecord.h (253236 => 253237)


--- trunk/Source/_javascript_Core/runtime/JSModuleRecord.h	2019-12-07 03:50:47 UTC (rev 253236)
+++ trunk/Source/_javascript_Core/runtime/JSModuleRecord.h	2019-12-07 04:20:54 UTC (rev 253237)
@@ -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);
 

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (253236 => 253237)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2019-12-07 03:50:47 UTC (rev 253236)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2019-12-07 04:20:54 UTC (rev 253237)
@@ -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

Modified: trunk/Source/_javascript_Core/runtime/VM.h (253236 => 253237)


--- trunk/Source/_javascript_Core/runtime/VM.h	2019-12-07 03:50:47 UTC (rev 253236)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2019-12-07 04:20:54 UTC (rev 253237)
@@ -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

Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.h (253236 => 253237)


--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.h	2019-12-07 03:50:47 UTC (rev 253236)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.h	2019-12-07 04:20:54 UTC (rev 253237)
@@ -42,8 +42,17 @@
 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;
 
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
@@ -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&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to