Title: [240684] trunk/Source/_javascript_Core
Revision
240684
Author
[email protected]
Date
2019-01-29 14:25:36 -0800 (Tue, 29 Jan 2019)

Log Message

Remove unneeded CPU(BIG_ENDIAN) handling in LLInt after new bytecode format.
https://bugs.webkit.org/show_bug.cgi?id=132333

Reviewed by Yusuke Suzuki.

* bytecode/InstructionStream.h:
(JSC::InstructionStreamWriter::write):
- The 32-bit write() function need not invert the order of the bytes written to
  the bytecode stream for CPU(BUG_ENDIAN) because the incoming uint32_t value to
  be written is already in big endian order for CPU(BUG_ENDIAN) platforms.

* llint/LLIntOfflineAsmConfig.h:
- OFFLINE_ASM_BIG_ENDIAN is no longer needed nor used after the new bytecode format.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (240683 => 240684)


--- trunk/Source/_javascript_Core/ChangeLog	2019-01-29 22:12:51 UTC (rev 240683)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-01-29 22:25:36 UTC (rev 240684)
@@ -1,5 +1,21 @@
 2019-01-29  Mark Lam  <[email protected]>
 
+        Remove unneeded CPU(BIG_ENDIAN) handling in LLInt after new bytecode format.
+        https://bugs.webkit.org/show_bug.cgi?id=132333
+
+        Reviewed by Yusuke Suzuki.
+
+        * bytecode/InstructionStream.h:
+        (JSC::InstructionStreamWriter::write):
+        - The 32-bit write() function need not invert the order of the bytes written to
+          the bytecode stream for CPU(BUG_ENDIAN) because the incoming uint32_t value to
+          be written is already in big endian order for CPU(BUG_ENDIAN) platforms.
+
+        * llint/LLIntOfflineAsmConfig.h:
+        - OFFLINE_ASM_BIG_ENDIAN is no longer needed nor used after the new bytecode format.
+
+2019-01-29  Mark Lam  <[email protected]>
+
         ValueRecovery::recover() should purify NaN values it recovers.
         https://bugs.webkit.org/show_bug.cgi?id=193978
         <rdar://problem/47625488>

Modified: trunk/Source/_javascript_Core/bytecode/InstructionStream.h (240683 => 240684)


--- trunk/Source/_javascript_Core/bytecode/InstructionStream.h	2019-01-29 22:12:51 UTC (rev 240683)
+++ trunk/Source/_javascript_Core/bytecode/InstructionStream.h	2019-01-29 22:25:36 UTC (rev 240684)
@@ -213,21 +213,16 @@
     void write(uint32_t i)
     {
         ASSERT(!m_finalized);
-        union {
-            uint32_t i;
-            uint8_t bytes[4];
-        } u { i };
-#if CPU(BIG_ENDIAN)
-        write(u.bytes[3]);
-        write(u.bytes[2]);
-        write(u.bytes[1]);
-        write(u.bytes[0]);
-#else // !CPU(BIG_ENDIAN)
-        write(u.bytes[0]);
-        write(u.bytes[1]);
-        write(u.bytes[2]);
-        write(u.bytes[3]);
-#endif // !CPU(BIG_ENDIAN)
+        uint8_t bytes[4];
+        std::memcpy(bytes, &i, sizeof(i));
+
+        // Though not always obvious, we don't have to invert the order of the
+        // bytes written here for CPU(BIG_ENDIAN). This is because the incoming
+        // i value is already ordered in big endian on CPU(BIG_EDNDIAN) platforms.
+        write(bytes[0]);
+        write(bytes[1]);
+        write(bytes[2]);
+        write(bytes[3]);
     }
 
     void rewind(MutableRef& ref)

Modified: trunk/Source/_javascript_Core/llint/LLIntOfflineAsmConfig.h (240683 => 240684)


--- trunk/Source/_javascript_Core/llint/LLIntOfflineAsmConfig.h	2019-01-29 22:12:51 UTC (rev 240683)
+++ trunk/Source/_javascript_Core/llint/LLIntOfflineAsmConfig.h	2019-01-29 22:25:36 UTC (rev 240684)
@@ -148,12 +148,6 @@
 #define OFFLINE_ASM_ASSERT_ENABLED 0
 #endif
 
-#if CPU(BIG_ENDIAN)
-#define OFFLINE_ASM_BIG_ENDIAN 1
-#else
-#define OFFLINE_ASM_BIG_ENDIAN 0
-#endif
-
 #if LLINT_TRACING
 #define OFFLINE_ASM_TRACING 1
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to