Title: [236183] releases/WebKitGTK/webkit-2.22/Source/WebCore
Revision
236183
Author
carlo...@webkit.org
Date
2018-09-19 06:18:52 -0700 (Wed, 19 Sep 2018)

Log Message

Merge r235829 - [CSSJIT] Use lshiftPtr instead of mul32
https://bugs.webkit.org/show_bug.cgi?id=189451

Reviewed by Sam Weinig.

Use `value << 4` instead of `value * 16`. In 64bit environment, sizeof(Style::Relation) is 16,
so that we can use `value << 4` in CSS JIT.

No behavior change.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelation):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog (236182 => 236183)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2018-09-19 13:18:47 UTC (rev 236182)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2018-09-19 13:18:52 UTC (rev 236183)
@@ -1,3 +1,18 @@
+2018-09-08  Yusuke Suzuki  <yusukesuz...@slowstart.org>
+
+        [CSSJIT] Use lshiftPtr instead of mul32
+        https://bugs.webkit.org/show_bug.cgi?id=189451
+
+        Reviewed by Sam Weinig.
+
+        Use `value << 4` instead of `value * 16`. In 64bit environment, sizeof(Style::Relation) is 16,
+        so that we can use `value << 4` in CSS JIT.
+
+        No behavior change.
+
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelation):
+
 2018-09-07  Rob Buis  <rb...@igalia.com>
 
         XMLHttpRequest: open() does not throw a SYNTAX_ERR exception if method is empty or url cannot be resolved

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/cssjit/SelectorCompiler.cpp (236182 => 236183)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/cssjit/SelectorCompiler.cpp	2018-09-19 13:18:47 UTC (rev 236182)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/cssjit/SelectorCompiler.cpp	2018-09-19 13:18:52 UTC (rev 236183)
@@ -2211,6 +2211,18 @@
     auto dataAddress = vectorAddress.withOffset(Style::Relations::dataMemoryOffset());
     auto sizeAddress = vectorAddress.withOffset(Style::Relations::sizeMemoryOffset());
 
+    auto getLastRelationPointer = [&] (Assembler::RegisterID sizeAndTarget) {
+        m_assembler.sub32(Assembler::TrustedImm32(1), sizeAndTarget);
+#if CPU(ADDRESS64)
+        static_assert(sizeof(Style::Relation) == 16, "");
+        static_assert(1 << 4 == 16, "");
+        m_assembler.lshiftPtr(Assembler::TrustedImm32(4), sizeAndTarget);
+#else
+        m_assembler.mul32(TrustedImm32(sizeof(Style::Relation)), sizeAndTarget, sizeAndTarget);
+#endif
+        m_assembler.addPtr(dataAddress, sizeAndTarget);
+    };
+
     // For AffectsNextSibling we just increment the count if the previous added relation was in the same sibling chain.
     Assembler::JumpList mergeSuccess;
     if (relationType == Style::Relation::AffectsNextSibling) {
@@ -2223,9 +2235,7 @@
         mergeFailure.append(m_assembler.branchTest32(Assembler::Zero, lastRelation));
 
         // Style::Relation& lastRelation = checkingContext.styleRelations.last();
-        m_assembler.sub32(Assembler::TrustedImm32(1), lastRelation);
-        m_assembler.mul32(Assembler::TrustedImm32(sizeof(Style::Relation)), lastRelation, lastRelation);
-        m_assembler.addPtr(dataAddress, lastRelation);
+        getLastRelationPointer(lastRelation);
 
         // if (lastRelation.type == Style::Relation::AffectsNextSibling)
         Assembler::Address typeAddress(lastRelation, OBJECT_OFFSETOF(Style::Relation, type));
@@ -2259,9 +2269,7 @@
 
     LocalRegister relationPointer(m_registerAllocator);
     m_assembler.load32(sizeAddress, relationPointer);
-    m_assembler.sub32(Assembler::TrustedImm32(1), relationPointer);
-    m_assembler.mul32(Assembler::TrustedImm32(sizeof(Style::Relation)), relationPointer, relationPointer);
-    m_assembler.addPtr(dataAddress, relationPointer);
+    getLastRelationPointer(relationPointer);
 
     Assembler::Address typeAddress(relationPointer, OBJECT_OFFSETOF(Style::Relation, type));
     m_assembler.store32(Assembler::TrustedImm32(relationType), typeAddress);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to