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

Unified Diff: src/math.js

Issue 1027713002: [turbofan] More inlinable Math builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/compiler/typer.cc ('k') | no next file » | 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 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;
« no previous file with comments | « src/compiler/typer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698