Bug 935228 - Toggle debug traps only in debug mode. (r=jandem)
☠☠ backed out by 4e3a84277bd2 ☠ ☠
authorShu-yu Guo <shu@rfrn.org>
Tue, 12 Nov 2013 10:51:10 -0800
changeset 169185 fe63bf2c6a3ae7505ff65eb8e945f5f15f3080e4
parent 169184 b8d3be6e3c1a06c98c3c0c1e2ca6d22d1f99e184
child 169186 5e6899ab5ead422bcb4fa678c0320bee6a6ef421
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs935228
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 935228 - Toggle debug traps only in debug mode. (r=jandem)
js/src/jit/BaselineCompiler.cpp
js/src/jit/BaselineJIT.cpp
js/src/jit/BaselineJIT.h
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -246,16 +246,19 @@ BaselineCompiler::compile()
 
         JS_ASSERT(added == script->nTypeSets);
 
         // The last entry in the last index found, and is used to avoid binary
         // searches for the sought entry when queries are in linear order.
         bytecodeMap[script->nTypeSets] = 0;
     }
 
+    if (script->compartment()->debugMode())
+        baselineScript->setDebugMode();
+
     return Method_Compiled;
 }
 
 bool
 BaselineCompiler::emitPrologue()
 {
     masm.push(BaselineFrameReg);
     masm.mov(BaselineStackReg, BaselineFrameReg);
--- a/js/src/jit/BaselineJIT.cpp
+++ b/js/src/jit/BaselineJIT.cpp
@@ -741,16 +741,20 @@ BaselineScript::pcForReturnAddress(JSScr
     return pcForReturnOffset(script, uint32_t(nativeAddress - method_->raw()));
 }
 
 void
 BaselineScript::toggleDebugTraps(JSScript *script, jsbytecode *pc)
 {
     JS_ASSERT(script->baselineScript() == this);
 
+    // Only scripts compiled for debug mode have toggled calls.
+    if (!debugMode())
+        return;
+
     SrcNoteLineScanner scanner(script->notes(), script->lineno);
 
     JSRuntime *rt = script->runtimeFromMainThread();
     IonContext ictx(rt, script->compartment(), nullptr);
     AutoFlushCache afc("DebugTraps", rt->jitRuntime());
 
     for (uint32_t i = 0; i < numPCMappingIndexEntries(); i++) {
         PCMappingIndexEntry &entry = pcMappingIndexEntry(i);
--- a/js/src/jit/BaselineJIT.h
+++ b/js/src/jit/BaselineJIT.h
@@ -127,17 +127,21 @@ struct BaselineScript
         NEEDS_ARGS_OBJ = 1 << 0,
 
         // Flag set when discarding JIT code, to indicate this script is
         // on the stack and should not be discarded.
         ACTIVE = 1 << 1,
 
         // Flag set when the script contains any writes to its on-stack
         // (rather than call object stored) arguments.
-        MODIFIES_ARGUMENTS = 1 << 2
+        MODIFIES_ARGUMENTS = 1 << 2,
+
+        // Flag set when compiled for use for debug mode. Handles various
+        // Debugger hooks and compiles toggled calls for traps.
+        DEBUG_MODE = 1 << 3
     };
 
   private:
     uint32_t flags_;
 
   private:
     void trace(JSTracer *trc);
 
@@ -196,16 +200,23 @@ struct BaselineScript
 
     void setModifiesArguments() {
         flags_ |= MODIFIES_ARGUMENTS;
     }
     bool modifiesArguments() {
         return flags_ & MODIFIES_ARGUMENTS;
     }
 
+    void setDebugMode() {
+        flags_ |= DEBUG_MODE;
+    }
+    bool debugMode() const {
+        return flags_ & DEBUG_MODE;
+    }
+
     uint32_t prologueOffset() const {
         return prologueOffset_;
     }
     uint8_t *prologueEntryAddr() const {
         return method_->raw() + prologueOffset_;
     }
 
     ICEntry *icEntryList() {