Index: src/math.js |
diff --git a/src/math.js b/src/math.js |
index f2eaa14bf9bd547817497651e859f045b57276cc..b802de0f461130cf01cb71e864e9ae69e0af1829 100644 |
--- a/src/math.js |
+++ b/src/math.js |
@@ -30,24 +30,26 @@ function MathAbs(x) { |
// ECMA 262 - 15.8.2.2 |
function MathAcosJS(x) { |
- return %MathAcos(TO_NUMBER_INLINE(x)); |
+ return %_MathAcos(+x); |
} |
// ECMA 262 - 15.8.2.3 |
function MathAsinJS(x) { |
- return %MathAsin(TO_NUMBER_INLINE(x)); |
+ return %_MathAsin(+x); |
} |
// ECMA 262 - 15.8.2.4 |
function MathAtanJS(x) { |
- return %MathAtan(TO_NUMBER_INLINE(x)); |
+ return %_MathAtan(+x); |
} |
// ECMA 262 - 15.8.2.5 |
// The naming of y and x matches the spec, as does the order in which |
// ToNumber (valueOf) is called. |
function MathAtan2JS(y, x) { |
- return %MathAtan2(TO_NUMBER_INLINE(y), TO_NUMBER_INLINE(x)); |
+ y = +y; |
+ x = +x; |
+ return %_MathAtan2(y, x); |
} |
// ECMA 262 - 15.8.2.6 |
@@ -157,7 +159,7 @@ function MathImul(x, y) { |
// ES6 draft 09-27-13, section 20.2.2.28. |
function MathSign(x) { |
- x = TO_NUMBER_INLINE(x); |
+ x = +x; |
if (x > 0) return 1; |
if (x < 0) return -1; |
// -0, 0 or NaN. |
@@ -166,9 +168,9 @@ function MathSign(x) { |
// ES6 draft 09-27-13, section 20.2.2.34. |
function MathTrunc(x) { |
- x = TO_NUMBER_INLINE(x); |
- if (x > 0) return MathFloorJS(x); |
- if (x < 0) return MathCeil(x); |
+ x = +x; |
+ if (x > 0) return %_MathFloor(x); |
+ if (x < 0) return -%_MathFloor(-x); |
// -0, 0 or NaN. |
return x; |
} |
@@ -341,11 +343,17 @@ InstallFunctions(Math, DONT_ENUM, GlobalArray( |
)); |
%SetInlineBuiltinFlag(MathAbs); |
+%SetInlineBuiltinFlag(MathAcosJS); |
+%SetInlineBuiltinFlag(MathAsinJS); |
+%SetInlineBuiltinFlag(MathAtanJS); |
+%SetInlineBuiltinFlag(MathAtan2JS); |
%SetInlineBuiltinFlag(MathCeil); |
%SetInlineBuiltinFlag(MathClz32JS); |
%SetInlineBuiltinFlag(MathFloorJS); |
%SetInlineBuiltinFlag(MathRandom); |
+%SetInlineBuiltinFlag(MathSign); |
%SetInlineBuiltinFlag(MathSqrtJS); |
+%SetInlineBuiltinFlag(MathTrunc); |
// Expose to the global scope. |
$abs = MathAbs; |