OLD | NEW |
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 'use strict'; | 7 'use strict'; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 var stringIndex = prevStringIndex; | 506 var stringIndex = prevStringIndex; |
507 while (stringIndex < size) { | 507 while (stringIndex < size) { |
508 splitter.lastIndex = stringIndex; | 508 splitter.lastIndex = stringIndex; |
509 result = RegExpSubclassExec(splitter, string, exec); | 509 result = RegExpSubclassExec(splitter, string, exec); |
510 // Ensure exec will be read again on the next loop through. | 510 // Ensure exec will be read again on the next loop through. |
511 exec = UNDEFINED; | 511 exec = UNDEFINED; |
512 if (IS_NULL(result)) { | 512 if (IS_NULL(result)) { |
513 stringIndex += AdvanceStringIndex(string, stringIndex, unicode); | 513 stringIndex += AdvanceStringIndex(string, stringIndex, unicode); |
514 } else { | 514 } else { |
515 var end = MinSimple(TO_LENGTH(splitter.lastIndex), size); | 515 var end = MinSimple(TO_LENGTH(splitter.lastIndex), size); |
516 if (end === stringIndex) { | 516 if (end === prevStringIndex) { |
517 stringIndex += AdvanceStringIndex(string, stringIndex, unicode); | 517 stringIndex += AdvanceStringIndex(string, stringIndex, unicode); |
518 } else { | 518 } else { |
519 %AddElement( | 519 %AddElement( |
520 array, arrayIndex, | 520 array, arrayIndex, |
521 %_SubString(string, prevStringIndex, stringIndex)); | 521 %_SubString(string, prevStringIndex, stringIndex)); |
522 arrayIndex++; | 522 arrayIndex++; |
523 if (arrayIndex === lim) return array; | 523 if (arrayIndex === lim) return array; |
524 prevStringIndex = end; | 524 prevStringIndex = end; |
525 var numberOfCaptures = MaxSimple(TO_LENGTH(result.length), 0); | 525 var numberOfCaptures = MaxSimple(TO_LENGTH(result.length), 0); |
526 for (var i = 1; i < numberOfCaptures; i++) { | 526 for (var i = 1; i < numberOfCaptures; i++) { |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 to.RegExpSubclassExecJS = RegExpSubclassExecJS; | 1237 to.RegExpSubclassExecJS = RegExpSubclassExecJS; |
1238 to.RegExpSubclassMatch = RegExpSubclassMatch; | 1238 to.RegExpSubclassMatch = RegExpSubclassMatch; |
1239 to.RegExpSubclassReplace = RegExpSubclassReplace; | 1239 to.RegExpSubclassReplace = RegExpSubclassReplace; |
1240 to.RegExpSubclassSearch = RegExpSubclassSearch; | 1240 to.RegExpSubclassSearch = RegExpSubclassSearch; |
1241 to.RegExpSubclassSplit = RegExpSubclassSplit; | 1241 to.RegExpSubclassSplit = RegExpSubclassSplit; |
1242 to.RegExpSubclassTest = RegExpSubclassTest; | 1242 to.RegExpSubclassTest = RegExpSubclassTest; |
1243 to.RegExpTest = RegExpTest; | 1243 to.RegExpTest = RegExpTest; |
1244 }); | 1244 }); |
1245 | 1245 |
1246 }) | 1246 }) |
OLD | NEW |