Title: [253321] trunk/Source
Revision
253321
Author
[email protected]
Date
2019-12-10 01:41:35 -0800 (Tue, 10 Dec 2019)

Log Message

[JSC] Put JSArray in IsoSubspace
https://bugs.webkit.org/show_bug.cgi?id=205049

Reviewed by Mark Lam.

Source/_javascript_Core:

Put JSArray in IsoSubspace.

* runtime/ArrayPrototype.h:
* runtime/JSArray.h:
(JSC::JSArray::subspaceFor):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
* tools/JSDollarVM.cpp:

Source/WebCore:

RuntimeArray is inheriting JSArray. We should have separate IsoSubspace for this.

* bindings/js/WebCoreJSClientData.cpp:
(WebCore::JSVMClientData::JSVMClientData):
* bindings/js/WebCoreJSClientData.h:
(WebCore::JSVMClientData::runtimeArraySpace):
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::subspaceForImpl):
* bridge/runtime_array.h:
(JSC::RuntimeArray::create): Deleted.
(JSC::RuntimeArray::getLength const): Deleted.
(JSC::RuntimeArray::getConcreteArray const): Deleted.
(JSC::RuntimeArray::createPrototype): Deleted.
(JSC::RuntimeArray::createStructure): Deleted.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (253320 => 253321)


--- trunk/Source/_javascript_Core/ChangeLog	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-12-10 09:41:35 UTC (rev 253321)
@@ -1,3 +1,20 @@
+2019-12-10  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Put JSArray in IsoSubspace
+        https://bugs.webkit.org/show_bug.cgi?id=205049
+
+        Reviewed by Mark Lam.
+
+        Put JSArray in IsoSubspace.
+
+        * runtime/ArrayPrototype.h:
+        * runtime/JSArray.h:
+        (JSC::JSArray::subspaceFor):
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+        * tools/JSDollarVM.cpp:
+
 2019-12-09  Mark Lam  <[email protected]>
 
         Fix the x86_64 probe so that we can get a full stack trace with libunwind and lldb.

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.h (253320 => 253321)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.h	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.h	2019-12-10 09:41:35 UTC (rev 253321)
@@ -29,7 +29,7 @@
     ArrayPrototype(VM&, Structure*);
 
 public:
-    typedef JSArray Base;
+    using Base = JSArray;
 
     enum class SpeciesWatchpointStatus {
         Uninitialized,
@@ -49,6 +49,7 @@
 protected:
     void finishCreation(VM&, JSGlobalObject*);
 };
+STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(ArrayPrototype, JSArray);
 
 EncodedJSValue JSC_HOST_CALL arrayProtoFuncSpeciesCreate(JSGlobalObject*, CallFrame*);
 EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(JSGlobalObject*, CallFrame*);

Modified: trunk/Source/_javascript_Core/runtime/JSArray.h (253320 => 253321)


--- trunk/Source/_javascript_Core/runtime/JSArray.h	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/_javascript_Core/runtime/JSArray.h	2019-12-10 09:41:35 UTC (rev 253321)
@@ -39,7 +39,7 @@
     friend class JIT;
 
 public:
-    typedef JSNonFinalObject Base;
+    using Base = JSNonFinalObject;
     static constexpr unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetPropertyNames;
 
     static size_t allocationSize(Checked<size_t> inlineCapacity)
@@ -47,6 +47,12 @@
         ASSERT_UNUSED(inlineCapacity, !inlineCapacity);
         return sizeof(JSArray);
     }
+
+    template<typename CellType, SubspaceAccess mode>
+    static IsoSubspace* subspaceFor(VM& vm)
+    {
+        return &vm.arraySpace;
+    }
         
 protected:
     explicit JSArray(VM& vm, Structure* structure, Butterfly* butterfly)

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (253320 => 253321)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2019-12-10 09:41:35 UTC (rev 253321)
@@ -331,6 +331,7 @@
     , variableSizedCellSpace("Variable Sized JSCell", heap, cellHeapCellType.get(), fastMallocAllocator.get()) // Hash:0xbcd769cc
     , destructibleCellSpace("Destructible JSCell", heap, destructibleCellHeapCellType.get(), fastMallocAllocator.get()) // Hash:0xbfff3d73
     , destructibleObjectSpace("JSDestructibleObject", heap, destructibleObjectHeapCellType.get(), fastMallocAllocator.get()) // Hash:0x4f5ed7a9
+    , arraySpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSArray)
     , bigIntSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), JSBigInt)
     , calleeSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSCallee)
     , clonedArgumentsSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), ClonedArguments)

Modified: trunk/Source/_javascript_Core/runtime/VM.h (253320 => 253321)


--- trunk/Source/_javascript_Core/runtime/VM.h	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2019-12-10 09:41:35 UTC (rev 253321)
@@ -421,6 +421,7 @@
     CompleteSubspace destructibleCellSpace;
     CompleteSubspace destructibleObjectSpace;
     
+    IsoSubspace arraySpace;
     IsoSubspace bigIntSpace;
     IsoSubspace calleeSpace;
     IsoSubspace clonedArgumentsSpace;

Modified: trunk/Source/_javascript_Core/tools/JSDollarVM.cpp (253320 => 253321)


--- trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2019-12-10 09:41:35 UTC (rev 253321)
@@ -492,11 +492,17 @@
     }
 };
 
-class RuntimeArray : public JSArray {
+class RuntimeArray final : public JSArray {
 public:
-    typedef JSArray Base;
+    using Base = JSArray;
     static constexpr unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames;
 
+    template<typename CellType, SubspaceAccess>
+    static CompleteSubspace* subspaceFor(VM& vm)
+    {
+        return &vm.cellSpace;
+    }
+
     static RuntimeArray* create(JSGlobalObject* globalObject, CallFrame* callFrame)
     {
         DollarVMAssertScope assertScope;

Modified: trunk/Source/WebCore/ChangeLog (253320 => 253321)


--- trunk/Source/WebCore/ChangeLog	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/WebCore/ChangeLog	2019-12-10 09:41:35 UTC (rev 253321)
@@ -1,3 +1,25 @@
+2019-12-10  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Put JSArray in IsoSubspace
+        https://bugs.webkit.org/show_bug.cgi?id=205049
+
+        Reviewed by Mark Lam.
+
+        RuntimeArray is inheriting JSArray. We should have separate IsoSubspace for this.
+
+        * bindings/js/WebCoreJSClientData.cpp:
+        (WebCore::JSVMClientData::JSVMClientData):
+        * bindings/js/WebCoreJSClientData.h:
+        (WebCore::JSVMClientData::runtimeArraySpace):
+        * bridge/runtime_array.cpp:
+        (JSC::RuntimeArray::subspaceForImpl):
+        * bridge/runtime_array.h:
+        (JSC::RuntimeArray::create): Deleted.
+        (JSC::RuntimeArray::getLength const): Deleted.
+        (JSC::RuntimeArray::getConcreteArray const): Deleted.
+        (JSC::RuntimeArray::createPrototype): Deleted.
+        (JSC::RuntimeArray::createStructure): Deleted.
+
 2019-12-09  Eric Carlson  <[email protected]>
 
         Rename media in the GPU process preference

Modified: trunk/Source/WebCore/bindings/js/WebCoreJSClientData.cpp (253320 => 253321)


--- trunk/Source/WebCore/bindings/js/WebCoreJSClientData.cpp	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSClientData.cpp	2019-12-10 09:41:35 UTC (rev 253321)
@@ -28,6 +28,8 @@
 
 #include "DOMGCOutputConstraint.h"
 #include "JSDOMBinding.h"
+#include "runtime_array.h"
+#include "runtime_method.h"
 #include <_javascript_Core/FastMallocAlignedMemoryAllocator.h>
 #include <_javascript_Core/HeapInlines.h>
 #include <_javascript_Core/JSDestructibleObjectHeapCellType.h>
@@ -34,7 +36,6 @@
 #include <_javascript_Core/MarkingConstraint.h>
 #include <_javascript_Core/SubspaceInlines.h>
 #include <_javascript_Core/VM.h>
-#include "runtime_method.h"
 #include <wtf/MainThread.h>
 
 namespace WebCore {
@@ -43,6 +44,7 @@
 JSVMClientData::JSVMClientData(VM& vm)
     : m_builtinFunctions(vm)
     , m_builtinNames(vm)
+    , m_runtimeArraySpace ISO_SUBSPACE_INIT(vm.heap, vm.cellHeapCellType.get(), RuntimeArray)
     , m_runtimeMethodSpace ISO_SUBSPACE_INIT(vm.heap, vm.cellHeapCellType.get(), RuntimeMethod) // Hash:0xf70c4a85
     , m_outputConstraintSpace("WebCore Wrapper w/ Output Constraint", vm.heap, vm.destructibleObjectHeapCellType.get(), vm.fastMallocAllocator.get()) // Hash:0x7724c2e4
     , m_globalObjectOutputConstraintSpace("WebCore Global Object w/ Output Constraint", vm.heap, vm.cellHeapCellType.get(), vm.fastMallocAllocator.get()) // Hash:0x522d6ec9

Modified: trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h (253320 => 253321)


--- trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/WebCore/bindings/js/WebCoreJSClientData.h	2019-12-10 09:41:35 UTC (rev 253321)
@@ -59,6 +59,7 @@
     WebCoreBuiltinNames& builtinNames() { return m_builtinNames; }
     JSBuiltinFunctions& builtinFunctions() { return m_builtinFunctions; }
     
+    JSC::IsoSubspace& runtimeArraySpace() { return m_runtimeArraySpace; }
     JSC::IsoSubspace& runtimeMethodSpace() { return m_runtimeMethodSpace; }
     
     JSC::CompleteSubspace& outputConstraintSpace() { return m_outputConstraintSpace; }
@@ -78,6 +79,7 @@
     JSBuiltinFunctions m_builtinFunctions;
     WebCoreBuiltinNames m_builtinNames;
     
+    JSC::IsoSubspace m_runtimeArraySpace;
     JSC::IsoSubspace m_runtimeMethodSpace;
     
     JSC::CompleteSubspace m_outputConstraintSpace;

Modified: trunk/Source/WebCore/bridge/runtime_array.cpp (253320 => 253321)


--- trunk/Source/WebCore/bridge/runtime_array.cpp	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/WebCore/bridge/runtime_array.cpp	2019-12-10 09:41:35 UTC (rev 253321)
@@ -27,6 +27,7 @@
 #include "runtime_array.h"
 
 #include "JSDOMBinding.h"
+#include "WebCoreJSClientData.h"
 #include <_javascript_Core/ArrayPrototype.h>
 #include <_javascript_Core/Error.h>
 #include <_javascript_Core/JSGlobalObjectInlines.h>
@@ -158,4 +159,9 @@
     return false;
 }
 
+IsoSubspace* RuntimeArray::subspaceForImpl(VM& vm)
+{
+    return &static_cast<JSVMClientData*>(vm.clientData)->runtimeArraySpace();
 }
+
+}

Modified: trunk/Source/WebCore/bridge/runtime_array.h (253320 => 253321)


--- trunk/Source/WebCore/bridge/runtime_array.h	2019-12-10 05:02:57 UTC (rev 253320)
+++ trunk/Source/WebCore/bridge/runtime_array.h	2019-12-10 09:41:35 UTC (rev 253321)
@@ -32,11 +32,17 @@
 
 namespace JSC {
     
-class RuntimeArray : public JSArray {
+class RuntimeArray final : public JSArray {
 public:
-    typedef JSArray Base;
+    using Base = JSArray;
     static constexpr unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames;
 
+    template<typename CellType, JSC::SubspaceAccess>
+    static IsoSubspace* subspaceFor(VM& vm)
+    {
+        return subspaceForImpl(vm);
+    }
+
     static RuntimeArray* create(JSGlobalObject* lexicalGlobalObject, Bindings::Array* array)
     {
         VM& vm = lexicalGlobalObject->vm();
@@ -86,6 +92,8 @@
     RuntimeArray(JSGlobalObject*, Structure*);
     static EncodedJSValue lengthGetter(JSGlobalObject*, EncodedJSValue, PropertyName);
 
+    static IsoSubspace* subspaceForImpl(VM&);
+
     BindingsArray* m_array;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to