| Index: src/js/regexp.js
|
| diff --git a/src/js/regexp.js b/src/js/regexp.js
|
| index fc5e0f54b8180945ef79dbb5be755f6387246878..d39771e9e329981871be76e825e2327059e6d145 100644
|
| --- a/src/js/regexp.js
|
| +++ b/src/js/regexp.js
|
| @@ -194,8 +194,8 @@ function RegExpSubclassExecJS(string) {
|
| // algorithm, step 4) even if the value is discarded for non-global RegExps.
|
| var i = TO_LENGTH(lastIndex);
|
|
|
| - var global = TO_BOOLEAN(this.global);
|
| - var sticky = TO_BOOLEAN(this.sticky);
|
| + var global = TO_BOOLEAN(REGEXP_GLOBAL(this));
|
| + var sticky = TO_BOOLEAN(REGEXP_STICKY(this));
|
| var updateLastIndex = global || sticky;
|
| if (updateLastIndex) {
|
| if (i > string.length) {
|
| @@ -370,27 +370,14 @@ function TrimRegExp(regexp) {
|
|
|
|
|
| function RegExpToString() {
|
| - if (!IS_REGEXP(this)) {
|
| - // RegExp.prototype.toString() returns '/(?:)/' as a compatibility fix;
|
| - // a UseCounter is incremented to track it.
|
| - // TODO(littledan): Remove this workaround or standardize it
|
| - if (this === GlobalRegExpPrototype) {
|
| - %IncrementUseCounter(kRegExpPrototypeToString);
|
| - return '/(?:)/';
|
| - }
|
| - if (!IS_RECEIVER(this)) {
|
| - throw MakeTypeError(
|
| - kIncompatibleMethodReceiver, 'RegExp.prototype.toString', this);
|
| - }
|
| - return '/' + TO_STRING(this.source) + '/' + TO_STRING(this.flags);
|
| + if (!IS_RECEIVER(this)) {
|
| + throw MakeTypeError(
|
| + kIncompatibleMethodReceiver, 'RegExp.prototype.toString', this);
|
| }
|
| - var result = '/' + REGEXP_SOURCE(this) + '/';
|
| - if (REGEXP_GLOBAL(this)) result += 'g';
|
| - if (REGEXP_IGNORE_CASE(this)) result += 'i';
|
| - if (REGEXP_MULTILINE(this)) result += 'm';
|
| - if (REGEXP_UNICODE(this)) result += 'u';
|
| - if (REGEXP_STICKY(this)) result += 'y';
|
| - return result;
|
| + if (this === GlobalRegExpPrototype) {
|
| + %IncrementUseCounter(kRegExpPrototypeToString);
|
| + }
|
| + return '/' + TO_STRING(this.source) + '/' + TO_STRING(this.flags);
|
| }
|
|
|
|
|
| @@ -1126,7 +1113,7 @@ function RegExpGetSource() {
|
| // TODO(littledan): Remove this RegExp compat workaround
|
| if (this === GlobalRegExpPrototype) {
|
| %IncrementUseCounter(kRegExpPrototypeSourceGetter);
|
| - return UNDEFINED;
|
| + return "(?:)";
|
| }
|
| throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.source");
|
| }
|
|
|