Title: [247832] trunk/Source/_javascript_Core
Revision
247832
Author
[email protected]
Date
2019-07-25 11:28:53 -0700 (Thu, 25 Jul 2019)

Log Message

[JSC] Make visitChildren implementation more idiomatic
https://bugs.webkit.org/show_bug.cgi?id=200121

Reviewed by Mark Lam.

This patch makes visitChildren implementations more idiomatic: cast, assert, and calling Base::visitChildren.
While this does not find interesting issues, it is still nice to have consistent implementations.
StructureChain::visitChildren missed Base::visitChildren, but it does not have much effect since StructureChain
is immortal cell.

* bytecode/ExecutableToCodeBlockEdge.cpp:
(JSC::ExecutableToCodeBlockEdge::visitChildren):
* runtime/AbstractModuleRecord.cpp:
(JSC::AbstractModuleRecord::visitChildren):
* runtime/FunctionRareData.cpp:
(JSC::FunctionRareData::visitChildren):
* runtime/JSArrayBufferView.cpp:
(JSC::JSArrayBufferView::visitChildren):
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::visitChildren):
* runtime/JSImmutableButterfly.cpp:
(JSC::JSImmutableButterfly::visitChildren):
* runtime/JSModuleEnvironment.cpp:
(JSC::JSModuleEnvironment::visitChildren):
* runtime/JSModuleRecord.cpp:
(JSC::JSModuleRecord::visitChildren):
* runtime/JSPropertyNameEnumerator.cpp:
(JSC::JSPropertyNameEnumerator::visitChildren):
* runtime/JSString.cpp:
(JSC::JSString::visitChildren):
* runtime/SparseArrayValueMap.cpp:
(JSC::SparseArrayValueMap::visitChildren):
* runtime/StructureChain.cpp:
(JSC::StructureChain::visitChildren):
* runtime/SymbolTable.cpp:
(JSC::SymbolTable::visitChildren):
* tools/JSDollarVM.cpp:
(JSC::Root::visitChildren):
(JSC::ImpureGetter::visitChildren):
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::visitChildren):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (247831 => 247832)


--- trunk/Source/_javascript_Core/ChangeLog	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-07-25 18:28:53 UTC (rev 247832)
@@ -1,3 +1,47 @@
+2019-07-25  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Make visitChildren implementation more idiomatic
+        https://bugs.webkit.org/show_bug.cgi?id=200121
+
+        Reviewed by Mark Lam.
+
+        This patch makes visitChildren implementations more idiomatic: cast, assert, and calling Base::visitChildren.
+        While this does not find interesting issues, it is still nice to have consistent implementations.
+        StructureChain::visitChildren missed Base::visitChildren, but it does not have much effect since StructureChain
+        is immortal cell.
+
+        * bytecode/ExecutableToCodeBlockEdge.cpp:
+        (JSC::ExecutableToCodeBlockEdge::visitChildren):
+        * runtime/AbstractModuleRecord.cpp:
+        (JSC::AbstractModuleRecord::visitChildren):
+        * runtime/FunctionRareData.cpp:
+        (JSC::FunctionRareData::visitChildren):
+        * runtime/JSArrayBufferView.cpp:
+        (JSC::JSArrayBufferView::visitChildren):
+        * runtime/JSGenericTypedArrayViewInlines.h:
+        (JSC::JSGenericTypedArrayView<Adaptor>::visitChildren):
+        * runtime/JSImmutableButterfly.cpp:
+        (JSC::JSImmutableButterfly::visitChildren):
+        * runtime/JSModuleEnvironment.cpp:
+        (JSC::JSModuleEnvironment::visitChildren):
+        * runtime/JSModuleRecord.cpp:
+        (JSC::JSModuleRecord::visitChildren):
+        * runtime/JSPropertyNameEnumerator.cpp:
+        (JSC::JSPropertyNameEnumerator::visitChildren):
+        * runtime/JSString.cpp:
+        (JSC::JSString::visitChildren):
+        * runtime/SparseArrayValueMap.cpp:
+        (JSC::SparseArrayValueMap::visitChildren):
+        * runtime/StructureChain.cpp:
+        (JSC::StructureChain::visitChildren):
+        * runtime/SymbolTable.cpp:
+        (JSC::SymbolTable::visitChildren):
+        * tools/JSDollarVM.cpp:
+        (JSC::Root::visitChildren):
+        (JSC::ImpureGetter::visitChildren):
+        * wasm/js/WebAssemblyModuleRecord.cpp:
+        (JSC::WebAssemblyModuleRecord::visitChildren):
+
 2019-07-25  Ross Kirsling  <[email protected]>
 
         [ESNext] Implement nullish coalescing

Modified: trunk/Source/_javascript_Core/bytecode/ExecutableToCodeBlockEdge.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/bytecode/ExecutableToCodeBlockEdge.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/bytecode/ExecutableToCodeBlockEdge.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -55,6 +55,7 @@
 {
     VM& vm = visitor.vm();
     ExecutableToCodeBlockEdge* edge = jsCast<ExecutableToCodeBlockEdge*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(cell, info());
     Base::visitChildren(cell, visitor);
 
     CodeBlock* codeBlock = edge->m_codeBlock.get();

Modified: trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -71,6 +71,7 @@
 void AbstractModuleRecord::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     AbstractModuleRecord* thisObject = jsCast<AbstractModuleRecord*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
     visitor.append(thisObject->m_moduleEnvironment);
     visitor.append(thisObject->m_moduleNamespaceObject);

Modified: trunk/Source/_javascript_Core/runtime/FunctionRareData.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/FunctionRareData.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/FunctionRareData.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -54,6 +54,7 @@
 void FunctionRareData::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     FunctionRareData* rareData = jsCast<FunctionRareData*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(cell, info());
     Base::visitChildren(cell, visitor);
 
     rareData->m_objectAllocationProfile.visitAggregate(visitor);

Modified: trunk/Source/_javascript_Core/runtime/JSArrayBufferView.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/JSArrayBufferView.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBufferView.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -164,6 +164,7 @@
 void JSArrayBufferView::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     JSArrayBufferView* thisObject = jsCast<JSArrayBufferView*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(cell, visitor);
 
     if (thisObject->hasArrayBuffer()) {

Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h	2019-07-25 18:28:53 UTC (rev 247832)
@@ -516,6 +516,7 @@
 void JSGenericTypedArrayView<Adaptor>::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
 
     TypedArrayMode mode;

Modified: trunk/Source/_javascript_Core/runtime/JSImmutableButterfly.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/JSImmutableButterfly.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/JSImmutableButterfly.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -34,6 +34,7 @@
 
 void JSImmutableButterfly::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
+    ASSERT_GC_OBJECT_INHERITS(cell, info());
     Base::visitChildren(cell, visitor);
     if (!hasContiguous(cell->indexingType())) {
         ASSERT(hasDouble(cell->indexingType()) || hasInt32(cell->indexingType()));

Modified: trunk/Source/_javascript_Core/runtime/JSModuleEnvironment.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/JSModuleEnvironment.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/JSModuleEnvironment.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -70,6 +70,7 @@
 void JSModuleEnvironment::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     JSModuleEnvironment* thisObject = jsCast<JSModuleEnvironment*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
     visitor.appendValues(thisObject->variables(), thisObject->symbolTable()->scopeSize());
     visitor.append(thisObject->moduleRecordSlot());

Modified: trunk/Source/_javascript_Core/runtime/JSModuleRecord.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/JSModuleRecord.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/JSModuleRecord.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -74,6 +74,7 @@
 void JSModuleRecord::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     JSModuleRecord* thisObject = jsCast<JSModuleRecord*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
     visitor.append(thisObject->m_moduleProgramExecutable);
 }

Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -87,8 +87,9 @@
 
 void JSPropertyNameEnumerator::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
+    JSPropertyNameEnumerator* thisObject = jsCast<JSPropertyNameEnumerator*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(cell, visitor);
-    JSPropertyNameEnumerator* thisObject = jsCast<JSPropertyNameEnumerator*>(cell);
     auto locker = holdLock(thisObject->cellLock());
     for (auto& propertyName : thisObject->m_propertyNames)
         visitor.append(propertyName);

Modified: trunk/Source/_javascript_Core/runtime/JSString.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/JSString.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/JSString.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -113,6 +113,7 @@
 void JSString::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     JSString* thisObject = asString(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
     
     uintptr_t pointer = thisObject->m_fiber;

Modified: trunk/Source/_javascript_Core/runtime/SparseArrayValueMap.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/SparseArrayValueMap.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/SparseArrayValueMap.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -214,8 +214,9 @@
 
 void SparseArrayValueMap::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
+    SparseArrayValueMap* thisObject = jsCast<SparseArrayValueMap*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(cell, visitor);
-    SparseArrayValueMap* thisObject = jsCast<SparseArrayValueMap*>(cell);
     {
         auto locker = holdLock(thisObject->cellLock());
         for (auto& entry : thisObject->m_map)

Modified: trunk/Source/_javascript_Core/runtime/StructureChain.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/StructureChain.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/StructureChain.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -48,6 +48,7 @@
 {
     StructureChain* thisObject = jsCast<StructureChain*>(cell);
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+    Base::visitChildren(thisObject, visitor);
     if (WriteBarrier<Structure>* vector = thisObject->m_vector.get()) {
         size_t i = 0;
         while (vector[i])

Modified: trunk/Source/_javascript_Core/runtime/SymbolTable.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/runtime/SymbolTable.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/runtime/SymbolTable.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -95,6 +95,7 @@
 void SymbolTable::visitChildren(JSCell* thisCell, SlotVisitor& visitor)
 {
     SymbolTable* thisSymbolTable = jsCast<SymbolTable*>(thisCell);
+    ASSERT_GC_OBJECT_INHERITS(thisSymbolTable, info());
     Base::visitChildren(thisSymbolTable, visitor);
 
     visitor.append(thisSymbolTable->m_arguments);

Modified: trunk/Source/_javascript_Core/tools/JSDollarVM.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -222,6 +222,7 @@
 
     static void visitChildren(JSCell* thisObject, SlotVisitor& visitor)
     {
+        ASSERT_GC_OBJECT_INHERITS(thisObject, info());
         Base::visitChildren(thisObject, visitor);
         visitor.addOpaqueRoot(thisObject);
     }
@@ -325,6 +326,7 @@
 
     static void visitChildren(JSCell* cell, SlotVisitor& visitor)
     {
+        ASSERT_GC_OBJECT_INHERITS(cell, info());
         Base::visitChildren(cell, visitor);
         ImpureGetter* thisObject = jsCast<ImpureGetter*>(cell);
         visitor.append(thisObject->m_delegate);

Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp (247831 => 247832)


--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp	2019-07-25 18:17:20 UTC (rev 247831)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp	2019-07-25 18:28:53 UTC (rev 247832)
@@ -81,6 +81,7 @@
 void WebAssemblyModuleRecord::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     WebAssemblyModuleRecord* thisObject = jsCast<WebAssemblyModuleRecord*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
     visitor.append(thisObject->m_instance);
     visitor.append(thisObject->m_startFunction);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to