| Index: src/string.js
|
| ===================================================================
|
| --- src/string.js (revision 15496)
|
| +++ src/string.js (working copy)
|
| @@ -184,8 +184,10 @@
|
| var subject = TO_STRING_INLINE(this);
|
| if (IS_REGEXP(regexp)) {
|
| // Emulate RegExp.prototype.exec's side effect in step 5, even though
|
| - // value is discarded.
|
| - ToInteger(regexp.lastIndex);
|
| + // value is discarded. Inline ToInteger() manually.
|
| + if (! %_IsSmi(regexp.lastIndex)) {
|
| + ToNumber(regexp.lastIndex);
|
| + }
|
| if (!regexp.global) return RegExpExecNoTests(regexp, subject, 0);
|
| %_Log('regexp', 'regexp-match,%0S,%1r', [subject, regexp]);
|
| // lastMatchInfo is defined in regexp.js.
|
| @@ -235,8 +237,10 @@
|
|
|
| if (IS_REGEXP(search)) {
|
| // Emulate RegExp.prototype.exec's side effect in step 5, even if
|
| - // value is discarded.
|
| - ToInteger(search.lastIndex);
|
| + // value is discarded. Inline ToInteger() manually.
|
| + if (! %_IsSmi(search.lastIndex)) {
|
| + ToNumber(search.lastIndex);
|
| + }
|
| %_Log('regexp', 'regexp-replace,%0r,%1S', [search, subject]);
|
|
|
| if (!IS_SPEC_FUNCTION(replace)) {
|
|
|