Title: [295022] trunk/Source/_javascript_Core/runtime
Revision
295022
Author
[email protected]
Date
2022-05-30 03:00:00 -0700 (Mon, 30 May 2022)

Log Message

[JSC] Shrink BrandedStructure
https://bugs.webkit.org/show_bug.cgi?id=241092

Reviewed by Mark Lam.

Use CompactRefPtr and WriteBarrierStructureID to shrink sizeof(BrandedStructure) from 112 to 104.
While it is not enough for 32byte alignment, anyway we can make it smaller, and if we make it 8byte
smaller further, it will become 96bytes.

* Source/_javascript_Core/runtime/BrandedStructure.cpp:
(JSC::BrandedStructure::BrandedStructure):
* Source/_javascript_Core/runtime/BrandedStructure.h:

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/runtime/BrandedStructure.cpp (295021 => 295022)


--- trunk/Source/_javascript_Core/runtime/BrandedStructure.cpp	2022-05-30 08:29:03 UTC (rev 295021)
+++ trunk/Source/_javascript_Core/runtime/BrandedStructure.cpp	2022-05-30 10:00:00 UTC (rev 295022)
@@ -36,7 +36,7 @@
     , m_brand(brandUid)
 {
     if (previous->isBrandedStructure())
-        m_parentBrand.set(vm, this, jsCast<BrandedStructure*>(previous));
+        m_parentBrand.set(vm, this, previous);
     this->setIsBrandedStructure(true);
 }
 
@@ -43,7 +43,7 @@
 BrandedStructure::BrandedStructure(VM& vm, BrandedStructure* previous)
     : Structure(vm, previous)
     , m_brand(previous->m_brand)
-    , m_parentBrand(vm, this, previous->m_parentBrand.get(), WriteBarrier<BrandedStructure>::MayBeNull)
+    , m_parentBrand(vm, this, previous->m_parentBrand.get(), WriteBarrierStructureID::MayBeNull)
 {
     this->setIsBrandedStructure(true);
 }

Modified: trunk/Source/_javascript_Core/runtime/BrandedStructure.h (295021 => 295022)


--- trunk/Source/_javascript_Core/runtime/BrandedStructure.h	2022-05-30 08:29:03 UTC (rev 295021)
+++ trunk/Source/_javascript_Core/runtime/BrandedStructure.h	2022-05-30 10:00:00 UTC (rev 295022)
@@ -53,7 +53,7 @@
     ALWAYS_INLINE bool checkBrand(Symbol* brand)
     {
         UniquedStringImpl* brandUid = &brand->uid();
-        for (BrandedStructure* currentStructure = this; currentStructure; currentStructure = currentStructure->m_parentBrand.get()) {
+        for (BrandedStructure* currentStructure = this; currentStructure; currentStructure = jsCast<BrandedStructure*>(currentStructure->m_parentBrand.get())) {
             if (brandUid == currentStructure->m_brand)
                 return true;
         }
@@ -78,8 +78,8 @@
         m_brand = nullptr;
     }
 
-    RefPtr<UniquedStringImpl> m_brand;
-    WriteBarrier<BrandedStructure> m_parentBrand;
+    CompactRefPtr<UniquedStringImpl> m_brand;
+    WriteBarrierStructureID m_parentBrand;
 
     friend class Structure;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to