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

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

Issue 1850643002: Adding %_NewObject intrinsic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: formatting Created 4 years, 8 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/regexp.js ('k') | no next file » | 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
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (!IS_NULL_OR_UNDEFINED(pattern)) { 155 if (!IS_NULL_OR_UNDEFINED(pattern)) {
156 var matcher = pattern[matchSymbol]; 156 var matcher = pattern[matchSymbol];
157 if (!IS_UNDEFINED(matcher)) { 157 if (!IS_UNDEFINED(matcher)) {
158 return %_Call(matcher, pattern, this); 158 return %_Call(matcher, pattern, this);
159 } 159 }
160 } 160 }
161 161
162 var subject = TO_STRING(this); 162 var subject = TO_STRING(this);
163 163
164 // Equivalent to RegExpCreate (ES#sec-regexpcreate) 164 // Equivalent to RegExpCreate (ES#sec-regexpcreate)
165 var regexp = %NewObject(GlobalRegExp, GlobalRegExp); 165 var regexp = %_NewObject(GlobalRegExp, GlobalRegExp);
166 RegExpInitialize(regexp, pattern); 166 RegExpInitialize(regexp, pattern);
167 return regexp[matchSymbol](subject); 167 return regexp[matchSymbol](subject);
168 } 168 }
169 169
170 170
171 // ECMA-262 v6, section 21.1.3.12 171 // ECMA-262 v6, section 21.1.3.12
172 // 172 //
173 // For now we do nothing, as proper normalization requires big tables. 173 // For now we do nothing, as proper normalization requires big tables.
174 // If Intl is enabled, then i18n.js will override it and provide the the 174 // If Intl is enabled, then i18n.js will override it and provide the the
175 // proper functionality. 175 // proper functionality.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 if (!IS_NULL_OR_UNDEFINED(pattern)) { 353 if (!IS_NULL_OR_UNDEFINED(pattern)) {
354 var searcher = pattern[searchSymbol]; 354 var searcher = pattern[searchSymbol];
355 if (!IS_UNDEFINED(searcher)) { 355 if (!IS_UNDEFINED(searcher)) {
356 return %_Call(searcher, pattern, this); 356 return %_Call(searcher, pattern, this);
357 } 357 }
358 } 358 }
359 359
360 var subject = TO_STRING(this); 360 var subject = TO_STRING(this);
361 361
362 // Equivalent to RegExpCreate (ES#sec-regexpcreate) 362 // Equivalent to RegExpCreate (ES#sec-regexpcreate)
363 var regexp = %NewObject(GlobalRegExp, GlobalRegExp); 363 var regexp = %_NewObject(GlobalRegExp, GlobalRegExp);
364 RegExpInitialize(regexp, pattern); 364 RegExpInitialize(regexp, pattern);
365 return %_Call(regexp[searchSymbol], regexp, subject); 365 return %_Call(regexp[searchSymbol], regexp, subject);
366 } 366 }
367 367
368 368
369 // ECMA-262 section 15.5.4.13 369 // ECMA-262 section 15.5.4.13
370 function StringSlice(start, end) { 370 function StringSlice(start, end) {
371 CHECK_OBJECT_COERCIBLE(this, "String.prototype.slice"); 371 CHECK_OBJECT_COERCIBLE(this, "String.prototype.slice");
372 372
373 var s = TO_STRING(this); 373 var s = TO_STRING(this);
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 to.StringLastIndexOf = StringLastIndexOf; 927 to.StringLastIndexOf = StringLastIndexOf;
928 to.StringMatch = StringMatchJS; 928 to.StringMatch = StringMatchJS;
929 to.StringReplace = StringReplace; 929 to.StringReplace = StringReplace;
930 to.StringSlice = StringSlice; 930 to.StringSlice = StringSlice;
931 to.StringSplit = StringSplitJS; 931 to.StringSplit = StringSplitJS;
932 to.StringSubstr = StringSubstr; 932 to.StringSubstr = StringSubstr;
933 to.StringSubstring = StringSubstring; 933 to.StringSubstring = StringSubstring;
934 }); 934 });
935 935
936 }) 936 })
OLDNEW
« no previous file with comments | « src/js/regexp.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698