| Index: src/js/regexp.js
|
| diff --git a/src/js/regexp.js b/src/js/regexp.js
|
| index f4101556b21dca293fd3c2c87a113bf1f6e4de99..a542b34f27c0227788e097e326a3c4a8eefd0a35 100644
|
| --- a/src/js/regexp.js
|
| +++ b/src/js/regexp.js
|
| @@ -178,7 +178,7 @@ function RegExpExecNoTests(regexp, string, start) {
|
|
|
| // ES#sec-regexp.prototype.exec
|
| // RegExp.prototype.exec ( string )
|
| -function RegExpSubclassExecJS(string) {
|
| +function RegExpExecJS(string) {
|
| if (!IS_REGEXP(this)) {
|
| throw %make_type_error(kIncompatibleMethodReceiver,
|
| 'RegExp.prototype.exec', this);
|
| @@ -217,47 +217,7 @@ function RegExpSubclassExecJS(string) {
|
| }
|
| RETURN_NEW_RESULT_FROM_MATCH_INFO(matchIndices, string);
|
| }
|
| -%FunctionRemovePrototype(RegExpSubclassExecJS);
|
| -
|
| -
|
| -// Legacy implementation of RegExp.prototype.exec
|
| -function RegExpExecJS(string) {
|
| - if (!IS_REGEXP(this)) {
|
| - throw %make_type_error(kIncompatibleMethodReceiver,
|
| - 'RegExp.prototype.exec', this);
|
| - }
|
| -
|
| - string = TO_STRING(string);
|
| - var lastIndex = this.lastIndex;
|
| -
|
| - // Conversion is required by the ES2015 specification (RegExpBuiltinExec
|
| - // algorithm, step 4) even if the value is discarded for non-global RegExps.
|
| - var i = TO_LENGTH(lastIndex);
|
| -
|
| - var updateLastIndex = REGEXP_GLOBAL(this) || REGEXP_STICKY(this);
|
| - if (updateLastIndex) {
|
| - if (i < 0 || i > string.length) {
|
| - this.lastIndex = 0;
|
| - return null;
|
| - }
|
| - } else {
|
| - i = 0;
|
| - }
|
| -
|
| - // matchIndices is either null or the RegExpLastMatchInfo array.
|
| - var matchIndices = %_RegExpExec(this, string, i, RegExpLastMatchInfo);
|
| -
|
| - if (IS_NULL(matchIndices)) {
|
| - this.lastIndex = 0;
|
| - return null;
|
| - }
|
| -
|
| - // Successful match.
|
| - if (updateLastIndex) {
|
| - this.lastIndex = RegExpLastMatchInfo[CAPTURE1];
|
| - }
|
| - RETURN_NEW_RESULT_FROM_MATCH_INFO(matchIndices, string);
|
| -}
|
| +%FunctionRemovePrototype(RegExpExecJS);
|
|
|
|
|
| // ES#sec-regexpexec Runtime Semantics: RegExpExec ( R, S )
|
| @@ -474,7 +434,7 @@ function RegExpSubclassSplit(string, limit) {
|
| var exec;
|
| if (IS_REGEXP(this) && constructor === GlobalRegExp) {
|
| exec = this.exec;
|
| - if (exec === RegExpSubclassExecJS) {
|
| + if (exec === RegExpExecJS) {
|
| return %_Call(RegExpSplit, this, string, limit);
|
| }
|
| }
|
| @@ -867,7 +827,7 @@ function RegExpSubclassReplace(string, replace) {
|
| var exec;
|
| if (IS_REGEXP(this)) {
|
| exec = this.exec;
|
| - if (exec === RegExpSubclassExecJS) {
|
| + if (exec === RegExpExecJS) {
|
| return %_Call(RegExpReplace, this, string, replace);
|
| }
|
| }
|
| @@ -1119,7 +1079,7 @@ GlobalRegExpPrototype = new GlobalObject();
|
| utils.InstallGetter(GlobalRegExp, speciesSymbol, RegExpSpecies);
|
|
|
| utils.InstallFunctions(GlobalRegExp.prototype, DONT_ENUM, [
|
| - "exec", RegExpSubclassExecJS,
|
| + "exec", RegExpExecJS,
|
| "test", RegExpSubclassTest,
|
| "toString", RegExpToString,
|
| "compile", RegExpCompileJS,
|
|
|