[INFER] Add missing monitor() call in stubs::Eval, bug 663910.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 15 Jun 2011 12:20:13 -0700
changeset 75164 7eec66369bfab7064f77866795b4432ff2d5cf35
parent 75163 0767b119a1c8aa09216db8d347d06ae28cf87de8
child 75165 2993dfa0ce4d40f0faf22dca70f96d22c51b34a2
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs663910
milestone7.0a1
[INFER] Add missing monitor() call in stubs::Eval, bug 663910.
js/src/jit-test/tests/jaeger/bug663910.js
js/src/methodjit/InvokeHelpers.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/bug663910.js
@@ -0,0 +1,22 @@
+var otherGlobalSameCompartment = newGlobal("same-compartment");
+eval = otherGlobalSameCompartment.eval;
+doesNotNeedParens(1, "if (xx) { }");
+needParens(2, "if (1, xx) { }");
+function doesNotNeedParens(section, pat) {
+    try {
+        f = new Function
+    } catch (e) {}
+    roundTripTest(section, f)
+}
+function needParens(section, pat, exp) {
+    var f, ft;
+    roundTripTest(section, f, exp)
+}
+function roundTripTest(section, f, exp) {
+    uf = "" + f
+    var euf;
+    try {
+      euf = eval("(" + uf + ")");
+    } catch (e) { }
+    + euf
+}
--- a/js/src/methodjit/InvokeHelpers.cpp
+++ b/js/src/methodjit/InvokeHelpers.cpp
@@ -434,16 +434,18 @@ stubs::UncachedCall(VMFrame &f, uint32 a
 void JS_FASTCALL
 stubs::Eval(VMFrame &f, uint32 argc)
 {
     Value *vp = f.regs.sp - (argc + 2);
 
     if (!IsBuiltinEvalForScope(&f.fp()->scopeChain(), *vp)) {
         if (!Invoke(f.cx, InvokeArgsAlreadyOnTheStack(argc, vp)))
             THROW();
+
+        f.script()->types.monitor(f.cx, f.pc(), vp[0]);
         return;
     }
 
     JS_ASSERT(f.fp() == f.cx->fp());
     if (!DirectEval(f.cx, CallArgsFromVp(argc, vp)))
         THROW();
 
     f.script()->types.monitor(f.cx, f.pc(), vp[0]);