Commit 22a73e0d authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: Temporary workaround for X87 FPU convert SNaN to QNaN automatically issue.

  x87 FPU converts the SNaN to QNaN automatically when loading SNaN from memmory. This function caused v8 x87 port can't distinguish the
  Hole NaN (V8 used SNaN for it) from Javascript visible NaNs (V8 used QNaN for it).

  Many test cases failed in this function for v8 x87 port. It's a big effort to refactor all code of x87 FPU loads value from memmory to
  fix this issue.

  So here's a temporary workaround for it, what's this CL does are:
  1. Removed all previous x87 workaround of this issue.
  2. Used SNaN of MIPS which is a not used QNaN in v8 x87 port as the Hole NaN for v8 x87 port.
  3. This CL is only local to x87 port.

BUG=

Review-Url: https://codereview.chromium.org/2033133004
Cr-Commit-Position: refs/heads/master@{#36697}
parent ae521505
......@@ -2362,9 +2362,7 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
__ add(esp, Immediate(kDoubleSize));
int offset = sizeof(kHoleNanUpper32);
// x87 converts sNaN(0xfff7fffffff7ffff) to QNaN(0xfffffffffff7ffff),
// so we check the upper with 0xffffffff for hole as a temporary fix.
__ cmp(MemOperand(esp, -offset), Immediate(0xffffffff));
__ cmp(MemOperand(esp, -offset), Immediate(kHoleNanUpper32));
EmitBranch(instr, equal);
}
......@@ -4105,9 +4103,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
__ fst_d(MemOperand(esp, 0));
__ lea(esp, Operand(esp, kDoubleSize));
int offset = sizeof(kHoleNanUpper32);
// x87 converts sNaN(0xfff7fffffff7ffff) to QNaN(0xfffffffffff7ffff),
// so we check the upper with 0xffffffff for hole as a temporary fix.
__ cmp(MemOperand(esp, -offset), Immediate(0xffffffff));
__ cmp(MemOperand(esp, -offset), Immediate(kHoleNanUpper32));
__ j(not_equal, &no_special_nan_handling, Label::kNear);
__ mov(operand, Immediate(lower));
__ mov(operand2, Immediate(upper));
......@@ -4193,9 +4189,7 @@ void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
__ fst_d(MemOperand(esp, 0));
__ lea(esp, Operand(esp, kDoubleSize));
int offset = sizeof(kHoleNanUpper32);
// x87 converts sNaN(0xfff7fffffff7ffff) to QNaN(0xfffffffffff7ffff),
// so we check the upper with 0xffffffff for hole as a temporary fix.
__ cmp(MemOperand(esp, -offset), Immediate(0xffffffff));
__ cmp(MemOperand(esp, -offset), Immediate(kHoleNanUpper32));
__ j(not_equal, &no_special_nan_handling, Label::kNear);
__ mov(double_store_operand, Immediate(lower));
__ mov(double_store_operand2, Immediate(upper));
......
......@@ -812,8 +812,14 @@ enum ScopeType {
};
// The mips architecture prior to revision 5 has inverted encoding for sNaN.
#if (V8_TARGET_ARCH_MIPS && !defined(_MIPS_ARCH_MIPS32R6)) || \
(V8_TARGET_ARCH_MIPS64 && !defined(_MIPS_ARCH_MIPS64R6))
// The x87 FPU convert the sNaN to qNaN automatically when loading sNaN from
// memmory.
// Use mips sNaN which is a not used qNaN in x87 port as sNaN to workaround this
// issue
// for some test cases.
#if (V8_TARGET_ARCH_MIPS && !defined(_MIPS_ARCH_MIPS32R6)) || \
(V8_TARGET_ARCH_MIPS64 && !defined(_MIPS_ARCH_MIPS64R6)) || \
(V8_TARGET_ARCH_X87)
const uint32_t kHoleNanUpper32 = 0xFFFF7FFF;
const uint32_t kHoleNanLower32 = 0xFFFF7FFF;
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment