- Revision
- 196591
- Author
- [email protected]
- Date
- 2016-02-15 13:08:47 -0800 (Mon, 15 Feb 2016)
Log Message
[ARMv7] stress/op_rshift.js and stress/op_urshift.js are failing.
https://bugs.webkit.org/show_bug.cgi?id=151514
Reviewed by Filip Pizlo.
The issue turns out to be trivial: on ARMv7 (and traditional ARM too), arithmetic
shift right (ASR) and logical shift right (LSR) takes an immediate shift amount
from 1-32. See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Cjacbgca.html.
An immediate shift amount of 0 is interpreted as a shift of 32 bits.
Meanwhile, our macro assembler is expecting the immediate shift value to be
between 0-31. As a result, a shift amount of 0 is being wrongly encoded with 0
bits which means shift right by 32 bits.
The fix is to check if the shift amount is 0, and if so, emit a move. Else,
emit the right shift as usual.
This issue does not affect left shifts, as the immediate shift amount for left
shifts is between 0-31 as our macro assembler expects.
* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::rshift32):
(JSC::MacroAssemblerARM::urshift32):
(JSC::MacroAssemblerARM::sub32):
* assembler/MacroAssemblerARMv7.h:
(JSC::MacroAssemblerARMv7::rshift32):
(JSC::MacroAssemblerARMv7::urshift32):
* tests/stress/op_rshift.js:
* tests/stress/op_urshift.js:
- Un-skip these tests. They should always pass now.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (196590 => 196591)
--- trunk/Source/_javascript_Core/ChangeLog 2016-02-15 20:49:23 UTC (rev 196590)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-02-15 21:08:47 UTC (rev 196591)
@@ -1,3 +1,37 @@
+2016-02-15 Mark Lam <[email protected]>
+
+ [ARMv7] stress/op_rshift.js and stress/op_urshift.js are failing.
+ https://bugs.webkit.org/show_bug.cgi?id=151514
+
+ Reviewed by Filip Pizlo.
+
+ The issue turns out to be trivial: on ARMv7 (and traditional ARM too), arithmetic
+ shift right (ASR) and logical shift right (LSR) takes an immediate shift amount
+ from 1-32. See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Cjacbgca.html.
+ An immediate shift amount of 0 is interpreted as a shift of 32 bits.
+
+ Meanwhile, our macro assembler is expecting the immediate shift value to be
+ between 0-31. As a result, a shift amount of 0 is being wrongly encoded with 0
+ bits which means shift right by 32 bits.
+
+ The fix is to check if the shift amount is 0, and if so, emit a move. Else,
+ emit the right shift as usual.
+
+ This issue does not affect left shifts, as the immediate shift amount for left
+ shifts is between 0-31 as our macro assembler expects.
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::rshift32):
+ (JSC::MacroAssemblerARM::urshift32):
+ (JSC::MacroAssemblerARM::sub32):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::rshift32):
+ (JSC::MacroAssemblerARMv7::urshift32):
+
+ * tests/stress/op_rshift.js:
+ * tests/stress/op_urshift.js:
+ - Un-skip these tests. They should always pass now.
+
2016-02-15 Filip Pizlo <[email protected]>
Parser::parseVariableDeclarationList should null check the node before attempting to create a new CommaExpr
Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerARM.h (196590 => 196591)
--- trunk/Source/_javascript_Core/assembler/MacroAssemblerARM.h 2016-02-15 20:49:23 UTC (rev 196590)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerARM.h 2016-02-15 21:08:47 UTC (rev 196591)
@@ -274,7 +274,10 @@
void rshift32(RegisterID src, TrustedImm32 imm, RegisterID dest)
{
- m_assembler.movs(dest, m_assembler.asr(src, imm.m_value & 0x1f));
+ if (!imm.m_value)
+ move(src, dest);
+ else
+ m_assembler.movs(dest, m_assembler.asr(src, imm.m_value & 0x1f));
}
void urshift32(RegisterID shiftAmount, RegisterID dest)
@@ -297,7 +300,10 @@
void urshift32(RegisterID src, TrustedImm32 imm, RegisterID dest)
{
- m_assembler.movs(dest, m_assembler.lsr(src, imm.m_value & 0x1f));
+ if (!imm.m_value)
+ move(src, dest);
+ else
+ m_assembler.movs(dest, m_assembler.lsr(src, imm.m_value & 0x1f));
}
void sub32(RegisterID src, RegisterID dest)
Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.h (196590 => 196591)
--- trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.h 2016-02-15 20:49:23 UTC (rev 196590)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.h 2016-02-15 21:08:47 UTC (rev 196591)
@@ -400,7 +400,10 @@
void rshift32(RegisterID src, TrustedImm32 imm, RegisterID dest)
{
- m_assembler.asr(dest, src, imm.m_value & 0x1f);
+ if (!imm.m_value)
+ move(src, dest);
+ else
+ m_assembler.asr(dest, src, imm.m_value & 0x1f);
}
void rshift32(RegisterID shiftAmount, RegisterID dest)
@@ -425,7 +428,10 @@
void urshift32(RegisterID src, TrustedImm32 imm, RegisterID dest)
{
- m_assembler.lsr(dest, src, imm.m_value & 0x1f);
+ if (!imm.m_value)
+ move(src, dest);
+ else
+ m_assembler.lsr(dest, src, imm.m_value & 0x1f);
}
void urshift32(RegisterID shiftAmount, RegisterID dest)
Modified: trunk/Source/_javascript_Core/tests/stress/op_rshift.js (196590 => 196591)
--- trunk/Source/_javascript_Core/tests/stress/op_rshift.js 2016-02-15 20:49:23 UTC (rev 196590)
+++ trunk/Source/_javascript_Core/tests/stress/op_rshift.js 2016-02-15 21:08:47 UTC (rev 196591)
@@ -1,5 +1,4 @@
-//@ skip
-// FIXME: https://bugs.webkit.org/show_bug.cgi?id=151514
+//@ runFTLNoCJIT
// If all goes well, this test module will terminate silently. If not, it will print
// errors. See binary-op-test.js for debugging options if needed.
Modified: trunk/Source/_javascript_Core/tests/stress/op_urshift.js (196590 => 196591)
--- trunk/Source/_javascript_Core/tests/stress/op_urshift.js 2016-02-15 20:49:23 UTC (rev 196590)
+++ trunk/Source/_javascript_Core/tests/stress/op_urshift.js 2016-02-15 21:08:47 UTC (rev 196591)
@@ -1,5 +1,4 @@
-//@ skip
-// FIXME: https://bugs.webkit.org/show_bug.cgi?id=151514
+//@ runFTLNoCJIT
// If all goes well, this test module will terminate silently. If not, it will print
// errors. See binary-op-test.js for debugging options if needed.