Title: [256879] branches/safari-609.1.20.2-branch/Source/WebCore
Revision
256879
Author
alanc...@apple.com
Date
2020-02-18 16:01:42 -0800 (Tue, 18 Feb 2020)

Log Message

Revert r256689. rdar://problem/59478731

Modified Paths

Diff

Modified: branches/safari-609.1.20.2-branch/Source/WebCore/ChangeLog (256878 => 256879)


--- branches/safari-609.1.20.2-branch/Source/WebCore/ChangeLog	2020-02-19 00:01:38 UTC (rev 256878)
+++ branches/safari-609.1.20.2-branch/Source/WebCore/ChangeLog	2020-02-19 00:01:42 UTC (rev 256879)
@@ -129,62 +129,6 @@
 
 2020-02-14  Russell Epstein  <repst...@apple.com>
 
-        Cherry-pick r256423. rdar://problem/59478731
-
-    Compress ImmutableStyleProperties by using PackedPtr
-    https://bugs.webkit.org/show_bug.cgi?id=207604
-    
-    Reviewed by Mark Lam.
-    
-    ImmutableStyleProperties is kept so long and consumes enough memory.
-    We already attempted to compact it by storing CSSProperty's members separately.
-    But we can compact further by using PackedPtr. This patch makes,
-    
-        1. Use PackedPtr for CSSValue* in ImmutableStyleProperties so that we can cut some bytes
-        2. Reorder CSSValue* and StylePropertyMetadata arrays since StylePropertyMetadata requires alignment while PackedPtr<CSSValue> is not.
-    
-    No behavior change.
-    
-    * css/StyleProperties.cpp:
-    (WebCore::sizeForImmutableStylePropertiesWithPropertyCount):
-    (WebCore::ImmutableStyleProperties::ImmutableStyleProperties):
-    (WebCore::ImmutableStyleProperties::~ImmutableStyleProperties):
-    (WebCore::ImmutableStyleProperties::findCustomPropertyIndex const):
-    * css/StyleProperties.h:
-    (WebCore::ImmutableStyleProperties::valueArray const):
-    (WebCore::ImmutableStyleProperties::metadataArray const):
-    (WebCore::ImmutableStyleProperties::propertyAt const):
-    
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
-    2020-02-11  Yusuke Suzuki  <ysuz...@apple.com>
-
-            Compress ImmutableStyleProperties by using PackedPtr
-            https://bugs.webkit.org/show_bug.cgi?id=207604
-
-            Reviewed by Mark Lam.
-
-            ImmutableStyleProperties is kept so long and consumes enough memory.
-            We already attempted to compact it by storing CSSProperty's members separately.
-            But we can compact further by using PackedPtr. This patch makes,
-
-                1. Use PackedPtr for CSSValue* in ImmutableStyleProperties so that we can cut some bytes
-                2. Reorder CSSValue* and StylePropertyMetadata arrays since StylePropertyMetadata requires alignment while PackedPtr<CSSValue> is not.
-
-            No behavior change.
-
-            * css/StyleProperties.cpp:
-            (WebCore::sizeForImmutableStylePropertiesWithPropertyCount):
-            (WebCore::ImmutableStyleProperties::ImmutableStyleProperties):
-            (WebCore::ImmutableStyleProperties::~ImmutableStyleProperties):
-            (WebCore::ImmutableStyleProperties::findCustomPropertyIndex const):
-            * css/StyleProperties.h:
-            (WebCore::ImmutableStyleProperties::valueArray const):
-            (WebCore::ImmutableStyleProperties::metadataArray const):
-            (WebCore::ImmutableStyleProperties::propertyAt const):
-
-2020-02-14  Russell Epstein  <repst...@apple.com>
-
         Cherry-pick r254681. rdar://problem/59474790
 
     [Win] Fix AppleWin build

Modified: branches/safari-609.1.20.2-branch/Source/WebCore/css/StyleProperties.cpp (256878 => 256879)


--- branches/safari-609.1.20.2-branch/Source/WebCore/css/StyleProperties.cpp	2020-02-19 00:01:38 UTC (rev 256878)
+++ branches/safari-609.1.20.2-branch/Source/WebCore/css/StyleProperties.cpp	2020-02-19 00:01:42 UTC (rev 256879)
@@ -55,7 +55,7 @@
 
 static size_t sizeForImmutableStylePropertiesWithPropertyCount(unsigned count)
 {
-    return sizeof(ImmutableStyleProperties) - sizeof(void*) + sizeof(StylePropertyMetadata) * count + sizeof(PackedPtr<const CSSValue>) * count;
+    return sizeof(ImmutableStyleProperties) - sizeof(void*) + sizeof(CSSValue*) * count + sizeof(StylePropertyMetadata) * count;
 }
 
 static bool isInitialOrInherit(const String& value)
@@ -94,18 +94,17 @@
     : StyleProperties(cssParserMode, length)
 {
     StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(this->metadataArray());
-    PackedPtr<CSSValue>* valueArray = bitwise_cast<PackedPtr<CSSValue>*>(this->valueArray());
+    CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray());
     for (unsigned i = 0; i < length; ++i) {
         metadataArray[i] = properties[i].metadata();
-        auto* value = properties[i].value();
-        valueArray[i] = value;
-        value->ref();
+        valueArray[i] = properties[i].value();
+        valueArray[i]->ref();
     }
 }
 
 ImmutableStyleProperties::~ImmutableStyleProperties()
 {
-    PackedPtr<CSSValue>* valueArray = bitwise_cast<PackedPtr<CSSValue>*>(this->valueArray());
+    CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray());
     for (unsigned i = 0; i < m_arraySize; ++i)
         valueArray[i]->deref();
 }
@@ -1472,10 +1471,9 @@
     for (int n = m_arraySize - 1 ; n >= 0; --n) {
         if (metadataArray()[n].m_propertyID == CSSPropertyCustom) {
             // We found a custom property. See if the name matches.
-            auto* value = valueArray()[n].get();
-            if (!value)
+            if (!valueArray()[n])
                 continue;
-            if (downcast<CSSCustomPropertyValue>(*value).name() == propertyName)
+            if (downcast<CSSCustomPropertyValue>(*valueArray()[n]).name() == propertyName)
                 return n;
         }
     }

Modified: branches/safari-609.1.20.2-branch/Source/WebCore/css/StyleProperties.h (256878 => 256879)


--- branches/safari-609.1.20.2-branch/Source/WebCore/css/StyleProperties.h	2020-02-19 00:01:38 UTC (rev 256878)
+++ branches/safari-609.1.20.2-branch/Source/WebCore/css/StyleProperties.h	2020-02-19 00:01:42 UTC (rev 256879)
@@ -190,6 +190,8 @@
     bool isEmpty() const { return !propertyCount(); }
     PropertyReference propertyAt(unsigned index) const;
 
+    const CSSValue** valueArray() const;
+    const StylePropertyMetadata* metadataArray() const;
     int findPropertyIndex(CSSPropertyID) const;
     int findCustomPropertyIndex(const String& propertyName) const;
     
@@ -196,19 +198,17 @@
     void* m_storage;
 
 private:
-    PackedPtr<const CSSValue>* valueArray() const;
-    const StylePropertyMetadata* metadataArray() const;
     ImmutableStyleProperties(const CSSProperty*, unsigned count, CSSParserMode);
 };
 
-inline PackedPtr<const CSSValue>* ImmutableStyleProperties::valueArray() const
+inline const CSSValue** ImmutableStyleProperties::valueArray() const
 {
-    return bitwise_cast<PackedPtr<const CSSValue>*>(bitwise_cast<const uint8_t*>(metadataArray()) + (m_arraySize * sizeof(StylePropertyMetadata)));
+    return reinterpret_cast<const CSSValue**>(const_cast<const void**>((&(this->m_storage))));
 }
 
 inline const StylePropertyMetadata* ImmutableStyleProperties::metadataArray() const
 {
-    return reinterpret_cast<const StylePropertyMetadata*>(const_cast<const void**>((&(this->m_storage))));
+    return reinterpret_cast_ptr<const StylePropertyMetadata*>(&reinterpret_cast_ptr<const char*>(&(this->m_storage))[m_arraySize * sizeof(CSSValue*)]);
 }
 
 DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(MutableStyleProperties);
@@ -289,7 +289,7 @@
 
 inline ImmutableStyleProperties::PropertyReference ImmutableStyleProperties::propertyAt(unsigned index) const
 {
-    return PropertyReference(metadataArray()[index], valueArray()[index].get());
+    return PropertyReference(metadataArray()[index], valueArray()[index]);
 }
 
 inline MutableStyleProperties::PropertyReference MutableStyleProperties::propertyAt(unsigned index) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to