| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 var matchIndices = %_RegExpExec(this, string, i, lastMatchInfo); | 234 var matchIndices = %_RegExpExec(this, string, i, lastMatchInfo); |
| 235 if (matchIndices === null) { | 235 if (matchIndices === null) { |
| 236 this.lastIndex = 0; | 236 this.lastIndex = 0; |
| 237 return false; | 237 return false; |
| 238 } | 238 } |
| 239 lastMatchInfoOverride = null; | 239 lastMatchInfoOverride = null; |
| 240 this.lastIndex = lastMatchInfo[CAPTURE1]; | 240 this.lastIndex = lastMatchInfo[CAPTURE1]; |
| 241 return true; | 241 return true; |
| 242 } else { | 242 } else { |
| 243 // Non-global regexp. | 243 // Non-global regexp. |
| 244 // Remove irrelevant preceeding '.*' in a non-global test regexp. | 244 // Remove irrelevant preceding '.*' in a non-global test regexp. |
| 245 // The expression checks whether this.source starts with '.*' and | 245 // The expression checks whether this.source starts with '.*' and |
| 246 // that the third char is not a '?'. | 246 // that the third char is not a '?'. |
| 247 var regexp = this; | 247 var regexp = this; |
| 248 if (%_StringCharCodeAt(regexp.source, 0) == 46 && // '.' | 248 if (%_StringCharCodeAt(regexp.source, 0) == 46 && // '.' |
| 249 %_StringCharCodeAt(regexp.source, 1) == 42 && // '*' | 249 %_StringCharCodeAt(regexp.source, 1) == 42 && // '*' |
| 250 %_StringCharCodeAt(regexp.source, 2) != 63) { // '?' | 250 %_StringCharCodeAt(regexp.source, 2) != 63) { // '?' |
| 251 regexp = TrimRegExp(regexp); | 251 regexp = TrimRegExp(regexp); |
| 252 } | 252 } |
| 253 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [regexp, string, lastIndex]); | 253 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [regexp, string, lastIndex]); |
| 254 // matchIndices is either null or the lastMatchInfo array. | 254 // matchIndices is either null or the lastMatchInfo array. |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 476 |
| 477 for (var i = 1; i < 10; ++i) { | 477 for (var i = 1; i < 10; ++i) { |
| 478 %DefineOrRedefineAccessorProperty($RegExp, '$' + i, | 478 %DefineOrRedefineAccessorProperty($RegExp, '$' + i, |
| 479 RegExpMakeCaptureGetter(i), NoOpSetter, | 479 RegExpMakeCaptureGetter(i), NoOpSetter, |
| 480 DONT_DELETE); | 480 DONT_DELETE); |
| 481 } | 481 } |
| 482 %ToFastProperties($RegExp); | 482 %ToFastProperties($RegExp); |
| 483 } | 483 } |
| 484 | 484 |
| 485 SetUpRegExp(); | 485 SetUpRegExp(); |
| OLD | NEW |