Commit a8455f04 authored by whesse@chromium.org's avatar whesse@chromium.org

Do not return the constant singleton float -0.0 from UnaryOpStub, because it...

Do not return the constant singleton float -0.0 from UnaryOpStub, because it may be overwritten, on X64 platform.
Review URL: http://codereview.chromium.org/3748007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5631 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 01d7470b
...@@ -1413,20 +1413,8 @@ void GenericUnaryOpStub::Generate(MacroAssembler* masm) { ...@@ -1413,20 +1413,8 @@ void GenericUnaryOpStub::Generate(MacroAssembler* masm) {
__ j(equal, &done); __ j(equal, &done);
} }
__ SmiNeg(rax, rax, &done); __ SmiNeg(rax, rax, &done);
__ jmp(&slow); // zero, if not handled above, and Smi::kMinValue.
// Either zero or Smi::kMinValue, neither of which become a smi when
// negated. We handle negative zero here if required. We always enter
// the runtime system if we have Smi::kMinValue.
if (negative_zero_ == kStrictNegativeZero) {
__ SmiCompare(rax, Smi::FromInt(0));
__ j(not_equal, &slow);
__ Move(rax, Factory::minus_zero_value());
__ jmp(&done);
} else {
__ SmiCompare(rax, Smi::FromInt(Smi::kMinValue));
__ j(equal, &slow);
__ jmp(&done);
}
// Try floating point case. // Try floating point case.
__ bind(&try_float); __ bind(&try_float);
} else if (FLAG_debug_code) { } else if (FLAG_debug_code) {
......
...@@ -98,3 +98,16 @@ assertEquals(-Infinity, one / (-4 % 2), "fiskhest1"); ...@@ -98,3 +98,16 @@ assertEquals(-Infinity, one / (-4 % 2), "fiskhest1");
assertEquals(-Infinity, one / (-4 % -2), "fiskhest2"); assertEquals(-Infinity, one / (-4 % -2), "fiskhest2");
assertEquals(Infinity, one / (4 % 2), "fiskhest3"); assertEquals(Infinity, one / (4 % 2), "fiskhest3");
assertEquals(Infinity, one / (4 % -2), "fiskhest4"); assertEquals(Infinity, one / (4 % -2), "fiskhest4");
// This tests against a singleton -0.0 object being overwritten.gc
x = 0;
z = 3044;
function foo(x) {
var y = -x + z;
return -x;
}
assertEquals(0, foo(x));
assertEquals(0, foo(x));
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