Bug 877287 - Disable running JS code when ion compiling. r=bhackett a=akeybl
authorKannan Vijayan <kvijayan@mozilla.com>
Mon, 17 Jun 2013 14:28:45 -0400
changeset 142902 ee9cc4f09fb6393d39b1676a4fe77c2921202e70
parent 142901 15c47873f860d90cba4b0933ced8158395689127
child 142903 17adfc82ed91a52e94136b2f57a941ec8b7244d4
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett, akeybl
bugs877287
milestone23.0a2
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
@@ -390,16 +390,22 @@ js::RunScript(JSContext *cx, StackFrame 
  * when done.  Then push the return value.
  */
 bool
 js::Invoke(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);
@@ -1036,16 +1042,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