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

Side by Side Diff: src/js/string.js

Issue 2232063002: [builtins] WIP: Array indexOf in TurboFan/Runtime (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move fast path FastElements -> FastSmiOrObjectElements Created 4 years, 4 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/js/i18n.js ('k') | src/runtime/runtime.h » ('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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 // Imports 10 // Imports
11 11
12 var ArrayIndexOf;
13 var ArrayJoin; 12 var ArrayJoin;
14 var GlobalRegExp = global.RegExp; 13 var GlobalRegExp = global.RegExp;
15 var GlobalString = global.String; 14 var GlobalString = global.String;
16 var IsRegExp; 15 var IsRegExp;
17 var MaxSimple; 16 var MaxSimple;
18 var MinSimple; 17 var MinSimple;
19 var RegExpInitialize; 18 var RegExpInitialize;
20 var matchSymbol = utils.ImportNow("match_symbol"); 19 var matchSymbol = utils.ImportNow("match_symbol");
21 var replaceSymbol = utils.ImportNow("replace_symbol"); 20 var replaceSymbol = utils.ImportNow("replace_symbol");
22 var searchSymbol = utils.ImportNow("search_symbol"); 21 var searchSymbol = utils.ImportNow("search_symbol");
23 var splitSymbol = utils.ImportNow("split_symbol"); 22 var splitSymbol = utils.ImportNow("split_symbol");
24 23
25 utils.Import(function(from) { 24 utils.Import(function(from) {
26 ArrayIndexOf = from.ArrayIndexOf;
27 ArrayJoin = from.ArrayJoin; 25 ArrayJoin = from.ArrayJoin;
28 IsRegExp = from.IsRegExp; 26 IsRegExp = from.IsRegExp;
29 MaxSimple = from.MaxSimple; 27 MaxSimple = from.MaxSimple;
30 MinSimple = from.MinSimple; 28 MinSimple = from.MinSimple;
31 RegExpInitialize = from.RegExpInitialize; 29 RegExpInitialize = from.RegExpInitialize;
32 }); 30 });
33 31
34 //------------------------------------------------------------------- 32 //-------------------------------------------------------------------
35 33
36 // ECMA-262, section 15.5.4.6 34 // ECMA-262, section 15.5.4.6
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // For now we do nothing, as proper normalization requires big tables. 123 // For now we do nothing, as proper normalization requires big tables.
126 // If Intl is enabled, then i18n.js will override it and provide the the 124 // If Intl is enabled, then i18n.js will override it and provide the the
127 // proper functionality. 125 // proper functionality.
128 function StringNormalize(formArg) { // length == 0 126 function StringNormalize(formArg) { // length == 0
129 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); 127 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize");
130 var s = TO_STRING(this); 128 var s = TO_STRING(this);
131 129
132 var form = IS_UNDEFINED(formArg) ? 'NFC' : TO_STRING(formArg); 130 var form = IS_UNDEFINED(formArg) ? 'NFC' : TO_STRING(formArg);
133 131
134 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD']; 132 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD'];
135 var normalizationForm = %_Call(ArrayIndexOf, NORMALIZATION_FORMS, form); 133 var normalizationForm = %ArrayIndexOf(NORMALIZATION_FORMS, form, 0);
136 if (normalizationForm === -1) { 134 if (normalizationForm === -1) {
137 throw %make_range_error(kNormalizationForm, 135 throw %make_range_error(kNormalizationForm,
138 %_Call(ArrayJoin, NORMALIZATION_FORMS, ', ')); 136 %_Call(ArrayJoin, NORMALIZATION_FORMS, ', '));
139 } 137 }
140 138
141 return s; 139 return s;
142 } 140 }
143 141
144 %FunctionSetLength(StringNormalize, 0); 142 %FunctionSetLength(StringNormalize, 0);
145 143
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 to.StringLastIndexOf = StringLastIndexOf; 778 to.StringLastIndexOf = StringLastIndexOf;
781 to.StringMatch = StringMatchJS; 779 to.StringMatch = StringMatchJS;
782 to.StringReplace = StringReplace; 780 to.StringReplace = StringReplace;
783 to.StringSlice = StringSlice; 781 to.StringSlice = StringSlice;
784 to.StringSplit = StringSplitJS; 782 to.StringSplit = StringSplitJS;
785 to.StringSubstr = StringSubstr; 783 to.StringSubstr = StringSubstr;
786 to.StringSubstring = StringSubstring; 784 to.StringSubstring = StringSubstring;
787 }); 785 });
788 786
789 }) 787 })
OLDNEW
« no previous file with comments | « src/js/i18n.js ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698