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

Side by Side Diff: src/string.js

Issue 1000063002: Hide RegExp and String initialization in a closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/snapshot-common.cc ('k') | src/string-iterator.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file relies on the fact that the following declaration has been made 5 var $stringCharAt;
6 // in runtime.js: 6 var $stringIndexOf;
7 // var $String = global.String; 7 var $stringSubstring;
8 8
9 // ------------------------------------------------------------------- 9 (function() {
10
11 %CheckIsBootstrapping();
12
13 var GlobalRegExp = global.RegExp;
14 var GlobalString = global.String;
15
16 //-------------------------------------------------------------------
10 17
11 function StringConstructor(x) { 18 function StringConstructor(x) {
12 if (%_ArgumentsLength() == 0) x = ''; 19 if (%_ArgumentsLength() == 0) x = '';
13 if (%_IsConstructCall()) { 20 if (%_IsConstructCall()) {
14 %_SetValueOf(this, TO_STRING_INLINE(x)); 21 %_SetValueOf(this, TO_STRING_INLINE(x));
15 } else { 22 } else {
16 return IS_SYMBOL(x) ? 23 return IS_SYMBOL(x) ?
17 %_CallFunction(x, SymbolToString) : TO_STRING_INLINE(x); 24 %_CallFunction(x, SymbolToString) : TO_STRING_INLINE(x);
18 } 25 }
19 } 26 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // ECMA-262 section 15.5.4.10 147 // ECMA-262 section 15.5.4.10
141 function StringMatchJS(regexp) { 148 function StringMatchJS(regexp) {
142 CHECK_OBJECT_COERCIBLE(this, "String.prototype.match"); 149 CHECK_OBJECT_COERCIBLE(this, "String.prototype.match");
143 150
144 var subject = TO_STRING_INLINE(this); 151 var subject = TO_STRING_INLINE(this);
145 if (IS_REGEXP(regexp)) { 152 if (IS_REGEXP(regexp)) {
146 // Emulate RegExp.prototype.exec's side effect in step 5, even though 153 // Emulate RegExp.prototype.exec's side effect in step 5, even though
147 // value is discarded. 154 // value is discarded.
148 var lastIndex = regexp.lastIndex; 155 var lastIndex = regexp.lastIndex;
149 TO_INTEGER_FOR_SIDE_EFFECT(lastIndex); 156 TO_INTEGER_FOR_SIDE_EFFECT(lastIndex);
150 if (!regexp.global) return RegExpExecNoTests(regexp, subject, 0); 157 if (!regexp.global) return $regexpExecNoTests(regexp, subject, 0);
151 // lastMatchInfo is defined in regexp.js. 158 var result = %StringMatch(subject, regexp, $regexpLastMatchInfo);
152 var result = %StringMatch(subject, regexp, lastMatchInfo); 159 if (result !== null) $regexpLastMatchInfoOverride = null;
153 if (result !== null) lastMatchInfoOverride = null;
154 regexp.lastIndex = 0; 160 regexp.lastIndex = 0;
155 return result; 161 return result;
156 } 162 }
157 // Non-regexp argument. 163 // Non-regexp argument.
158 regexp = new $RegExp(regexp); 164 regexp = new GlobalRegExp(regexp);
159 return RegExpExecNoTests(regexp, subject, 0); 165 return $regexpExecNoTests(regexp, subject, 0);
160 } 166 }
161 167
162 168
163 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD']; 169 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD'];
164 170
165 171
166 // ECMA-262 v6, section 21.1.3.12 172 // ECMA-262 v6, section 21.1.3.12
167 // 173 //
168 // For now we do nothing, as proper normalization requires big tables. 174 // For now we do nothing, as proper normalization requires big tables.
169 // If Intl is enabled, then i18n.js will override it and provide the the 175 // If Intl is enabled, then i18n.js will override it and provide the the
170 // proper functionality. 176 // proper functionality.
171 function StringNormalizeJS(form) { 177 function StringNormalizeJS(form) {
172 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); 178 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize");
173 179
174 var form = form ? TO_STRING_INLINE(form) : 'NFC'; 180 var form = form ? TO_STRING_INLINE(form) : 'NFC';
175 var normalizationForm = NORMALIZATION_FORMS.indexOf(form); 181 var normalizationForm = NORMALIZATION_FORMS.indexOf(form);
176 if (normalizationForm === -1) { 182 if (normalizationForm === -1) {
177 throw new $RangeError('The normalization form should be one of ' 183 throw new $RangeError('The normalization form should be one of '
178 + NORMALIZATION_FORMS.join(', ') + '.'); 184 + NORMALIZATION_FORMS.join(', ') + '.');
179 } 185 }
180 186
181 return %_ValueOf(this); 187 return %_ValueOf(this);
182 } 188 }
183 189
184 190
185 // This has the same size as the lastMatchInfo array, and can be used for 191 // This has the same size as the $regexpLastMatchInfo array, and can be used
186 // functions that expect that structure to be returned. It is used when the 192 // for functions that expect that structure to be returned. It is used when
187 // needle is a string rather than a regexp. In this case we can't update 193 // the needle is a string rather than a regexp. In this case we can't update
188 // lastMatchArray without erroneously affecting the properties on the global 194 // lastMatchArray without erroneously affecting the properties on the global
189 // RegExp object. 195 // RegExp object.
190 var reusableMatchInfo = [2, "", "", -1, -1]; 196 var reusableMatchInfo = [2, "", "", -1, -1];
191 197
192 198
193 // ECMA-262, section 15.5.4.11 199 // ECMA-262, section 15.5.4.11
194 function StringReplace(search, replace) { 200 function StringReplace(search, replace) {
195 CHECK_OBJECT_COERCIBLE(this, "String.prototype.replace"); 201 CHECK_OBJECT_COERCIBLE(this, "String.prototype.replace");
196 202
197 var subject = TO_STRING_INLINE(this); 203 var subject = TO_STRING_INLINE(this);
(...skipping 19 matching lines...) Expand all
217 // Emulate RegExp.prototype.exec's side effect in step 5, even if 223 // Emulate RegExp.prototype.exec's side effect in step 5, even if
218 // value is discarded. 224 // value is discarded.
219 var lastIndex = search.lastIndex; 225 var lastIndex = search.lastIndex;
220 TO_INTEGER_FOR_SIDE_EFFECT(lastIndex); 226 TO_INTEGER_FOR_SIDE_EFFECT(lastIndex);
221 227
222 if (!IS_SPEC_FUNCTION(replace)) { 228 if (!IS_SPEC_FUNCTION(replace)) {
223 replace = TO_STRING_INLINE(replace); 229 replace = TO_STRING_INLINE(replace);
224 230
225 if (!search.global) { 231 if (!search.global) {
226 // Non-global regexp search, string replace. 232 // Non-global regexp search, string replace.
227 var match = DoRegExpExec(search, subject, 0); 233 var match = $regexpExec(search, subject, 0);
228 if (match == null) { 234 if (match == null) {
229 search.lastIndex = 0 235 search.lastIndex = 0
230 return subject; 236 return subject;
231 } 237 }
232 if (replace.length == 0) { 238 if (replace.length == 0) {
233 return %_SubString(subject, 0, match[CAPTURE0]) + 239 return %_SubString(subject, 0, match[CAPTURE0]) +
234 %_SubString(subject, match[CAPTURE1], subject.length) 240 %_SubString(subject, match[CAPTURE1], subject.length)
235 } 241 }
236 return ExpandReplacement(replace, subject, lastMatchInfo, 242 return ExpandReplacement(replace, subject, $regexpLastMatchInfo,
237 %_SubString(subject, 0, match[CAPTURE0])) + 243 %_SubString(subject, 0, match[CAPTURE0])) +
238 %_SubString(subject, match[CAPTURE1], subject.length); 244 %_SubString(subject, match[CAPTURE1], subject.length);
239 } 245 }
240 246
241 // Global regexp search, string replace. 247 // Global regexp search, string replace.
242 search.lastIndex = 0; 248 search.lastIndex = 0;
243 if (lastMatchInfoOverride == null) { 249 if ($regexpLastMatchInfoOverride == null) {
244 return %StringReplaceGlobalRegExpWithString( 250 return %StringReplaceGlobalRegExpWithString(
245 subject, search, replace, lastMatchInfo); 251 subject, search, replace, $regexpLastMatchInfo);
246 } else { 252 } else {
247 // We use this hack to detect whether StringReplaceRegExpWithString 253 // We use this hack to detect whether StringReplaceRegExpWithString
248 // found at least one hit. In that case we need to remove any 254 // found at least one hit. In that case we need to remove any
249 // override. 255 // override.
250 var saved_subject = lastMatchInfo[LAST_SUBJECT_INDEX]; 256 var saved_subject = $regexpLastMatchInfo[LAST_SUBJECT_INDEX];
251 lastMatchInfo[LAST_SUBJECT_INDEX] = 0; 257 $regexpLastMatchInfo[LAST_SUBJECT_INDEX] = 0;
252 var answer = %StringReplaceGlobalRegExpWithString( 258 var answer = %StringReplaceGlobalRegExpWithString(
253 subject, search, replace, lastMatchInfo); 259 subject, search, replace, $regexpLastMatchInfo);
254 if (%_IsSmi(lastMatchInfo[LAST_SUBJECT_INDEX])) { 260 if (%_IsSmi($regexpLastMatchInfo[LAST_SUBJECT_INDEX])) {
255 lastMatchInfo[LAST_SUBJECT_INDEX] = saved_subject; 261 $regexpLastMatchInfo[LAST_SUBJECT_INDEX] = saved_subject;
256 } else { 262 } else {
257 lastMatchInfoOverride = null; 263 $regexpLastMatchInfoOverride = null;
258 } 264 }
259 return answer; 265 return answer;
260 } 266 }
261 } 267 }
262 268
263 if (search.global) { 269 if (search.global) {
264 // Global regexp search, function replace. 270 // Global regexp search, function replace.
265 return StringReplaceGlobalRegExpWithFunction(subject, search, replace); 271 return StringReplaceGlobalRegExpWithFunction(subject, search, replace);
266 } 272 }
267 // Non-global regexp search, function replace. 273 // Non-global regexp search, function replace.
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 reusableReplaceArray = null; 417 reusableReplaceArray = null;
412 } else { 418 } else {
413 // Inside a nested replace (replace called from the replacement function 419 // Inside a nested replace (replace called from the replacement function
414 // of another replace) or we have failed to set the reusable array 420 // of another replace) or we have failed to set the reusable array
415 // back due to an exception in a replacement function. Create a new 421 // back due to an exception in a replacement function. Create a new
416 // array to use in the future, or until the original is written back. 422 // array to use in the future, or until the original is written back.
417 resultArray = new InternalArray(16); 423 resultArray = new InternalArray(16);
418 } 424 }
419 var res = %RegExpExecMultiple(regexp, 425 var res = %RegExpExecMultiple(regexp,
420 subject, 426 subject,
421 lastMatchInfo, 427 $regexpLastMatchInfo,
422 resultArray); 428 resultArray);
423 regexp.lastIndex = 0; 429 regexp.lastIndex = 0;
424 if (IS_NULL(res)) { 430 if (IS_NULL(res)) {
425 // No matches at all. 431 // No matches at all.
426 reusableReplaceArray = resultArray; 432 reusableReplaceArray = resultArray;
427 return subject; 433 return subject;
428 } 434 }
429 var len = res.length; 435 var len = res.length;
430 if (NUMBER_OF_CAPTURES(lastMatchInfo) == 2) { 436 if (NUMBER_OF_CAPTURES($regexpLastMatchInfo) == 2) {
431 // If the number of captures is two then there are no explicit captures in 437 // If the number of captures is two then there are no explicit captures in
432 // the regexp, just the implicit capture that captures the whole match. In 438 // the regexp, just the implicit capture that captures the whole match. In
433 // this case we can simplify quite a bit and end up with something faster. 439 // this case we can simplify quite a bit and end up with something faster.
434 // The builder will consist of some integers that indicate slices of the 440 // The builder will consist of some integers that indicate slices of the
435 // input string and some replacements that were returned from the replace 441 // input string and some replacements that were returned from the replace
436 // function. 442 // function.
437 var match_start = 0; 443 var match_start = 0;
438 var override = new InternalPackedArray(null, 0, subject); 444 var override = new InternalPackedArray(null, 0, subject);
439 var receiver = %GetDefaultReceiver(replace); 445 var receiver = %GetDefaultReceiver(replace);
440 for (var i = 0; i < len; i++) { 446 for (var i = 0; i < len; i++) {
441 var elem = res[i]; 447 var elem = res[i];
442 if (%_IsSmi(elem)) { 448 if (%_IsSmi(elem)) {
443 // Integers represent slices of the original string. Use these to 449 // Integers represent slices of the original string. Use these to
444 // get the offsets we need for the override array (so things like 450 // get the offsets we need for the override array (so things like
445 // RegExp.leftContext work during the callback function. 451 // RegExp.leftContext work during the callback function.
446 if (elem > 0) { 452 if (elem > 0) {
447 match_start = (elem >> 11) + (elem & 0x7ff); 453 match_start = (elem >> 11) + (elem & 0x7ff);
448 } else { 454 } else {
449 match_start = res[++i] - elem; 455 match_start = res[++i] - elem;
450 } 456 }
451 } else { 457 } else {
452 override[0] = elem; 458 override[0] = elem;
453 override[1] = match_start; 459 override[1] = match_start;
454 lastMatchInfoOverride = override; 460 $regexpLastMatchInfoOverride = override;
455 var func_result = 461 var func_result =
456 %_CallFunction(receiver, elem, match_start, subject, replace); 462 %_CallFunction(receiver, elem, match_start, subject, replace);
457 // Overwrite the i'th element in the results with the string we got 463 // Overwrite the i'th element in the results with the string we got
458 // back from the callback function. 464 // back from the callback function.
459 res[i] = TO_STRING_INLINE(func_result); 465 res[i] = TO_STRING_INLINE(func_result);
460 match_start += elem.length; 466 match_start += elem.length;
461 } 467 }
462 } 468 }
463 } else { 469 } else {
464 var receiver = %GetDefaultReceiver(replace); 470 var receiver = %GetDefaultReceiver(replace);
465 for (var i = 0; i < len; i++) { 471 for (var i = 0; i < len; i++) {
466 var elem = res[i]; 472 var elem = res[i];
467 if (!%_IsSmi(elem)) { 473 if (!%_IsSmi(elem)) {
468 // elem must be an Array. 474 // elem must be an Array.
469 // Use the apply argument as backing for global RegExp properties. 475 // Use the apply argument as backing for global RegExp properties.
470 lastMatchInfoOverride = elem; 476 $regexpLastMatchInfoOverride = elem;
471 var func_result = %Apply(replace, receiver, elem, 0, elem.length); 477 var func_result = %Apply(replace, receiver, elem, 0, elem.length);
472 // Overwrite the i'th element in the results with the string we got 478 // Overwrite the i'th element in the results with the string we got
473 // back from the callback function. 479 // back from the callback function.
474 res[i] = TO_STRING_INLINE(func_result); 480 res[i] = TO_STRING_INLINE(func_result);
475 } 481 }
476 } 482 }
477 } 483 }
478 var result = %StringBuilderConcat(res, res.length, subject); 484 var result = %StringBuilderConcat(res, res.length, subject);
479 resultArray.length = 0; 485 resultArray.length = 0;
480 reusableReplaceArray = resultArray; 486 reusableReplaceArray = resultArray;
481 return result; 487 return result;
482 } 488 }
483 489
484 490
485 function StringReplaceNonGlobalRegExpWithFunction(subject, regexp, replace) { 491 function StringReplaceNonGlobalRegExpWithFunction(subject, regexp, replace) {
486 var matchInfo = DoRegExpExec(regexp, subject, 0); 492 var matchInfo = $regexpExec(regexp, subject, 0);
487 if (IS_NULL(matchInfo)) { 493 if (IS_NULL(matchInfo)) {
488 regexp.lastIndex = 0; 494 regexp.lastIndex = 0;
489 return subject; 495 return subject;
490 } 496 }
491 var index = matchInfo[CAPTURE0]; 497 var index = matchInfo[CAPTURE0];
492 var result = %_SubString(subject, 0, index); 498 var result = %_SubString(subject, 0, index);
493 var endOfMatch = matchInfo[CAPTURE1]; 499 var endOfMatch = matchInfo[CAPTURE1];
494 // Compute the parameter list consisting of the match, captures, index, 500 // Compute the parameter list consisting of the match, captures, index,
495 // and subject for the replace function invocation. 501 // and subject for the replace function invocation.
496 // The number of captures plus one for the match. 502 // The number of captures plus one for the match.
(...skipping 26 matching lines...) Expand all
523 // ECMA-262 section 15.5.4.12 529 // ECMA-262 section 15.5.4.12
524 function StringSearch(re) { 530 function StringSearch(re) {
525 CHECK_OBJECT_COERCIBLE(this, "String.prototype.search"); 531 CHECK_OBJECT_COERCIBLE(this, "String.prototype.search");
526 532
527 var regexp; 533 var regexp;
528 if (IS_STRING(re)) { 534 if (IS_STRING(re)) {
529 regexp = %_GetFromCache(STRING_TO_REGEXP_CACHE_ID, re); 535 regexp = %_GetFromCache(STRING_TO_REGEXP_CACHE_ID, re);
530 } else if (IS_REGEXP(re)) { 536 } else if (IS_REGEXP(re)) {
531 regexp = re; 537 regexp = re;
532 } else { 538 } else {
533 regexp = new $RegExp(re); 539 regexp = new GlobalRegExp(re);
534 } 540 }
535 var match = DoRegExpExec(regexp, TO_STRING_INLINE(this), 0); 541 var match = $regexpExec(regexp, TO_STRING_INLINE(this), 0);
536 if (match) { 542 if (match) {
537 return match[CAPTURE0]; 543 return match[CAPTURE0];
538 } 544 }
539 return -1; 545 return -1;
540 } 546 }
541 547
542 548
543 // ECMA-262 section 15.5.4.13 549 // ECMA-262 section 15.5.4.13
544 function StringSlice(start, end) { 550 function StringSlice(start, end) {
545 CHECK_OBJECT_COERCIBLE(this, "String.prototype.slice"); 551 CHECK_OBJECT_COERCIBLE(this, "String.prototype.slice");
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 617
612 if (limit === 0) return []; 618 if (limit === 0) return [];
613 619
614 // Separator is a regular expression. 620 // Separator is a regular expression.
615 return StringSplitOnRegExp(subject, separator, limit, length); 621 return StringSplitOnRegExp(subject, separator, limit, length);
616 } 622 }
617 623
618 624
619 function StringSplitOnRegExp(subject, separator, limit, length) { 625 function StringSplitOnRegExp(subject, separator, limit, length) {
620 if (length === 0) { 626 if (length === 0) {
621 if (DoRegExpExec(separator, subject, 0, 0) != null) { 627 if ($regexpExec(separator, subject, 0, 0) != null) {
622 return []; 628 return [];
623 } 629 }
624 return [subject]; 630 return [subject];
625 } 631 }
626 632
627 var currentIndex = 0; 633 var currentIndex = 0;
628 var startIndex = 0; 634 var startIndex = 0;
629 var startMatch = 0; 635 var startMatch = 0;
630 var result = new InternalArray(); 636 var result = new InternalArray();
631 637
632 outer_loop: 638 outer_loop:
633 while (true) { 639 while (true) {
634 640
635 if (startIndex === length) { 641 if (startIndex === length) {
636 result[result.length] = %_SubString(subject, currentIndex, length); 642 result[result.length] = %_SubString(subject, currentIndex, length);
637 break; 643 break;
638 } 644 }
639 645
640 var matchInfo = DoRegExpExec(separator, subject, startIndex); 646 var matchInfo = $regexpExec(separator, subject, startIndex);
641 if (matchInfo == null || length === (startMatch = matchInfo[CAPTURE0])) { 647 if (matchInfo == null || length === (startMatch = matchInfo[CAPTURE0])) {
642 result[result.length] = %_SubString(subject, currentIndex, length); 648 result[result.length] = %_SubString(subject, currentIndex, length);
643 break; 649 break;
644 } 650 }
645 var endIndex = matchInfo[CAPTURE1]; 651 var endIndex = matchInfo[CAPTURE1];
646 652
647 // We ignore a zero-length match at the currentIndex. 653 // We ignore a zero-length match at the currentIndex.
648 if (startIndex === endIndex && endIndex === currentIndex) { 654 if (startIndex === endIndex && endIndex === currentIndex) {
649 startIndex++; 655 startIndex++;
650 continue; 656 continue;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 925
920 926
921 // ES6 draft, revision 26 (2014-07-18), section B.2.3.14 927 // ES6 draft, revision 26 (2014-07-18), section B.2.3.14
922 function StringSup() { 928 function StringSup() {
923 CHECK_OBJECT_COERCIBLE(this, "String.prototype.sup"); 929 CHECK_OBJECT_COERCIBLE(this, "String.prototype.sup");
924 return "<sup>" + this + "</sup>"; 930 return "<sup>" + this + "</sup>";
925 } 931 }
926 932
927 // ------------------------------------------------------------------- 933 // -------------------------------------------------------------------
928 934
929 function SetUpString() { 935 // Set the String function and constructor.
930 %CheckIsBootstrapping(); 936 %SetCode(GlobalString, StringConstructor);
937 %FunctionSetPrototype(GlobalString, new GlobalString());
931 938
932 // Set the String function and constructor. 939 // Set up the constructor property on the String prototype object.
933 %SetCode($String, StringConstructor); 940 %AddNamedProperty(GlobalString.prototype, "constructor", GlobalString, DONT_ENUM );
Jakob Kummerow 2015/03/12 12:46:35 nit: 80col
934 %FunctionSetPrototype($String, new $String());
935 941
936 // Set up the constructor property on the String prototype object. 942 // Set up the non-enumerable functions on the String object.
937 %AddNamedProperty($String.prototype, "constructor", $String, DONT_ENUM); 943 InstallFunctions(GlobalString, DONT_ENUM, $Array(
Jakob Kummerow 2015/03/12 12:46:35 Why "$Array"? Other files use "var GlobalArray = g
944 "fromCharCode", StringFromCharCode
945 ));
938 946
939 // Set up the non-enumerable functions on the String object. 947 // Set up the non-enumerable functions on the String prototype object.
940 InstallFunctions($String, DONT_ENUM, $Array( 948 InstallFunctions(GlobalString.prototype, DONT_ENUM, $Array(
941 "fromCharCode", StringFromCharCode 949 "valueOf", StringValueOf,
942 )); 950 "toString", StringToString,
951 "charAt", StringCharAt,
952 "charCodeAt", StringCharCodeAt,
953 "concat", StringConcat,
954 "indexOf", StringIndexOfJS,
955 "lastIndexOf", StringLastIndexOfJS,
956 "localeCompare", StringLocaleCompareJS,
957 "match", StringMatchJS,
958 "normalize", StringNormalizeJS,
959 "replace", StringReplace,
960 "search", StringSearch,
961 "slice", StringSlice,
962 "split", StringSplitJS,
963 "substring", StringSubstring,
964 "substr", StringSubstr,
965 "toLowerCase", StringToLowerCaseJS,
966 "toLocaleLowerCase", StringToLocaleLowerCase,
967 "toUpperCase", StringToUpperCaseJS,
968 "toLocaleUpperCase", StringToLocaleUpperCase,
969 "trim", StringTrimJS,
970 "trimLeft", StringTrimLeft,
971 "trimRight", StringTrimRight,
972 "link", StringLink,
973 "anchor", StringAnchor,
974 "fontcolor", StringFontcolor,
975 "fontsize", StringFontsize,
976 "big", StringBig,
977 "blink", StringBlink,
978 "bold", StringBold,
979 "fixed", StringFixed,
980 "italics", StringItalics,
981 "small", StringSmall,
982 "strike", StringStrike,
983 "sub", StringSub,
984 "sup", StringSup
985 ));
943 986
944 // Set up the non-enumerable functions on the String prototype object. 987 $stringCharAt = StringCharAt;
945 InstallFunctions($String.prototype, DONT_ENUM, $Array( 988 $stringIndexOf = StringIndexOfJS;
946 "valueOf", StringValueOf, 989 $stringSubstring = StringSubstring;
947 "toString", StringToString,
948 "charAt", StringCharAt,
949 "charCodeAt", StringCharCodeAt,
950 "concat", StringConcat,
951 "indexOf", StringIndexOfJS,
952 "lastIndexOf", StringLastIndexOfJS,
953 "localeCompare", StringLocaleCompareJS,
954 "match", StringMatchJS,
955 "normalize", StringNormalizeJS,
956 "replace", StringReplace,
957 "search", StringSearch,
958 "slice", StringSlice,
959 "split", StringSplitJS,
960 "substring", StringSubstring,
961 "substr", StringSubstr,
962 "toLowerCase", StringToLowerCaseJS,
963 "toLocaleLowerCase", StringToLocaleLowerCase,
964 "toUpperCase", StringToUpperCaseJS,
965 "toLocaleUpperCase", StringToLocaleUpperCase,
966 "trim", StringTrimJS,
967 "trimLeft", StringTrimLeft,
968 "trimRight", StringTrimRight,
969 "link", StringLink,
970 "anchor", StringAnchor,
971 "fontcolor", StringFontcolor,
972 "fontsize", StringFontsize,
973 "big", StringBig,
974 "blink", StringBlink,
975 "bold", StringBold,
976 "fixed", StringFixed,
977 "italics", StringItalics,
978 "small", StringSmall,
979 "strike", StringStrike,
980 "sub", StringSub,
981 "sup", StringSup
982 ));
983 }
984 990
985 SetUpString(); 991 })();
OLDNEW
« no previous file with comments | « src/snapshot-common.cc ('k') | src/string-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698