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

Unified Diff: src/js/math.js

Issue 1828253002: [builtins] Provide Math.floor as TurboFan builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Address feedback. Created 4 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/js/i18n.js ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/math.js
diff --git a/src/js/math.js b/src/js/math.js
index c17441db8064ec48c7f308a6e665060eb31acc90..99f5e009664e3da78884321de876ec2fea50bcc9 100644
--- a/src/js/math.js
+++ b/src/js/math.js
@@ -41,7 +41,7 @@ function MathAtan2JS(y, x) {
// ECMA 262 - 15.8.2.6
function MathCeil(x) {
- return -%_MathFloor(-x);
+ return -%math_floor(-x);
}
// ECMA 262 - 15.8.2.8
@@ -49,11 +49,6 @@ function MathExp(x) {
return %MathExpRT(TO_NUMBER(x));
}
-// ECMA 262 - 15.8.2.9
-function MathFloorJS(x) {
- return %_MathFloor(+x);
-}
-
// ECMA 262 - 15.8.2.10
function MathLog(x) {
return %_MathLogRT(TO_NUMBER(x));
@@ -103,8 +98,8 @@ function MathSign(x) {
// ES6 draft 09-27-13, section 20.2.2.34.
function MathTrunc(x) {
x = +x;
- if (x > 0) return %_MathFloor(x);
- if (x < 0) return -%_MathFloor(-x);
+ if (x > 0) return %math_floor(x);
+ if (x < 0) return -%math_floor(-x);
// -0, 0 or NaN.
return x;
}
@@ -187,7 +182,7 @@ macro NEWTON_ITERATION_CBRT(x, approx)
endmacro
function CubeRoot(x) {
- var approx_hi = MathFloorJS(%_DoubleHi(x) / 3) + 0x2A9F7893;
+ var approx_hi = %math_floor(%_DoubleHi(x) / 3) + 0x2A9F7893;
var approx = %_ConstructDouble(approx_hi | 0, 0);
approx = NEWTON_ITERATION_CBRT(x, approx);
approx = NEWTON_ITERATION_CBRT(x, approx);
@@ -226,7 +221,6 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
"abs", MathAbs,
"ceil", MathCeil,
"exp", MathExp,
- "floor", MathFloorJS,
"log", MathLog,
"round", MathRound,
"atan2", MathAtan2JS,
@@ -245,7 +239,6 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
%SetForceInlineFlag(MathAtan2JS);
%SetForceInlineFlag(MathCeil);
%SetForceInlineFlag(MathClz32JS);
-%SetForceInlineFlag(MathFloorJS);
%SetForceInlineFlag(MathRandom);
%SetForceInlineFlag(MathSign);
%SetForceInlineFlag(MathTrunc);
@@ -256,7 +249,6 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
utils.Export(function(to) {
to.MathAbs = MathAbs;
to.MathExp = MathExp;
- to.MathFloor = MathFloorJS;
to.IntRandom = MathRandomRaw;
});
« no previous file with comments | « src/js/i18n.js ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698