summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/regexp-test-direct-bug-694752.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/basic/regexp-test-direct-bug-694752.js')
-rw-r--r--js/src/jit-test/tests/basic/regexp-test-direct-bug-694752.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/regexp-test-direct-bug-694752.js b/js/src/jit-test/tests/basic/regexp-test-direct-bug-694752.js
new file mode 100644
index 0000000000..7e0bae7dae
--- /dev/null
+++ b/js/src/jit-test/tests/basic/regexp-test-direct-bug-694752.js
@@ -0,0 +1,15 @@
+function whoo() {
+ // Cause mjit to use the script's RegExpObject directly when it compiles this function.
+ assertEq(/foo.*baz/.test('foobarbaz'), true);
+}
+
+var orig_test = RegExp.prototype.test
+for (var i = 0; i < 50; ++i)
+ whoo();
+eval('RegExp.prototype.test = function(str) { return orig_test.call(this, str) }')
+for (var i = 0; i < 50; ++i)
+ whoo();
+RegExp.prototype.test = orig_test;
+gc();
+whoo();
+