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

Side by Side Diff: src/regexp.js

Issue 265283007: Remove broken %_Log functionality. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Some missing flag uses. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/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 // This file relies on the fact that the following declaration has been made 5 // This file relies on the fact that the following declaration has been made
6 // in runtime.js: 6 // in runtime.js:
7 // var $Object = global.Object; 7 // var $Object = global.Object;
8 // var $Array = global.Array; 8 // var $Array = global.Array;
9 9
10 var $RegExp = global.RegExp; 10 var $RegExp = global.RegExp;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 var global = this.global; 155 var global = this.global;
156 if (global) { 156 if (global) {
157 if (i < 0 || i > string.length) { 157 if (i < 0 || i > string.length) {
158 this.lastIndex = 0; 158 this.lastIndex = 0;
159 return null; 159 return null;
160 } 160 }
161 } else { 161 } else {
162 i = 0; 162 i = 0;
163 } 163 }
164 164
165 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, string, lastIndex]);
166 // matchIndices is either null or the lastMatchInfo array. 165 // matchIndices is either null or the lastMatchInfo array.
167 var matchIndices = %_RegExpExec(this, string, i, lastMatchInfo); 166 var matchIndices = %_RegExpExec(this, string, i, lastMatchInfo);
168 167
169 if (IS_NULL(matchIndices)) { 168 if (IS_NULL(matchIndices)) {
170 this.lastIndex = 0; 169 this.lastIndex = 0;
171 return null; 170 return null;
172 } 171 }
173 172
174 // Successful match. 173 // Successful match.
175 lastMatchInfoOverride = null; 174 lastMatchInfoOverride = null;
(...skipping 23 matching lines...) Expand all
199 198
200 // Conversion is required by the ES5 specification (RegExp.prototype.exec 199 // Conversion is required by the ES5 specification (RegExp.prototype.exec
201 // algorithm, step 5) even if the value is discarded for non-global RegExps. 200 // algorithm, step 5) even if the value is discarded for non-global RegExps.
202 var i = TO_INTEGER(lastIndex); 201 var i = TO_INTEGER(lastIndex);
203 202
204 if (this.global) { 203 if (this.global) {
205 if (i < 0 || i > string.length) { 204 if (i < 0 || i > string.length) {
206 this.lastIndex = 0; 205 this.lastIndex = 0;
207 return false; 206 return false;
208 } 207 }
209 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, string, lastIndex]);
210 // matchIndices is either null or the lastMatchInfo array. 208 // matchIndices is either null or the lastMatchInfo array.
211 var matchIndices = %_RegExpExec(this, string, i, lastMatchInfo); 209 var matchIndices = %_RegExpExec(this, string, i, lastMatchInfo);
212 if (IS_NULL(matchIndices)) { 210 if (IS_NULL(matchIndices)) {
213 this.lastIndex = 0; 211 this.lastIndex = 0;
214 return false; 212 return false;
215 } 213 }
216 lastMatchInfoOverride = null; 214 lastMatchInfoOverride = null;
217 this.lastIndex = lastMatchInfo[CAPTURE1]; 215 this.lastIndex = lastMatchInfo[CAPTURE1];
218 return true; 216 return true;
219 } else { 217 } else {
220 // Non-global regexp. 218 // Non-global regexp.
221 // Remove irrelevant preceeding '.*' in a non-global test regexp. 219 // Remove irrelevant preceeding '.*' in a non-global test regexp.
222 // The expression checks whether this.source starts with '.*' and 220 // The expression checks whether this.source starts with '.*' and
223 // that the third char is not a '?'. 221 // that the third char is not a '?'.
224 var regexp = this; 222 var regexp = this;
225 if (%_StringCharCodeAt(regexp.source, 0) == 46 && // '.' 223 if (%_StringCharCodeAt(regexp.source, 0) == 46 && // '.'
226 %_StringCharCodeAt(regexp.source, 1) == 42 && // '*' 224 %_StringCharCodeAt(regexp.source, 1) == 42 && // '*'
227 %_StringCharCodeAt(regexp.source, 2) != 63) { // '?' 225 %_StringCharCodeAt(regexp.source, 2) != 63) { // '?'
228 regexp = TrimRegExp(regexp); 226 regexp = TrimRegExp(regexp);
229 } 227 }
230 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [regexp, string, lastIndex]);
231 // matchIndices is either null or the lastMatchInfo array. 228 // matchIndices is either null or the lastMatchInfo array.
232 var matchIndices = %_RegExpExec(regexp, string, 0, lastMatchInfo); 229 var matchIndices = %_RegExpExec(regexp, string, 0, lastMatchInfo);
233 if (IS_NULL(matchIndices)) { 230 if (IS_NULL(matchIndices)) {
234 this.lastIndex = 0; 231 this.lastIndex = 0;
235 return false; 232 return false;
236 } 233 }
237 lastMatchInfoOverride = null; 234 lastMatchInfoOverride = null;
238 return true; 235 return true;
239 } 236 }
240 } 237 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 450
454 for (var i = 1; i < 10; ++i) { 451 for (var i = 1; i < 10; ++i) {
455 %DefineOrRedefineAccessorProperty($RegExp, '$' + i, 452 %DefineOrRedefineAccessorProperty($RegExp, '$' + i,
456 RegExpMakeCaptureGetter(i), NoOpSetter, 453 RegExpMakeCaptureGetter(i), NoOpSetter,
457 DONT_DELETE); 454 DONT_DELETE);
458 } 455 }
459 %ToFastProperties($RegExp); 456 %ToFastProperties($RegExp);
460 } 457 }
461 458
462 SetUpRegExp(); 459 SetUpRegExp();
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698