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

Unified Diff: src/math.js

Issue 1384443002: [es6] Fix missing bits for full @@toPrimitive support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove useless cctest. Created 5 years, 3 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
Index: src/math.js
diff --git a/src/math.js b/src/math.js
index 05eb9e46d7ed581a9659edd94f598b41f78441e7..2c0c30ef54c088033a50b90fdde63666d9eb9c55 100644
--- a/src/math.js
+++ b/src/math.js
@@ -56,7 +56,7 @@ function MathCeil(x) {
// ECMA 262 - 15.8.2.8
function MathExp(x) {
- return %MathExpRT(TO_NUMBER_INLINE(x));
+ return %MathExpRT(TO_NUMBER(x));
}
// ECMA 262 - 15.8.2.9
@@ -66,15 +66,15 @@ function MathFloorJS(x) {
// ECMA 262 - 15.8.2.10
function MathLog(x) {
- return %_MathLogRT(TO_NUMBER_INLINE(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_INLINE(arg1);
- arg2 = TO_NUMBER_INLINE(arg2);
+ arg1 = TO_NUMBER(arg1);
+ arg2 = TO_NUMBER(arg2);
if (arg2 > arg1) return arg2;
if (arg1 > arg2) return arg1;
if (arg1 == arg2) {
@@ -87,7 +87,7 @@ function MathMax(arg1, arg2) { // length == 2
var r = -INFINITY;
for (var i = 0; i < length; i++) {
var n = %_Arguments(i);
- n = TO_NUMBER_INLINE(n);
+ 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;
@@ -100,8 +100,8 @@ function MathMax(arg1, arg2) { // length == 2
function MathMin(arg1, arg2) { // length == 2
var length = %_ArgumentsLength();
if (length == 2) {
- arg1 = TO_NUMBER_INLINE(arg1);
- arg2 = TO_NUMBER_INLINE(arg2);
+ arg1 = TO_NUMBER(arg1);
+ arg2 = TO_NUMBER(arg2);
if (arg2 > arg1) return arg1;
if (arg1 > arg2) return arg2;
if (arg1 == arg2) {
@@ -114,7 +114,7 @@ function MathMin(arg1, arg2) { // length == 2
var r = INFINITY;
for (var i = 0; i < length; i++) {
var n = %_Arguments(i);
- n = TO_NUMBER_INLINE(n);
+ 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;
@@ -125,7 +125,7 @@ function MathMin(arg1, arg2) { // length == 2
// ECMA 262 - 15.8.2.13
function MathPowJS(x, y) {
- return %_MathPow(TO_NUMBER_INLINE(x), TO_NUMBER_INLINE(y));
+ return %_MathPow(TO_NUMBER(x), TO_NUMBER(y));
}
// ECMA 262 - 15.8.2.14
@@ -150,7 +150,7 @@ function MathRandomRaw() {
// ECMA 262 - 15.8.2.15
function MathRound(x) {
- return %RoundNumber(TO_NUMBER_INLINE(x));
+ return %RoundNumber(TO_NUMBER(x));
}
// ECMA 262 - 15.8.2.17
@@ -160,7 +160,7 @@ function MathSqrtJS(x) {
// Non-standard extension.
function MathImul(x, y) {
- return %NumberImul(TO_NUMBER_INLINE(x), TO_NUMBER_INLINE(y));
+ return %NumberImul(TO_NUMBER(x), TO_NUMBER(y));
}
// ES6 draft 09-27-13, section 20.2.2.28.
@@ -183,7 +183,7 @@ function MathTrunc(x) {
// ES6 draft 09-27-13, section 20.2.2.33.
function MathTanh(x) {
- x = TO_NUMBER_INLINE(x);
+ x = TO_NUMBER(x);
// Idempotent for +/-0.
if (x === 0) return x;
// Returns +/-1 for +/-Infinity.
@@ -195,7 +195,7 @@ function MathTanh(x) {
// ES6 draft 09-27-13, section 20.2.2.5.
function MathAsinh(x) {
- x = TO_NUMBER_INLINE(x);
+ x = TO_NUMBER(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));
@@ -205,7 +205,7 @@ function MathAsinh(x) {
// ES6 draft 09-27-13, section 20.2.2.3.
function MathAcosh(x) {
- x = TO_NUMBER_INLINE(x);
+ x = TO_NUMBER(x);
if (x < 1) return NAN;
// Idempotent for NaN and +Infinity.
if (!NUMBER_IS_FINITE(x)) return x;
@@ -214,7 +214,7 @@ function MathAcosh(x) {
// ES6 draft 09-27-13, section 20.2.2.7.
function MathAtanh(x) {
- x = TO_NUMBER_INLINE(x);
+ x = TO_NUMBER(x);
// Idempotent for +/-0.
if (x === 0) return x;
// Returns NaN for NaN and +/- Infinity.
@@ -232,7 +232,7 @@ function MathHypot(x, y) { // Function length is 2.
var max = 0;
for (var i = 0; i < length; i++) {
var n = %_Arguments(i);
- n = TO_NUMBER_INLINE(n);
+ n = TO_NUMBER(n);
if (n === INFINITY || n === -INFINITY) return INFINITY;
n = MathAbs(n);
if (n > max) max = n;
@@ -256,7 +256,7 @@ function MathHypot(x, y) { // Function length is 2.
// ES6 draft 09-27-13, section 20.2.2.16.
function MathFroundJS(x) {
- return %MathFround(TO_NUMBER_INLINE(x));
+ return %MathFround(TO_NUMBER(x));
}
// ES6 draft 07-18-14, section 20.2.2.11
@@ -269,7 +269,7 @@ function MathClz32JS(x) {
// Using initial approximation adapted from Kahan's cbrt and 4 iterations
// of Newton's method.
function MathCbrt(x) {
- x = TO_NUMBER_INLINE(x);
+ x = TO_NUMBER(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/prologue.js » ('j') | test/cctest/compiler/test-run-jscalls.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698