Title: [197695] trunk/Source/_javascript_Core
Revision
197695
Author
benja...@webkit.org
Date
2016-03-07 10:57:16 -0800 (Mon, 07 Mar 2016)

Log Message

[JSC] Improve and64() and or64() with immediate on x86
https://bugs.webkit.org/show_bug.cgi?id=155104

Reviewed by Geoffrey Garen.

GetButterflyReadOnly was doing:
    movq 0x8(%rbx), %r9
    movq $0xfffffffffffffffc, %r11
    andq %r11, %r9
There is no need for the move to load the immediate,
andq sign extend its immediate.

With this patch, we have:
    movq 0x8(%rbx), %r9
    andq $0xfffffffffffffffc, %r9

* assembler/MacroAssemblerX86_64.h:
(JSC::MacroAssemblerX86_64::and64):
(JSC::MacroAssemblerX86_64::or64):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (197694 => 197695)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-07 18:52:11 UTC (rev 197694)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-07 18:57:16 UTC (rev 197695)
@@ -1,3 +1,25 @@
+2016-03-07  Benjamin Poulain  <benja...@webkit.org>
+
+        [JSC] Improve and64() and or64() with immediate on x86
+        https://bugs.webkit.org/show_bug.cgi?id=155104
+
+        Reviewed by Geoffrey Garen.
+
+        GetButterflyReadOnly was doing:
+            movq 0x8(%rbx), %r9
+            movq $0xfffffffffffffffc, %r11
+            andq %r11, %r9
+        There is no need for the move to load the immediate,
+        andq sign extend its immediate.
+
+        With this patch, we have:
+            movq 0x8(%rbx), %r9
+            andq $0xfffffffffffffffc, %r9
+
+        * assembler/MacroAssemblerX86_64.h:
+        (JSC::MacroAssemblerX86_64::and64):
+        (JSC::MacroAssemblerX86_64::or64):
+
 2016-03-07  Brian Burg  <bb...@apple.com>
 
         Web Inspector: It should be possible to initialize generated ObjC protocol types from an NSDictionary payload

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerX86_64.h (197694 => 197695)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerX86_64.h	2016-03-07 18:52:11 UTC (rev 197694)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerX86_64.h	2016-03-07 18:57:16 UTC (rev 197695)
@@ -345,6 +345,12 @@
 
     void and64(TrustedImmPtr imm, RegisterID srcDest)
     {
+        intptr_t intValue = imm.asIntptr();
+        if (intValue <= std::numeric_limits<int32_t>::max()
+            && intValue >= std::numeric_limits<int32_t>::min()) {
+            and64(TrustedImm32(static_cast<int32_t>(intValue)), srcDest);
+            return;
+        }
         move(imm, scratchRegister());
         and64(scratchRegister(), srcDest);
     }
@@ -487,10 +493,15 @@
         m_assembler.orq_rr(src, dest);
     }
 
-    void or64(TrustedImm64 imm, RegisterID dest)
+    void or64(TrustedImm64 imm, RegisterID srcDest)
     {
+        if (imm.m_value <= std::numeric_limits<int32_t>::max()
+            && imm.m_value >= std::numeric_limits<int32_t>::min()) {
+            or64(TrustedImm32(static_cast<int32_t>(imm.m_value)), srcDest);
+            return;
+        }
         move(imm, scratchRegister());
-        or64(scratchRegister(), dest);
+        or64(scratchRegister(), srcDest);
     }
 
     void or64(TrustedImm32 imm, RegisterID dest)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to