Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Unified Diff: src/math.js

Issue 1126213002: Wrap runtime.js in a function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/macros.py ('k') | src/messages.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/math.js
diff --git a/src/math.js b/src/math.js
index 04c27b606f02f6fab65034b13677c1542c13769b..16083d791e8a9d4197f01f9cbccaddd9c7b08743 100644
--- a/src/math.js
+++ b/src/math.js
@@ -88,7 +88,7 @@ function MathMax(arg1, arg2) { // length == 2
var r = -INFINITY;
for (var i = 0; i < length; i++) {
var n = %_Arguments(i);
- if (!IS_NUMBER(n)) n = NonNumberToNumber(n);
+ n = TO_NUMBER_INLINE(n);
// Make sure +0 is considered greater than -0.
if (NUMBER_IS_NAN(n) || n > r || (r === 0 && n === 0 && %_IsMinusZero(r))) {
r = n;
@@ -115,7 +115,7 @@ function MathMin(arg1, arg2) { // length == 2
var r = INFINITY;
for (var i = 0; i < length; i++) {
var n = %_Arguments(i);
- if (!IS_NUMBER(n)) n = NonNumberToNumber(n);
+ n = TO_NUMBER_INLINE(n);
// Make sure -0 is considered less than +0.
if (NUMBER_IS_NAN(n) || n < r || (r === 0 && n === 0 && %_IsMinusZero(n))) {
r = n;
@@ -175,7 +175,7 @@ function MathTrunc(x) {
// ES6 draft 09-27-13, section 20.2.2.33.
function MathTanh(x) {
- if (!IS_NUMBER(x)) x = NonNumberToNumber(x);
+ x = TO_NUMBER_INLINE(x);
// Idempotent for +/-0.
if (x === 0) return x;
// Returns +/-1 for +/-Infinity.
@@ -187,7 +187,7 @@ function MathTanh(x) {
// ES6 draft 09-27-13, section 20.2.2.5.
function MathAsinh(x) {
- if (!IS_NUMBER(x)) x = NonNumberToNumber(x);
+ x = TO_NUMBER_INLINE(x);
// Idempotent for NaN, +/-0 and +/-Infinity.
if (x === 0 || !NUMBER_IS_FINITE(x)) return x;
if (x > 0) return MathLog(x + %_MathSqrt(x * x + 1));
@@ -197,7 +197,7 @@ function MathAsinh(x) {
// ES6 draft 09-27-13, section 20.2.2.3.
function MathAcosh(x) {
- if (!IS_NUMBER(x)) x = NonNumberToNumber(x);
+ x = TO_NUMBER_INLINE(x);
if (x < 1) return NAN;
// Idempotent for NaN and +Infinity.
if (!NUMBER_IS_FINITE(x)) return x;
@@ -206,7 +206,7 @@ function MathAcosh(x) {
// ES6 draft 09-27-13, section 20.2.2.7.
function MathAtanh(x) {
- if (!IS_NUMBER(x)) x = NonNumberToNumber(x);
+ x = TO_NUMBER_INLINE(x);
// Idempotent for +/-0.
if (x === 0) return x;
// Returns NaN for NaN and +/- Infinity.
@@ -224,7 +224,7 @@ function MathHypot(x, y) { // Function length is 2.
var max = 0;
for (var i = 0; i < length; i++) {
var n = %_Arguments(i);
- if (!IS_NUMBER(n)) n = NonNumberToNumber(n);
+ n = TO_NUMBER_INLINE(n);
if (n === INFINITY || n === -INFINITY) return INFINITY;
n = MathAbs(n);
if (n > max) max = n;
@@ -261,7 +261,7 @@ function MathClz32JS(x) {
// Using initial approximation adapted from Kahan's cbrt and 4 iterations
// of Newton's method.
function MathCbrt(x) {
- if (!IS_NUMBER(x)) x = NonNumberToNumber(x);
+ x = TO_NUMBER_INLINE(x);
if (x == 0 || !NUMBER_IS_FINITE(x)) return x;
return x >= 0 ? CubeRoot(x) : -CubeRoot(-x);
}
« no previous file with comments | « src/macros.py ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698