Index: src/js/regexp.js |
diff --git a/src/js/regexp.js b/src/js/regexp.js |
index a456952ef37ba6ee5797f546256f904e551ec900..f4c6f8a6cee8c09c00e2551be127ae42677e0567 100644 |
--- a/src/js/regexp.js |
+++ b/src/js/regexp.js |
@@ -278,8 +278,11 @@ function RegExpToString() { |
%IncrementUseCounter(kRegExpPrototypeToString); |
return '/(?:)/'; |
} |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'RegExp.prototype.toString', this); |
+ if (!IS_RECEIVER(this)) { |
+ throw MakeTypeError( |
+ kIncompatibleMethodReceiver, 'RegExp.prototype.toString', this); |
+ } |
+ return '/' + TO_STRING(this.pattern()) + '/' + TO_STRING(this.flags()); |
} |
var result = '/' + REGEXP_SOURCE(this) + '/'; |
if (REGEXP_GLOBAL(this)) result += 'g'; |