Title: [295061] trunk/Source/_javascript_Core/runtime
Revision
295061
Author
[email protected]
Date
2022-05-31 12:14:39 -0700 (Tue, 31 May 2022)

Log Message

Simplify Structure::checkOffsetConsistency()
https://bugs.webkit.org/show_bug.cgi?id=241025

Reviewed by Geoffrey Garen.

Drop redundant isCompilationThread() check in checkOffsetConsistency() before calling
checkOffsetConsistency(PropertyTable*, const DetailsFunc&) since the callee already
does this check. Hopefully, the compiler was already optimizing out the duplicate
check but it is better to be sure given that this check shows on speedometer profiles,
mostly under checkOffsetConsistency().

Also drop the return value since no caller makes use of it.

* Source/_javascript_Core/runtime/Structure.h:
* Source/_javascript_Core/runtime/StructureInlines.h:
(JSC::Structure::checkOffsetConsistency const):

Canonical link: https://commits.webkit.org/251156@main

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/runtime/Structure.h (295060 => 295061)


--- trunk/Source/_javascript_Core/runtime/Structure.h	2022-05-31 18:09:31 UTC (rev 295060)
+++ trunk/Source/_javascript_Core/runtime/Structure.h	2022-05-31 19:14:39 UTC (rev 295061)
@@ -939,8 +939,8 @@
     }
 
     template<typename DetailsFunc>
-    bool checkOffsetConsistency(PropertyTable*, const DetailsFunc&) const;
-    bool checkOffsetConsistency() const;
+    void checkOffsetConsistency(PropertyTable*, const DetailsFunc&) const;
+    void checkOffsetConsistency() const;
 
     JS_EXPORT_PRIVATE void allocateRareData(VM&);
     

Modified: trunk/Source/_javascript_Core/runtime/StructureInlines.h (295060 => 295061)


--- trunk/Source/_javascript_Core/runtime/StructureInlines.h	2022-05-31 18:09:31 UTC (rev 295060)
+++ trunk/Source/_javascript_Core/runtime/StructureInlines.h	2022-05-31 19:14:39 UTC (rev 295061)
@@ -388,7 +388,7 @@
 }
 
 template<typename DetailsFunc>
-ALWAYS_INLINE bool Structure::checkOffsetConsistency(PropertyTable* propertyTable, const DetailsFunc& detailsFunc) const
+ALWAYS_INLINE void Structure::checkOffsetConsistency(PropertyTable* propertyTable, const DetailsFunc& detailsFunc) const
 {
     // We cannot reliably assert things about the property table in the concurrent
     // compilation thread. It is possible for the table to be stolen and then have
@@ -395,7 +395,7 @@
     // things added to it, which leads to the offsets being all messed up. We could
     // get around this by grabbing a lock here, but I think that would be overkill.
     if (isCompilationThread())
-        return true;
+        return;
     
     unsigned totalSize = propertyTable->propertyStorageSize();
     unsigned inlineOverflowAccordingToTotalSize = totalSize < m_inlineCapacity ? 0 : totalSize - m_inlineCapacity;
@@ -419,27 +419,14 @@
         fail("numberOfSlotsForMaxOffset doesn't match totalSize");
     if (inlineOverflowAccordingToTotalSize != numberOfOutOfLineSlotsForMaxOffset(maxOffset()))
         fail("inlineOverflowAccordingToTotalSize doesn't match numberOfOutOfLineSlotsForMaxOffset");
-
-    return true;
 }
 
-ALWAYS_INLINE bool Structure::checkOffsetConsistency() const
+ALWAYS_INLINE void Structure::checkOffsetConsistency() const
 {
-    PropertyTable* propertyTable = propertyTableOrNull();
-
-    if (!propertyTable) {
+    if (auto* propertyTable = propertyTableOrNull())
+        checkOffsetConsistency(propertyTable, [] { });
+    else
         ASSERT(!isPinnedPropertyTable());
-        return true;
-    }
-
-    // We cannot reliably assert things about the property table in the concurrent
-    // compilation thread. It is possible for the table to be stolen and then have
-    // things added to it, which leads to the offsets being all messed up. We could
-    // get around this by grabbing a lock here, but I think that would be overkill.
-    if (isCompilationThread())
-        return true;
-
-    return checkOffsetConsistency(propertyTable, [] () { });
 }
 
 inline void Structure::checkConsistency()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to