| Index: src/js/regexp.js
|
| diff --git a/src/js/regexp.js b/src/js/regexp.js
|
| index 086f5e5c5e62b466e8ccf81653a6d4ed76979816..ecec6e276e8533021370ad7813ff226e2dc017ce 100644
|
| --- a/src/js/regexp.js
|
| +++ b/src/js/regexp.js
|
| @@ -12,6 +12,7 @@
|
| var FLAG_harmony_tolength;
|
| var GlobalObject = global.Object;
|
| var GlobalRegExp = global.RegExp;
|
| +var GlobalRegExpPrototype;
|
| var InternalArray = utils.InternalArray;
|
| var InternalPackedArray = utils.InternalPackedArray;
|
| var MakeTypeError;
|
| @@ -270,8 +271,17 @@ function TrimRegExp(regexp) {
|
| }
|
|
|
|
|
| +var kRegExpPrototypeToString = 12;
|
| +
|
| 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 '/(?:)/';
|
| + }
|
| throw MakeTypeError(kIncompatibleMethodReceiver,
|
| 'RegExp.prototype.toString', this);
|
| }
|
| @@ -491,7 +501,8 @@ function RegExpGetSource() {
|
| // -------------------------------------------------------------------
|
|
|
| %FunctionSetInstanceClassName(GlobalRegExp, 'RegExp');
|
| -%FunctionSetPrototype(GlobalRegExp, new GlobalObject());
|
| +GlobalRegExpPrototype = new GlobalObject();
|
| +%FunctionSetPrototype(GlobalRegExp, GlobalRegExpPrototype);
|
| %AddNamedProperty(
|
| GlobalRegExp.prototype, 'constructor', GlobalRegExp, DONT_ENUM);
|
| %SetCode(GlobalRegExp, RegExpConstructor);
|
|
|