Bug 1022396 - Remove Number.toInteger. r=jorendorff
authorBenjamin Peterson <benjamin@python.org>
Mon, 09 Jun 2014 10:48:26 -0700
changeset 187779 fc1936b69cbff837ebb03741725d7de609993156
parent 187778 ecbee0ea949ea9450842af1b8a0fe9764d5e1705
child 187780 cd94a4d8be6fe28af1c84f4ef232303bf0c6c377
push id26934
push userryanvm@gmail.com
push dateTue, 10 Jun 2014 04:45:09 +0000
treeherdermozilla-central@9dc0ffca10f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1022396
milestone32.0a1
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
Bug 1022396 - Remove Number.toInteger. r=jorendorff
js/src/jit-test/tests/basic/number-tointeger.js
js/src/jsnum.cpp
deleted file mode 100644
--- a/js/src/jit-test/tests/basic/number-tointeger.js
+++ /dev/null
@@ -1,20 +0,0 @@
-assertEq(Number.toInteger(4), 4);
-assertEq(Number.toInteger(4.), 4);
-assertEq(Number.toInteger(4.3), 4);
-assertEq(Number.toInteger(-4), -4);
-assertEq(Number.toInteger(-4.), -4);
-assertEq(Number.toInteger(-4.3), -4);
-assertEq(Number.toInteger(0.), 0.);
-assertEq(Number.toInteger(-0.), -0.);
-assertEq(Number.toInteger(Infinity), Infinity);
-assertEq(Number.toInteger(-Infinity), -Infinity);
-assertEq(Number.toInteger(NaN), 0);
-assertEq(Number.toInteger(null), 0);
-assertEq(Number.toInteger(undefined), 0);
-assertEq(Number.toInteger(true), 1);
-assertEq(Number.toInteger(false), 0);
-assertEq(Number.toInteger({valueOf : function () { return 4; }}), 4);
-assertEq(Number.toInteger({valueOf : function () { return 4.3; }}), 4);
-assertEq(Number.toInteger({valueOf : function () { return "4"; }}), 4);
-assertEq(Number.toInteger({valueOf : function () { return {};}}), 0);
-assertEq(Number.toInteger(), 0);
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -1055,41 +1055,24 @@ Number_isInteger(JSContext *cx, unsigned
     }
     Value val = args[0];
     args.rval().setBoolean(val.isInt32() ||
                            (mozilla::IsFinite(val.toDouble()) &&
                             ToInteger(val.toDouble()) == val.toDouble()));
     return true;
 }
 
-// ES6 drafult ES6 15.7.3.13
-static bool
-Number_toInteger(JSContext *cx, unsigned argc, Value *vp)
-{
-    CallArgs args = CallArgsFromVp(argc, vp);
-    if (args.length() < 1) {
-        args.rval().setInt32(0);
-        return true;
-    }
-    double asint;
-    if (!ToInteger(cx, args[0], &asint))
-        return false;
-    args.rval().setNumber(asint);
-    return true;
-}
-
 
 static const JSFunctionSpec number_static_methods[] = {
     JS_SELF_HOSTED_FN("isFinite", "Number_isFinite", 1,0),
     JS_FN("isInteger", Number_isInteger, 1, 0),
     JS_SELF_HOSTED_FN("isNaN", "Number_isNaN", 1,0),
     JS_SELF_HOSTED_FN("isSafeInteger", "Number_isSafeInteger", 1,0),
     JS_FN("parseFloat", num_parseFloat, 1, 0),
     JS_FN("parseInt", num_parseInt, 2, 0),
-    JS_FN("toInteger", Number_toInteger, 1, 0),
     JS_FS_END
 };
 
 
 /* NB: Keep this in synch with number_constants[]. */
 enum nc_slot {
     NC_NaN,
     NC_POSITIVE_INFINITY,