Bug 1543034 - only call checkMagic in BaselineIC if diagnostic assert is enabled to prevent warning about unused variable. r=jonco
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 09 Apr 2019 10:05:26 +0000
changeset 468545 c59414352a98db6eec0634e793597c53cdf6d2ee
parent 468544 b9eca305e29f77fb91a772e7005f16bda9004f54
child 468546 7f7030e4c60dd6e44c811c2969c158095cba4536
push id112733
push usercsabou@mozilla.com
push dateTue, 09 Apr 2019 16:30:22 +0000
treeherdermozilla-inbound@e14dba56bbfd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1543034
milestone68.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 1543034 - only call checkMagic in BaselineIC if diagnostic assert is enabled to prevent warning about unused variable. r=jonco Differential Revision: https://phabricator.services.mozilla.com/D26686
js/src/jit/BaselineIC.cpp
js/src/jit/BaselineIC.h
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -580,18 +580,19 @@ bool ICStub::makesGCCalls() const {
 void ICStub::updateCode(JitCode* code) {
   // Write barrier on the old code.
   JitCode::writeBarrierPre(jitCode());
   stubCode_ = code->raw();
 }
 
 /* static */
 void ICStub::trace(JSTracer* trc) {
+#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
   checkTraceMagic();
-
+#endif
   // Fallback stubs use runtime-wide trampoline code we don't need to trace.
   if (!usesTrampolineCode()) {
     JitCode* stubJitCode = jitCode();
     TraceManuallyBarrieredEdge(trc, &stubJitCode, "baseline-ic-stub-code");
   }
 
   // If the stub is a monitored fallback stub, then trace the monitor ICs
   // hanging off of that stub.  We don't need to worry about the regular
@@ -985,17 +986,19 @@ void ICFallbackStub::unlinkStub(Zone* zo
     // pointer when purgeOptimizedStubs destroys all optimized monitor
     // stubs (unlinked stubs won't be updated).
     ICTypeMonitor_Fallback* monitorFallback =
         toMonitoredFallbackStub()->maybeFallbackMonitorStub();
     MOZ_ASSERT(monitorFallback);
     stub->toMonitoredStub()->resetFirstMonitorStub(monitorFallback);
   }
 
+#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
   stub->checkTraceMagic();
+#endif
 #ifdef DEBUG
   // Poison stub code to ensure we don't call this stub again. However, if
   // this stub can make calls, a pointer to it may be stored in a stub frame
   // on the stack, so we can't touch the stubCode_ or GC will crash when
   // tracing this pointer.
   if (!stub->makesGCCalls()) {
     stub->stubCode_ = (uint8_t*)0xbad;
   }
--- a/js/src/jit/BaselineIC.h
+++ b/js/src/jit/BaselineIC.h
@@ -591,20 +591,22 @@ class ICStub {
     return (Trait)((traitKindBits_ >> TRAIT_OFFSET) & TRAIT_MASK);
   }
 
   inline void setTraitKind(Trait trait, Kind kind) {
     traitKindBits_ = (trait << TRAIT_OFFSET) | (kind << KIND_OFFSET) |
                      (EXPECTED_MAGIC << MAGIC_OFFSET);
   }
 
+#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
   inline void checkTraceMagic() {
     uint16_t magic = (traitKindBits_ >> MAGIC_OFFSET) & MAGIC_MASK;
     MOZ_DIAGNOSTIC_ASSERT(magic == EXPECTED_MAGIC);
   }
+#endif
 
  public:
   inline Kind kind() const {
     return (Kind)((traitKindBits_ >> KIND_OFFSET) & KIND_MASK);
   }
 
   inline bool isFallback() const {
     return trait() == Fallback || trait() == MonitoredFallback;