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

Unified Diff: src/js/v8natives.js

Issue 2424403002: [builtins] Migrate Number.parseInt to TurboFan builtin. (Closed)
Patch Set: Created 4 years, 2 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/builtins/builtins-number.cc ('k') | src/runtime/runtime-numbers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/v8natives.js
diff --git a/src/js/v8natives.js b/src/js/v8natives.js
index 9098e82bf2424b6733748f8956bfaff8a0709313..f67a8b5bf41307f4936fa3ee28500999bf35c8b7 100644
--- a/src/js/v8natives.js
+++ b/src/js/v8natives.js
@@ -18,42 +18,6 @@ var ObjectToString = utils.ImportNow("object_to_string");
// ----------------------------------------------------------------------------
-// ES6 18.2.5 parseInt(string, radix)
-function GlobalParseInt(string, radix) {
- if (IS_UNDEFINED(radix) || radix === 10 || radix === 0) {
- // Some people use parseInt instead of Math.floor. This
- // optimization makes parseInt on a Smi 12 times faster (60ns
- // vs 800ns). The following optimization makes parseInt on a
- // non-Smi number 9 times faster (230ns vs 2070ns). Together
- // they make parseInt on a string 1.4% slower (274ns vs 270ns).
- if (%_IsSmi(string)) return string;
- if (IS_NUMBER(string) &&
- ((0.01 < string && string < 1e9) ||
- (-1e9 < string && string < -0.01))) {
- // Truncate number.
- return string | 0;
- }
- string = TO_STRING(string);
- radix = radix | 0;
- } else {
- // The spec says ToString should be evaluated before ToInt32.
- string = TO_STRING(string);
- radix = TO_INT32(radix);
- if (!(radix == 0 || (2 <= radix && radix <= 36))) {
- return NaN;
- }
- }
-
- if (%_HasCachedArrayIndex(string) &&
- (radix == 0 || radix == 10)) {
- return %_GetCachedArrayIndex(string);
- }
- return %StringParseInt(string, radix);
-}
-
-
-// ----------------------------------------------------------------------------
-
// Set up global object.
var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY;
@@ -66,11 +30,6 @@ utils.InstallConstants(global, [
"undefined", UNDEFINED,
]);
-// Set up non-enumerable function on the global object.
-utils.InstallFunctions(global, DONT_ENUM, [
- "parseInt", GlobalParseInt,
-]);
-
// ----------------------------------------------------------------------------
// Object
@@ -159,12 +118,6 @@ utils.InstallConstants(GlobalNumber, [
"EPSILON", 2.220446049250313e-16,
]);
-// Harmony Number constructor additions
-utils.InstallFunctions(GlobalNumber, DONT_ENUM, [
- "parseInt", GlobalParseInt,
-]);
-
-
// ----------------------------------------------------------------------------
// Iterator related spec functions.
« no previous file with comments | « src/builtins/builtins-number.cc ('k') | src/runtime/runtime-numbers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698