Title: [253106] trunk/Source/_javascript_Core
Revision
253106
Author
[email protected]
Date
2019-12-04 09:46:02 -0800 (Wed, 04 Dec 2019)

Log Message

[JSC] Place Wasm cells in IsoSubspace
https://bugs.webkit.org/show_bug.cgi?id=204829

Reviewed by Saam Barati.

This patch places Wasm cells in IsoSubspace. We remove JSDestructibleObject inheritance in wasm cells since we
can call destructor through HeapCellType's specialization. We do not need to rely on m_classInfo->methodTable->destroy.
This patch does not include JSToWasmICCallee since now I'm exploring the way to remove it completely.

* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
* wasm/js/JSWebAssemblyInstance.h:
* wasm/js/JSWebAssemblyMemory.cpp:
(JSC::JSWebAssemblyMemory::destroy):
* wasm/js/JSWebAssemblyMemory.h:
* wasm/js/JSWebAssemblyModule.h:
* wasm/js/JSWebAssemblyTable.h:
* wasm/js/WebAssemblyGlobalConstructor.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (253105 => 253106)


--- trunk/Source/_javascript_Core/ChangeLog	2019-12-04 17:12:22 UTC (rev 253105)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-12-04 17:46:02 UTC (rev 253106)
@@ -1,3 +1,25 @@
+2019-12-04  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Place Wasm cells in IsoSubspace
+        https://bugs.webkit.org/show_bug.cgi?id=204829
+
+        Reviewed by Saam Barati.
+
+        This patch places Wasm cells in IsoSubspace. We remove JSDestructibleObject inheritance in wasm cells since we
+        can call destructor through HeapCellType's specialization. We do not need to rely on m_classInfo->methodTable->destroy.
+        This patch does not include JSToWasmICCallee since now I'm exploring the way to remove it completely.
+
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+        * wasm/js/JSWebAssemblyInstance.h:
+        * wasm/js/JSWebAssemblyMemory.cpp:
+        (JSC::JSWebAssemblyMemory::destroy):
+        * wasm/js/JSWebAssemblyMemory.h:
+        * wasm/js/JSWebAssemblyModule.h:
+        * wasm/js/JSWebAssemblyTable.h:
+        * wasm/js/WebAssemblyGlobalConstructor.h:
+
 2019-12-04  Tim Horton  <[email protected]>
 
         Introduce a GPU process

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (253105 => 253106)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2019-12-04 17:12:22 UTC (rev 253105)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2019-12-04 17:46:02 UTC (rev 253106)
@@ -301,6 +301,10 @@
     , webAssemblyCodeBlockHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyCodeBlock>>())
     , webAssemblyFunctionHeapCellType(makeUnique<IsoHeapCellType<WebAssemblyFunction>>())
     , webAssemblyGlobalHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyGlobal>>())
+    , webAssemblyInstanceHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyInstance>>())
+    , webAssemblyMemoryHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyMemory>>())
+    , webAssemblyModuleHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyModule>>())
+    , webAssemblyTableHeapCellType(makeUnique<IsoHeapCellType<JSWebAssemblyTable>>())
 #endif
     , primitiveGigacageAuxiliarySpace("Primitive Gigacage Auxiliary", heap, auxiliaryHeapCellType.get(), primitiveGigacageAllocator.get()) // Hash:0x3e7cd762
     , jsValueGigacageAuxiliarySpace("JSValue Gigacage Auxiliary", heap, auxiliaryHeapCellType.get(), jsValueGigacageAllocator.get()) // Hash:0x241e946
@@ -1369,7 +1373,10 @@
 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyCodeBlockSpace, webAssemblyCodeBlockHeapCellType.get(), JSWebAssemblyCodeBlock) // Hash:0x9ad995cd
 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyFunctionSpace, webAssemblyFunctionHeapCellType.get(), WebAssemblyFunction) // Hash:0x8b7c32db
 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyGlobalSpace, webAssemblyGlobalHeapCellType.get(), JSWebAssemblyGlobal)
-DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyMemorySpace, destructibleObjectHeapCellType.get(), JSWebAssemblyMemory)
+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(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 (253105 => 253106)


--- trunk/Source/_javascript_Core/runtime/VM.h	2019-12-04 17:12:22 UTC (rev 253105)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2019-12-04 17:46:02 UTC (rev 253106)
@@ -377,6 +377,10 @@
     std::unique_ptr<IsoHeapCellType<JSWebAssemblyCodeBlock>> webAssemblyCodeBlockHeapCellType;
     std::unique_ptr<IsoHeapCellType<WebAssemblyFunction>> webAssemblyFunctionHeapCellType;
     std::unique_ptr<IsoHeapCellType<JSWebAssemblyGlobal>> webAssemblyGlobalHeapCellType;
+    std::unique_ptr<IsoHeapCellType<JSWebAssemblyInstance>> webAssemblyInstanceHeapCellType;
+    std::unique_ptr<IsoHeapCellType<JSWebAssemblyMemory>> webAssemblyMemoryHeapCellType;
+    std::unique_ptr<IsoHeapCellType<JSWebAssemblyModule>> webAssemblyModuleHeapCellType;
+    std::unique_ptr<IsoHeapCellType<JSWebAssemblyTable>> webAssemblyTableHeapCellType;
 #endif
     
     CompleteSubspace primitiveGigacageAuxiliarySpace; // Typed arrays, strings, bitvectors, etc go here.
@@ -472,7 +476,10 @@
     DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyCodeBlockSpace)
     DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyFunctionSpace)
     DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyGlobalSpace)
+    DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyInstanceSpace)
     DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyMemorySpace)
+    DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyModuleSpace)
+    DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyTableSpace)
     DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(webAssemblyWrapperFunctionSpace)
 #endif
 

Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.h (253105 => 253106)


--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.h	2019-12-04 17:12:22 UTC (rev 253105)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.h	2019-12-04 17:46:02 UTC (rev 253106)
@@ -45,10 +45,18 @@
 class CodeBlock;
 }
 
-class JSWebAssemblyInstance final : public JSDestructibleObject {
+class JSWebAssemblyInstance final : public JSNonFinalObject {
 public:
-    using Base = JSDestructibleObject;
+    using Base = JSNonFinalObject;
+    static constexpr bool needsDestruction = true;
+    static void destroy(JSCell*);
 
+    template<typename CellType, SubspaceAccess mode>
+    static IsoSubspace* subspaceFor(VM& vm)
+    {
+        return vm.webAssemblyInstanceSpace<mode>();
+    }
+
     static Identifier createPrivateModuleKey();
 
     static JSWebAssemblyInstance* create(VM&, JSGlobalObject*, const Identifier& moduleKey, JSWebAssemblyModule*, JSObject* importObject, Structure*, Ref<Wasm::Module>&&, Wasm::CreationMode);
@@ -96,7 +104,6 @@
 protected:
     JSWebAssemblyInstance(VM&, Structure*, Ref<Wasm::Instance>&&);
     void finishCreation(VM&, JSWebAssemblyModule*, JSModuleNamespaceObject*);
-    static void destroy(JSCell*);
     static void visitChildren(JSCell*, SlotVisitor&);
 
 private:

Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.cpp (253105 => 253106)


--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.cpp	2019-12-04 17:12:22 UTC (rev 253105)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.cpp	2019-12-04 17:46:02 UTC (rev 253106)
@@ -138,7 +138,6 @@
 void JSWebAssemblyMemory::destroy(JSCell* cell)
 {
     auto memory = static_cast<JSWebAssemblyMemory*>(cell);
-    ASSERT(memory->classInfo() == info());
     memory->JSWebAssemblyMemory::~JSWebAssemblyMemory();
 }
 

Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.h (253105 => 253106)


--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.h	2019-12-04 17:12:22 UTC (rev 253105)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyMemory.h	2019-12-04 17:46:02 UTC (rev 253106)
@@ -37,9 +37,11 @@
 class ArrayBuffer;
 class JSArrayBuffer;
 
-class JSWebAssemblyMemory final : public JSDestructibleObject {
+class JSWebAssemblyMemory final : public JSNonFinalObject {
 public:
-    using Base = JSDestructibleObject;
+    using Base = JSNonFinalObject;
+    static constexpr bool needsDestruction = true;
+    static void destroy(JSCell*);
 
     template<typename CellType, SubspaceAccess mode>
     static IsoSubspace* subspaceFor(VM& vm)
@@ -61,7 +63,6 @@
 private:
     JSWebAssemblyMemory(VM&, Structure*);
     void finishCreation(VM&);
-    static void destroy(JSCell*);
     static void visitChildren(JSCell*, SlotVisitor&);
 
     Ref<Wasm::Memory> m_memory;

Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyModule.h (253105 => 253106)


--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyModule.h	2019-12-04 17:12:22 UTC (rev 253105)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyModule.h	2019-12-04 17:46:02 UTC (rev 253106)
@@ -49,10 +49,18 @@
 class JSWebAssemblyCodeBlock;
 class JSWebAssemblyMemory;
 
-class JSWebAssemblyModule final : public JSDestructibleObject {
+class JSWebAssemblyModule final : public JSNonFinalObject {
 public:
-    using Base = JSDestructibleObject;
+    using Base = JSNonFinalObject;
+    static constexpr bool needsDestruction = true;
+    static void destroy(JSCell*);
 
+    template<typename CellType, SubspaceAccess mode>
+    static IsoSubspace* subspaceFor(VM& vm)
+    {
+        return vm.webAssemblyModuleSpace<mode>();
+    }
+
     DECLARE_EXPORT_INFO;
 
     JS_EXPORT_PRIVATE static JSWebAssemblyModule* createStub(VM&, JSGlobalObject*, Structure*, Expected<RefPtr<Wasm::Module>, String>&&);
@@ -72,7 +80,6 @@
 
     JSWebAssemblyModule(VM&, Structure*, Ref<Wasm::Module>&&);
     void finishCreation(VM&);
-    static void destroy(JSCell*);
     static void visitChildren(JSCell*, SlotVisitor&);
 
     Ref<Wasm::Module> m_module;

Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyTable.h (253105 => 253106)


--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyTable.h	2019-12-04 17:12:22 UTC (rev 253105)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyTable.h	2019-12-04 17:46:02 UTC (rev 253106)
@@ -37,10 +37,18 @@
 
 namespace JSC {
 
-class JSWebAssemblyTable final : public JSDestructibleObject {
+class JSWebAssemblyTable final : public JSNonFinalObject {
 public:
-    using Base = JSDestructibleObject;
+    using Base = JSNonFinalObject;
+    static constexpr bool needsDestruction = true;
+    static void destroy(JSCell*);
 
+    template<typename CellType, SubspaceAccess mode>
+    static IsoSubspace* subspaceFor(VM& vm)
+    {
+        return vm.webAssemblyTableSpace<mode>();
+    }
+
     static JSWebAssemblyTable* create(JSGlobalObject*, VM&, Structure*, Ref<Wasm::Table>&&);
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
 
@@ -62,7 +70,6 @@
 private:
     JSWebAssemblyTable(VM&, Structure*, Ref<Wasm::Table>&&);
     void finishCreation(VM&);
-    static void destroy(JSCell*);
     static void visitChildren(JSCell*, SlotVisitor&);
 
     Ref<Wasm::Table> m_table;

Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyGlobalConstructor.h (253105 => 253106)


--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyGlobalConstructor.h	2019-12-04 17:12:22 UTC (rev 253105)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyGlobalConstructor.h	2019-12-04 17:46:02 UTC (rev 253106)
@@ -50,6 +50,7 @@
 private:
     WebAssemblyGlobalConstructor(VM&, Structure*);
 };
+STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(WebAssemblyGlobalConstructor, InternalFunction);
 
 } // namespace JSC
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to