| Index: test/webkit/mod-crash.js
|
| diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/mod-crash.js
|
| similarity index 65%
|
| copy from test/webkit/concat-while-having-a-bad-time.js
|
| copy to test/webkit/mod-crash.js
|
| index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..2bc01a122c4aa758c5dc2bdf731f7e1b2926125b 100644
|
| --- a/test/webkit/concat-while-having-a-bad-time.js
|
| +++ b/test/webkit/mod-crash.js
|
| @@ -22,10 +22,41 @@
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| description(
|
| -"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating."
|
| +"This test checks that n % 0 doesn't crash with a floating-point exception."
|
| );
|
|
|
| -Object.defineProperty(Array.prototype, 0, { writable: false });
|
| -shouldBe("[42].concat()", "[42]");
|
| +shouldBe("2 % 0", "NaN");
|
|
|
| +var n = 2;
|
| +shouldBe("n % 0", "NaN");
|
|
|
| +function f()
|
| +{
|
| + return 2 % 0;
|
| +}
|
| +
|
| +shouldBe("f()", "NaN");
|
| +
|
| +function g()
|
| +{
|
| + var n = 2;
|
| + return n % 0;
|
| +}
|
| +
|
| +shouldBe("g()", "NaN");
|
| +
|
| +// Test that reusing a floating point value after use in a modulus works correctly.
|
| +function nonSpeculativeModReuseInner(argument, o1, o2)
|
| +{
|
| + // The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
|
| + o1 + o2;
|
| +
|
| + var knownDouble = argument - 0;
|
| + return knownDouble % 1 + knownDouble;
|
| +}
|
| +function nonSpeculativeModReuse(argument)
|
| +{
|
| + return nonSpeculativeModReuseInner(argument, {}, {});
|
| +}
|
| +
|
| +shouldBe("nonSpeculativeModReuse(0.5)", "1");
|
|
|