Bug 1534840 part 1 - Add an assertion to check that we can generate contiguous jump tables. r=sstangl
authorNicolas B. Pierron <nicolas.b.pierron@nbp.name>
Tue, 16 Apr 2019 13:56:48 +0000
changeset 469670 4f54d68ba18e
parent 469669 639d0d388b96
child 469671 e024cb135284
push id35879
push usernerli@mozilla.com
push dateTue, 16 Apr 2019 22:01:48 +0000
treeherdermozilla-central@12a60898fdc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs1534840
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 1534840 part 1 - Add an assertion to check that we can generate contiguous jump tables. r=sstangl Depends on D26520 Differential Revision: https://phabricator.services.mozilla.com/D26521
js/src/jit/shared/IonAssemblerBufferWithConstantPools.h
--- a/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h
+++ b/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h
@@ -951,22 +951,25 @@ struct AssemblerBufferWithConstantPools
 
     // Include branches that would expire in the next N bytes.
     // The hysteresis avoids the needless creation of many tiny constant
     // pools.
     return this->nextOffset().getOffset() + ShortRangeBranchHysteresis >
            size_t(branchDeadlines_.earliestDeadline().getOffset());
   }
 
+  bool isPoolEmpty() const {
+    return pool_.numEntries() == 0 && !hasExpirableShortRangeBranches();
+  }
   void finishPool() {
     JitSpew(JitSpew_Pools,
             "[%d] Attempting to finish pool %zu with %u entries.", id,
             poolInfo_.length(), pool_.numEntries());
 
-    if (pool_.numEntries() == 0 && !hasExpirableShortRangeBranches()) {
+    if (isPoolEmpty()) {
       // If there is no data in the pool being dumped, don't dump anything.
       JitSpew(JitSpew_Pools, "[%d] Aborting because the pool is empty", id);
       return;
     }
 
     // Should not be placing a pool in a no-pool region, check.
     MOZ_ASSERT(!canNotPlacePool_);
 
@@ -1096,16 +1099,19 @@ struct AssemblerBufferWithConstantPools
   void enterNoNops() {
     MOZ_ASSERT(!inhibitNops_);
     inhibitNops_ = true;
   }
   void leaveNoNops() {
     MOZ_ASSERT(inhibitNops_);
     inhibitNops_ = false;
   }
+  void assertNoPoolAndNoNops() {
+    MOZ_ASSERT(inhibitNops_ && (isPoolEmpty() || canNotPlacePool_));
+  }
 
   void align(unsigned alignment) { align(alignment, alignFillInst_); }
 
   void align(unsigned alignment, uint32_t pattern) {
     MOZ_ASSERT(mozilla::IsPowerOfTwo(alignment));
     MOZ_ASSERT(alignment >= InstSize);
 
     // A pool many need to be dumped at this point, so insert NOP fill here.
@@ -1122,21 +1128,22 @@ struct AssemblerBufferWithConstantPools
     // dumped at the aligned code position.
     if (!hasSpaceForInsts(requiredFill / InstSize + 1, 0)) {
       // Alignment would cause a pool dump, so dump the pool now.
       JitSpew(JitSpew_Pools, "[%d] Alignment of %d at %zu caused a spill.", id,
               alignment, sizeExcludingCurrentPool());
       finishPool();
     }
 
+    bool prevInhibitNops = inhibitNops_;
     inhibitNops_ = true;
     while ((sizeExcludingCurrentPool() & (alignment - 1)) && !this->oom()) {
       putInt(pattern);
     }
-    inhibitNops_ = false;
+    inhibitNops_ = prevInhibitNops;
   }
 
  public:
   void executableCopy(uint8_t* dest) {
     if (this->oom()) {
       return;
     }
     // The pools should have all been flushed, check.