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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 }; | 378 }; |
379 } | 379 } |
380 | 380 |
381 | 381 |
382 // Property of the builtins object for recording the result of the last | 382 // Property of the builtins object for recording the result of the last |
383 // regexp match. The property lastMatchInfo includes the matchIndices | 383 // regexp match. The property lastMatchInfo includes the matchIndices |
384 // array of the last successful regexp match (an array of start/end index | 384 // array of the last successful regexp match (an array of start/end index |
385 // pairs for the match and all the captured substrings), the invariant is | 385 // pairs for the match and all the captured substrings), the invariant is |
386 // that there are at least two capture indeces. The array also contains | 386 // that there are at least two capture indeces. The array also contains |
387 // the subject string for the last successful match. | 387 // the subject string for the last successful match. |
388 var lastMatchInfo = new InternalArray( | 388 var lastMatchInfo = new InternalPackedArray( |
389 2, // REGEXP_NUMBER_OF_CAPTURES | 389 2, // REGEXP_NUMBER_OF_CAPTURES |
390 "", // Last subject. | 390 "", // Last subject. |
391 void 0, // Last input - settable with RegExpSetInput. | 391 void 0, // Last input - settable with RegExpSetInput. |
392 0, // REGEXP_FIRST_CAPTURE + 0 | 392 0, // REGEXP_FIRST_CAPTURE + 0 |
393 0 // REGEXP_FIRST_CAPTURE + 1 | 393 0 // REGEXP_FIRST_CAPTURE + 1 |
394 ); | 394 ); |
395 | 395 |
396 // Override last match info with an array of actual substrings. | 396 // Override last match info with an array of actual substrings. |
397 // Used internally by replace regexp with function. | 397 // Used internally by replace regexp with function. |
398 // The array has the format of an "apply" argument for a replacement | 398 // The array has the format of an "apply" argument for a replacement |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 480 |
481 for (var i = 1; i < 10; ++i) { | 481 for (var i = 1; i < 10; ++i) { |
482 %DefineOrRedefineAccessorProperty($RegExp, '$' + i, | 482 %DefineOrRedefineAccessorProperty($RegExp, '$' + i, |
483 RegExpMakeCaptureGetter(i), NoOpSetter, | 483 RegExpMakeCaptureGetter(i), NoOpSetter, |
484 DONT_DELETE); | 484 DONT_DELETE); |
485 } | 485 } |
486 %ToFastProperties($RegExp); | 486 %ToFastProperties($RegExp); |
487 } | 487 } |
488 | 488 |
489 SetUpRegExp(); | 489 SetUpRegExp(); |
OLD | NEW |