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

Side by Side Diff: src/string.js

Issue 564035: Remove lazy loading of natives files and the natives cache.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/serialize.cc ('k') | src/v8threads.cc » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (%_ArgumentsLength() === 0) return 0; 153 if (%_ArgumentsLength() === 0) return 0;
154 154
155 var this_str = ToString(this); 155 var this_str = ToString(this);
156 var other_str = ToString(other); 156 var other_str = ToString(other);
157 return %StringLocaleCompare(this_str, other_str); 157 return %StringLocaleCompare(this_str, other_str);
158 } 158 }
159 159
160 160
161 // ECMA-262 section 15.5.4.10 161 // ECMA-262 section 15.5.4.10
162 function StringMatch(regexp) { 162 function StringMatch(regexp) {
163 if (!IS_REGEXP(regexp)) regexp = new ORIGINAL_REGEXP(regexp); 163 if (!IS_REGEXP(regexp)) regexp = new $RegExp(regexp);
164 var subject = ToString(this); 164 var subject = ToString(this);
165 165
166 if (!regexp.global) return regexp.exec(subject); 166 if (!regexp.global) return regexp.exec(subject);
167 %_Log('regexp', 'regexp-match,%0S,%1r', [subject, regexp]); 167 %_Log('regexp', 'regexp-match,%0S,%1r', [subject, regexp]);
168 // lastMatchInfo is defined in regexp-delay.js. 168 // lastMatchInfo is defined in regexp.js.
169 return %StringMatch(subject, regexp, lastMatchInfo); 169 return %StringMatch(subject, regexp, lastMatchInfo);
170 } 170 }
171 171
172 172
173 // SubString is an internal function that returns the sub string of 'string'. 173 // SubString is an internal function that returns the sub string of 'string'.
174 // If resulting string is of length 1, we use the one character cache 174 // If resulting string is of length 1, we use the one character cache
175 // otherwise we call the runtime system. 175 // otherwise we call the runtime system.
176 function SubString(string, start, end) { 176 function SubString(string, start, end) {
177 // Use the one character string cache. 177 // Use the one character string cache.
178 if (start + 1 == end) { 178 if (start + 1 == end) {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 parameters[j] = CaptureString(subject, matchInfo, j); 450 parameters[j] = CaptureString(subject, matchInfo, j);
451 } 451 }
452 parameters[j] = index; 452 parameters[j] = index;
453 parameters[j + 1] = subject; 453 parameters[j + 1] = subject;
454 return replace.apply(null, parameters); 454 return replace.apply(null, parameters);
455 } 455 }
456 456
457 457
458 // ECMA-262 section 15.5.4.12 458 // ECMA-262 section 15.5.4.12
459 function StringSearch(re) { 459 function StringSearch(re) {
460 var regexp = new ORIGINAL_REGEXP(re); 460 var regexp = new $RegExp(re);
461 var s = ToString(this); 461 var s = ToString(this);
462 var last_idx = regexp.lastIndex; // keep old lastIndex 462 var last_idx = regexp.lastIndex; // keep old lastIndex
463 regexp.lastIndex = 0; // ignore re.global property 463 regexp.lastIndex = 0; // ignore re.global property
464 var result = regexp.exec(s); 464 var result = regexp.exec(s);
465 regexp.lastIndex = last_idx; // restore lastIndex 465 regexp.lastIndex = last_idx; // restore lastIndex
466 if (result == null) 466 if (result == null)
467 return -1; 467 return -1;
468 else 468 else
469 return result.index; 469 return result.index;
470 } 470 }
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 "small", StringSmall, 892 "small", StringSmall,
893 "strike", StringStrike, 893 "strike", StringStrike,
894 "sub", StringSub, 894 "sub", StringSub,
895 "sup", StringSup, 895 "sup", StringSup,
896 "toJSON", StringToJSON 896 "toJSON", StringToJSON
897 )); 897 ));
898 } 898 }
899 899
900 900
901 SetupString(); 901 SetupString();
OLDNEW
« no previous file with comments | « src/serialize.cc ('k') | src/v8threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698