summaryrefslogtreecommitdiff
path: root/deps/v8/src/js/math.js
diff options
context:
space:
mode:
authorAli Ijaz Sheikh <ofrobots@google.com>2016-04-07 14:06:55 -0700
committerAli Ijaz Sheikh <ofrobots@google.com>2016-04-14 10:03:39 -0700
commit52af5c4eebf4de8638aef0338bd826656312a02a (patch)
tree628dc9fb0b558c3a73a2160706fef368876fe548 /deps/v8/src/js/math.js
parent6e3e8acc7cc7ebd3d67db5ade1247b8b558efe09 (diff)
downloadnode-new-52af5c4eebf4de8638aef0338bd826656312a02a.tar.gz
deps: upgrade V8 to 5.0.71.32
* Pick up the branch head for V8 5.0 stable [1] * Edit v8 gitignore to allow trace_event copy * Update V8 DEP trace_event as per deps/v8/DEPS [2] [1] https://chromium.googlesource.com/v8/v8.git/+/3c67831 [2] https://chromium.googlesource.com/chromium/src/base/trace_event/common/+/4b09207e447ae5bd34643b4c6321bee7b76d35f9 Ref: https://github.com/nodejs/node/pull/5945 PR-URL: https://github.com/nodejs/node/pull/6111 Reviewed-By: targos - Michaƫl Zasso <mic.besace@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
Diffstat (limited to 'deps/v8/src/js/math.js')
-rw-r--r--deps/v8/src/js/math.js71
1 files changed, 5 insertions, 66 deletions
diff --git a/deps/v8/src/js/math.js b/deps/v8/src/js/math.js
index 990a7e993c..a698fd4285 100644
--- a/deps/v8/src/js/math.js
+++ b/deps/v8/src/js/math.js
@@ -75,60 +75,6 @@ function MathLog(x) {
return %_MathLogRT(TO_NUMBER(x));
}
-// ECMA 262 - 15.8.2.11
-function MathMax(arg1, arg2) { // length == 2
- var length = %_ArgumentsLength();
- if (length == 2) {
- arg1 = TO_NUMBER(arg1);
- arg2 = TO_NUMBER(arg2);
- if (arg2 > arg1) return arg2;
- if (arg1 > arg2) return arg1;
- if (arg1 == arg2) {
- // Make sure -0 is considered less than +0.
- return (arg1 === 0 && %_IsMinusZero(arg1)) ? arg2 : arg1;
- }
- // All comparisons failed, one of the arguments must be NaN.
- return NaN;
- }
- var r = -INFINITY;
- for (var i = 0; i < length; i++) {
- var n = %_Arguments(i);
- n = TO_NUMBER(n);
- // Make sure +0 is considered greater than -0.
- if (NUMBER_IS_NAN(n) || n > r || (r === 0 && n === 0 && %_IsMinusZero(r))) {
- r = n;
- }
- }
- return r;
-}
-
-// ECMA 262 - 15.8.2.12
-function MathMin(arg1, arg2) { // length == 2
- var length = %_ArgumentsLength();
- if (length == 2) {
- arg1 = TO_NUMBER(arg1);
- arg2 = TO_NUMBER(arg2);
- if (arg2 > arg1) return arg1;
- if (arg1 > arg2) return arg2;
- if (arg1 == arg2) {
- // Make sure -0 is considered less than +0.
- return (arg1 === 0 && %_IsMinusZero(arg1)) ? arg1 : arg2;
- }
- // All comparisons failed, one of the arguments must be NaN.
- return NaN;
- }
- var r = INFINITY;
- for (var i = 0; i < length; i++) {
- var n = %_Arguments(i);
- n = TO_NUMBER(n);
- // Make sure -0 is considered less than +0.
- if (NUMBER_IS_NAN(n) || n < r || (r === 0 && n === 0 && %_IsMinusZero(n))) {
- r = n;
- }
- }
- return r;
-}
-
// ECMA 262 - 15.8.2.13
function MathPowJS(x, y) {
return %_MathPow(TO_NUMBER(x), TO_NUMBER(y));
@@ -218,17 +164,14 @@ function MathHypot(x, y) { // Function length is 2.
// We may want to introduce fast paths for two arguments and when
// normalization to avoid overflow is not necessary. For now, we
// simply assume the general case.
- var length = %_ArgumentsLength();
- var args = new InternalArray(length);
+ var length = arguments.length;
var max = 0;
for (var i = 0; i < length; i++) {
- var n = %_Arguments(i);
- n = TO_NUMBER(n);
- if (n === INFINITY || n === -INFINITY) return INFINITY;
- n = MathAbs(n);
+ var n = MathAbs(arguments[i]);
if (n > max) max = n;
- args[i] = n;
+ arguments[i] = n;
}
+ if (max === INFINITY) return INFINITY;
// Kahan summation to avoid rounding errors.
// Normalize the numbers to the largest one to avoid overflow.
@@ -236,7 +179,7 @@ function MathHypot(x, y) { // Function length is 2.
var sum = 0;
var compensation = 0;
for (var i = 0; i < length; i++) {
- var n = args[i] / max;
+ var n = arguments[i] / max;
var summand = n * n - compensation;
var preliminary = sum + summand;
compensation = (preliminary - sum) - summand;
@@ -314,8 +257,6 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
"sqrt", MathSqrtJS,
"atan2", MathAtan2JS,
"pow", MathPowJS,
- "max", MathMax,
- "min", MathMin,
"imul", MathImul,
"sign", MathSign,
"trunc", MathTrunc,
@@ -349,8 +290,6 @@ utils.Export(function(to) {
to.MathExp = MathExp;
to.MathFloor = MathFloorJS;
to.IntRandom = MathRandomRaw;
- to.MathMax = MathMax;
- to.MathMin = MathMin;
});
})