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

Unified Diff: src/js/math.js

Issue 2115493002: [builtins] Migrate Math.abs() to TurboFan builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment back in 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
« no previous file with comments | « src/contexts.h ('k') | src/js/v8natives.js » ('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 c8e8e4ea4735bebc8743bc433018d5fedb8637ac..3f48874e93b76ded669457c3471ae146a3ec40fe 100644
--- a/src/js/math.js
+++ b/src/js/math.js
@@ -13,22 +13,13 @@
// The first two slots are reserved to persist PRNG state.
define kRandomNumberStart = 2;
-var GlobalFloat64Array = global.Float64Array;
var GlobalMath = global.Math;
-var GlobalObject = global.Object;
var NaN = %GetRootNaN();
var nextRandomIndex = 0;
var randomNumbers = UNDEFINED;
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
//-------------------------------------------------------------------
-
-// ECMA 262 - 15.8.2.1
-function MathAbs(x) {
- x = +x;
- return (x > 0) ? x : 0 - x;
-}
-
// ECMA 262 - 15.8.2.14
function MathRandom() {
// While creating a startup snapshot, %GenerateRandomNumbers returns a
@@ -83,7 +74,7 @@ function MathHypot(x, y) { // Function length is 2.
var length = arguments.length;
var max = 0;
for (var i = 0; i < length; i++) {
- var n = MathAbs(arguments[i]);
+ var n = %math_abs(arguments[i]);
if (n > max) max = n;
arguments[i] = n;
}
@@ -119,7 +110,6 @@ utils.InstallConstants(GlobalMath, [
// set their names.
utils.InstallFunctions(GlobalMath, DONT_ENUM, [
"random", MathRandom,
- "abs", MathAbs,
"sign", MathSign,
"asinh", MathAsinh,
"acosh", MathAcosh,
@@ -133,7 +123,6 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
// Exports
utils.Export(function(to) {
- to.MathAbs = MathAbs;
to.MathRandom = MathRandom;
});
« no previous file with comments | « src/contexts.h ('k') | src/js/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698