Backed out changeset 774d6d582f40 (bug 897027) for assertions
authorEd Morley <emorley@mozilla.com>
Thu, 10 Oct 2013 17:12:21 +0100
changeset 164189 45f35cc52ceb121156b358421570cdbebc2b3ddd
parent 164188 3046b6eb790ce1f4216bbe5c5f2a9ab90d11c29b
child 164190 14fd6fa23a16ee0a90e44fd58d7bb6799b28db18
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs897027
milestone27.0a1
backs out774d6d582f4060aebda8611d99f54ced97f02e2c
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 774d6d582f40 (bug 897027) for assertions
js/src/jsmath.cpp
js/src/tests/ecma_6/Math/20.2.2.ToNumber.js
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -288,17 +288,17 @@ js::ecmaAtan2(double y, double x)
     return atan2(y, x);
 }
 
 bool
 js::math_atan2(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
-    if (args.length() == 0) {
+    if (args.length() <= 1) {
         args.rval().setNaN();
         return true;
     }
 
     double x, y;
     if (!ToNumber(cx, args[0], &x) || !ToNumber(cx, args[1], &y))
         return false;
 
@@ -633,17 +633,17 @@ js::ecmaPow(double x, double y)
 #if defined(_MSC_VER)
 # pragma optimize("g", off)
 #endif
 bool
 js_math_pow(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
-    if (args.length() == 0) {
+    if (args.length() <= 1) {
         args.rval().setNaN();
         return true;
     }
 
     double x, y;
     if (!ToNumber(cx, args[0], &x) || !ToNumber(cx, args[1], &y))
         return false;
 
deleted file mode 100644
--- a/js/src/tests/ecma_6/Math/20.2.2.ToNumber.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/licenses/publicdomain/
- */
-
-/*
- *   20.2.2 Function Properties of the Math Object
- *
- *   Each of the following Math object functions applies the ToNumber abstract operation
- *   to each of its arguments (in left-to-right order if there is more than one).
- *   If ToNumber returns an abrupt completion, that completion record is immediately returned.
- *   Otherwise, the function performs a computation on the resulting Number value(s).
- */
-
-/*
- * This custom object will allow us to check if valueOf() is called
- */
-
-TestNumber.prototype = new Number();
-
-function TestNumber(value) {
-    this.value = value;
-    this.valueOfCalled = false;
-}
-
-TestNumber.prototype = {
-    valueOf: function() {
-        this.valueOfCalled = true;
-        return this.value;
-    }
-}
-
-// Verify that each TestNumber's flag is set after calling Math func
-function test(func /*, args */) {
-    var args = Array.prototype.slice.call(arguments, 1);
-    func.apply(null, args);
-
-    for (var i = 0; i < args.length; ++i)
-        assertEq(args[i].valueOfCalled, true);
-}
-
-// Note that we are not testing these functions' return values
-// We only test whether valueOf() is called for each argument
-
-// 1. Test Math.atan2()
-var y = new TestNumber(1);
-test(Math.atan2, y);
-
-var x = new TestNumber(1);
-var y = new TestNumber(2);
-test(Math.atan2, y, x);
-
-// Remove comment block once patch for bug 896264 is approved
-/*
-// 2. Test Math.hypot()
-var x = new TestNumber(1);
-test(Math.hypot, x);
-
-var x = new TestNumber(1);
-var y = new TestNumber(2);
-test(Math.hypot, x, y);
-
-var x = new TestNumber(1);
-var y = new TestNumber(2);
-var z = new TestNumber(3);
-test(Math.hypot, x, y, z);
-*/
-
-// Remove comment block once patch for bug 808148 is approved
-/*
-// 3. Test Math.imul()
-var x = new TestNumber(1);
-test(Math.imul, x);
-
-var x = new TestNumber(1);
-var y = new TestNumber(2);
-test(Math.imul, x, y);
-*/
-
-// 4. Test Math.max()
-var x = new TestNumber(1);
-test(Math.max, x);
-
-var x = new TestNumber(1);
-var y = new TestNumber(2);
-test(Math.max, x, y);
-
-var x = new TestNumber(1);
-var y = new TestNumber(2);
-var z = new TestNumber(3);
-test(Math.max, x, y, z);
-
-// 5. Test Math.min()
-var x = new TestNumber(1);
-test(Math.min, x);
-
-var x = new TestNumber(1);
-var y = new TestNumber(2);
-test(Math.min, x, y);
-
-var x = new TestNumber(1);
-var y = new TestNumber(2);
-var z = new TestNumber(3);
-test(Math.min, x, y, z);
-
-// 6. Test Math.pow()
-var x = new TestNumber(1);
-test(Math.pow, x);
-
-var x = new TestNumber(1);
-var y = new TestNumber(2);
-test(Math.pow, x, y);
-
-reportCompare(0, 0, "ok");