Bug 877287 - Disable running JS code when ion compiling. r=bhackett a=akeybl RELEASE_BASE_20130617
authorKannan Vijayan <kvijayan@mozilla.com>
Mon, 17 Jun 2013 14:41:32 -0400
changeset 137793 9f0d4fe5db553e5de61ff6652549feb862607ef2
parent 137792 5499cb8546845453a2ee2235ac05bab9cbc20caa
child 137794 73fa5e863ace6d1e3eac71de27df2e7bfe5726a2
child 137796 44d3ce86a7242fd953202f962a57a3126ba0fa88
child 137798 af3011f1cccb7f31f3fe4713d37967c5ba15afdc
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersbhackett, akeybl
bugs877287
milestone22.0
Bug 877287 - Disable running JS code when ion compiling. r=bhackett a=akeybl
js/src/jsinterp.cpp
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -348,16 +348,22 @@ js::RunScript(JSContext *cx, StackFrame 
  * when done.  Then push the return value.
  */
 bool
 js::InvokeKernel(JSContext *cx, CallArgs args, MaybeConstruct construct)
 {
     JS_ASSERT(args.length() <= StackSpace::ARGS_LENGTH_MAX);
     JS_ASSERT(!cx->compartment->activeAnalysis);
 
+    // Never allow execution of JS code when compiling.
+    if (cx->compartment->activeAnalysis) {
+        JS_ReportError(cx, "Can't run scripts during analysis.");
+        return false;
+    }
+
     /* We should never enter a new script while cx->iterValue is live. */
     JS_ASSERT(cx->iterValue.isMagic(JS_NO_ITER_VALUE));
 
     /* MaybeConstruct is a subset of InitialFrameFlags */
     InitialFrameFlags initial = (InitialFrameFlags) construct;
 
     if (args.calleev().isPrimitive())
         return ReportIsNotFunction(cx, args.calleev().get(), args.length() + 1, construct);
@@ -1007,16 +1013,22 @@ js::Interpret(JSContext *cx, StackFrame 
 {
     JSAutoResolveFlags rf(cx, RESOLVE_INFER);
 
     if (interpMode == JSINTERP_NORMAL)
         gc::MaybeVerifyBarriers(cx, true);
 
     JS_ASSERT(!cx->compartment->activeAnalysis);
 
+    // Never allow execution of JS code when compiling.
+    if (cx->compartment->activeAnalysis) {
+        JS_ReportError(cx, "Can't run scripts during analysis.");
+        return Interpret_Error;
+    }
+
 #define CHECK_PCCOUNT_INTERRUPTS() JS_ASSERT_IF(script->hasScriptCounts, switchMask == -1)
 
     register int switchMask = 0;
     int switchOp;
     typedef GenericInterruptEnabler<int> InterruptEnabler;
     InterruptEnabler interrupts(&switchMask, -1);
 
 # define DO_OP()            goto do_op