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

Unified Diff: src/js/string.js

Issue 2339123002: [builtins] Move StringLastIndexOf to a builtin. (Closed)
Patch Set: Variable renaming to make things a bit clearer Created 4 years, 3 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/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/string.js
diff --git a/src/js/string.js b/src/js/string.js
index da1643b06c9c2fb787acbb99d76261ef72431706..b8ab5d4ac52624f9e8af4af2ac59a890c24d1c93 100644
--- a/src/js/string.js
+++ b/src/js/string.js
@@ -59,34 +59,6 @@ function StringIndexOf(pattern, position) { // length == 1
%FunctionSetLength(StringIndexOf, 1);
-// ECMA-262 section 15.5.4.8
-function StringLastIndexOf(pat, pos) { // length == 1
- CHECK_OBJECT_COERCIBLE(this, "String.prototype.lastIndexOf");
-
- var sub = TO_STRING(this);
- var subLength = sub.length;
- var pat = TO_STRING(pat);
- var patLength = pat.length;
- var index = subLength - patLength;
- var position = TO_NUMBER(pos);
- if (!NUMBER_IS_NAN(position)) {
- position = TO_INTEGER(position);
- if (position < 0) {
- position = 0;
- }
- if (position + patLength < subLength) {
- index = position;
- }
- }
- if (index < 0) {
- return -1;
- }
- return %StringLastIndexOf(sub, pat, index);
-}
-
-%FunctionSetLength(StringLastIndexOf, 1);
-
-
// ES6 21.1.3.11.
function StringMatchJS(pattern) {
CHECK_OBJECT_COERCIBLE(this, "String.prototype.match");
@@ -702,7 +674,6 @@ utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [
"endsWith", StringEndsWith,
"includes", StringIncludes,
"indexOf", StringIndexOf,
- "lastIndexOf", StringLastIndexOf,
"match", StringMatchJS,
"repeat", StringRepeat,
"replace", StringReplace,
@@ -738,7 +709,6 @@ utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [
utils.Export(function(to) {
to.ExpandReplacement = ExpandReplacement;
to.StringIndexOf = StringIndexOf;
- to.StringLastIndexOf = StringLastIndexOf;
to.StringMatch = StringMatchJS;
to.StringReplace = StringReplace;
to.StringSlice = StringSlice;
« no previous file with comments | « src/js/i18n.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698