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

Unified Diff: src/js/math.js

Issue 2029413005: [builtins] Migrate Math.log to TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 4 years, 6 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/js/math.js
diff --git a/src/js/math.js b/src/js/math.js
index 5d889674f6f827fdda72fe02adc1ff26ccaec309..e9a8daef40c7421207337a37fba7bd372d8618d7 100644
--- a/src/js/math.js
+++ b/src/js/math.js
@@ -43,11 +43,6 @@ function MathExp(x) {
return %MathExpRT(TO_NUMBER(x));
}
-// ECMA 262 - 15.8.2.10
-function MathLog(x) {
- return %_MathLogRT(TO_NUMBER(x));
-}
-
// ECMA 262 - 15.8.2.13
function MathPowJS(x, y) {
return %_MathPow(TO_NUMBER(x), TO_NUMBER(y));
@@ -93,9 +88,9 @@ function MathAsinh(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 + %math_sqrt(x * x + 1));
+ if (x > 0) return %math_log(x + %math_sqrt(x * x + 1));
// This is to prevent numerical errors caused by large negative x.
- return -MathLog(-x + %math_sqrt(x * x + 1));
+ return -%math_log(-x + %math_sqrt(x * x + 1));
}
// ES6 draft 09-27-13, section 20.2.2.3.
@@ -104,7 +99,7 @@ function MathAcosh(x) {
if (x < 1) return NaN;
// Idempotent for NaN and +Infinity.
if (!NUMBER_IS_FINITE(x)) return x;
- return MathLog(x + %math_sqrt(x + 1) * %math_sqrt(x - 1));
+ return %math_log(x + %math_sqrt(x + 1) * %math_sqrt(x - 1));
}
// ES6 draft 09-27-13, section 20.2.2.7.
@@ -114,7 +109,7 @@ function MathAtanh(x) {
if (x === 0) return x;
// Returns NaN for NaN and +/- Infinity.
if (!NUMBER_IS_FINITE(x)) return NaN;
- return 0.5 * MathLog((1 + x) / (1 - x));
+ return 0.5 * %math_log((1 + x) / (1 - x));
}
// ES6 draft 09-27-13, section 20.2.2.17.
@@ -199,7 +194,6 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
"random", MathRandom,
"abs", MathAbs,
"exp", MathExp,
- "log", MathLog,
"atan2", MathAtan2JS,
"pow", MathPowJS,
"sign", MathSign,

Powered by Google App Engine
This is Rietveld 408576698