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

Unified Diff: src/js/string.js

Issue 2870013004: [builtins] String.prototype.slice as a CSA builtin. (Closed)
Patch Set: REBASE. Created 3 years, 7 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/debug/debug-evaluate.cc ('k') | no next file » | 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 c1637d10f052e7c71f889068121bf465475b4b7e..a3a59d5fde701dfe23d2e7a7da0585b9e9ada6ca 100644
--- a/src/js/string.js
+++ b/src/js/string.js
@@ -52,48 +52,6 @@ function StringSearch(pattern) {
}
-// ECMA-262 section 15.5.4.13
-function StringSlice(start, end) {
- CHECK_OBJECT_COERCIBLE(this, "String.prototype.slice");
-
- var s = TO_STRING(this);
- var s_len = s.length;
- var start_i = TO_INTEGER(start);
- var end_i = s_len;
- if (!IS_UNDEFINED(end)) {
- end_i = TO_INTEGER(end);
- }
-
- if (start_i < 0) {
- start_i += s_len;
- if (start_i < 0) {
- start_i = 0;
- }
- } else {
- if (start_i > s_len) {
- return '';
- }
- }
-
- if (end_i < 0) {
- end_i += s_len;
- if (end_i < 0) {
- return '';
- }
- } else {
- if (end_i > s_len) {
- end_i = s_len;
- }
- }
-
- if (end_i <= start_i) {
- return '';
- }
-
- return %_SubString(s, start_i, end_i);
-}
-
-
// ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1
function HtmlEscape(str) {
return %RegExpInternalReplace(/"/g, TO_STRING(str), "&quot;");
@@ -334,8 +292,6 @@ utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [
"padStart", StringPadStart,
"repeat", StringRepeat,
"search", StringSearch,
- "slice", StringSlice,
-
"link", StringLink,
"anchor", StringAnchor,
"fontcolor", StringFontcolor,
« no previous file with comments | « src/debug/debug-evaluate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698