Title: [242215] trunk/Source/_javascript_Core
Revision
242215
Author
mark....@apple.com
Date
2019-02-28 12:48:50 -0800 (Thu, 28 Feb 2019)

Log Message

cloop.rb shift mask should depend on the word size being shifted.
https://bugs.webkit.org/show_bug.cgi?id=195181
<rdar://problem/48484164>

Reviewed by Yusuke Suzuki.

Previously, we're always masking the shift amount with 0x1f.  This is only correct
for 32-bit words.  For 64-bit words, the mask should be 0x3f.  For pointer sized
shifts, the mask depends on sizeof(uintptr_t).

* offlineasm/cloop.rb:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (242214 => 242215)


--- trunk/Source/_javascript_Core/ChangeLog	2019-02-28 20:44:16 UTC (rev 242214)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-02-28 20:48:50 UTC (rev 242215)
@@ -1,3 +1,17 @@
+2019-02-28  Mark Lam  <mark....@apple.com>
+
+        cloop.rb shift mask should depend on the word size being shifted.
+        https://bugs.webkit.org/show_bug.cgi?id=195181
+        <rdar://problem/48484164>
+
+        Reviewed by Yusuke Suzuki.
+
+        Previously, we're always masking the shift amount with 0x1f.  This is only correct
+        for 32-bit words.  For 64-bit words, the mask should be 0x3f.  For pointer sized
+        shifts, the mask depends on sizeof(uintptr_t).
+
+        * offlineasm/cloop.rb:
+
 2019-02-28  Justin Fan  <justin_...@apple.com>
 
         [Web GPU] Enable Web GPU only on 64-bit

Modified: trunk/Source/_javascript_Core/offlineasm/cloop.rb (242214 => 242215)


--- trunk/Source/_javascript_Core/offlineasm/cloop.rb	2019-02-28 20:44:16 UTC (rev 242214)
+++ trunk/Source/_javascript_Core/offlineasm/cloop.rb	2019-02-28 20:48:50 UTC (rev 242215)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+# Copyright (C) 2012-2019 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -426,7 +426,12 @@
         truncationHeader = ""
         truncationFooter = ""
     end
-    $asm.putc "#{dst.clLValue(type)} = #{truncationHeader}#{operands[1].clValue(type)} #{operator} (#{operands[0].clValue(:int)} & 0x1f)#{truncationFooter};"
+    # FIXME: rename :int to :intptr to be match their expected names from C++. Ditto for :uint.
+    # https://bugs.webkit.org/show_bug.cgi?id=195183
+    shiftMask = "((sizeof(uintptr_t) == 8) ? 0x3f : 0x1f)" if type == :int || type == :uint
+    shiftMask = "0x3f" if type == :int64 || type == :uint64
+    shiftMask = "0x1f" if type == :int32 || type == :uint32
+    $asm.putc "#{dst.clLValue(type)} = #{truncationHeader}#{operands[1].clValue(type)} #{operator} (#{operands[0].clValue(:int)} & #{shiftMask})#{truncationFooter};"
 end
 
 def cloopEmitUnaryOperation(operands, type, operator)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to