Bug 1641469 part 2 - Some ICFallbackStub cleanup and dead code removal. r=iain
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 29 May 2020 02:32:56 +0000
changeset 532945 0117bc73a8641b7cdb254f0b1bd14a4d388777d6
parent 532944 f9470da46b897ee82cedfac9566e2483e58b9a70
child 532946 d9c90baa217a733a88d2cba1125175635ee144f4
push id37460
push userbtara@mozilla.com
push dateFri, 29 May 2020 15:59:09 +0000
treeherdermozilla-central@60a406d3b53a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersiain
bugs1641469
milestone78.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 1641469 part 2 - Some ICFallbackStub cleanup and dead code removal. r=iain Depends on D77239 Differential Revision: https://phabricator.services.mozilla.com/D77240
js/src/jit/BaselineIC.cpp
js/src/jit/BaselineIC.h
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -839,24 +839,16 @@ void ICFallbackStub::unlinkStub(Zone* zo
   // 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;
   }
 #endif
 }
 
-void ICFallbackStub::unlinkStubsWithKind(JSContext* cx, ICStub::Kind kind) {
-  for (ICStubIterator iter = beginChain(); !iter.atEnd(); iter++) {
-    if (iter->kind() == kind) {
-      iter.unlink(cx);
-    }
-  }
-}
-
 void ICFallbackStub::discardStubs(JSContext* cx) {
   for (ICStubIterator iter = beginChain(); !iter.atEnd(); iter++) {
     iter.unlink(cx);
   }
 }
 
 void ICTypeMonitor_Fallback::resetMonitorStubChain(Zone* zone) {
   if (zone->needsIncrementalBarrier()) {
--- a/js/src/jit/BaselineIC.h
+++ b/js/src/jit/BaselineIC.h
@@ -644,39 +644,33 @@ class ICStub {
 
 class ICFallbackStub : public ICStub {
   friend class ICStubConstIterator;
 
  protected:
   // Fallback stubs need these fields to easily add new stubs to
   // the linked list of stubs for an IC.
 
-  // The IC entry for this linked list of stubs.
-  ICEntry* icEntry_;
+  // The IC entry in JitScript for this linked list of stubs.
+  ICEntry* icEntry_ = nullptr;
 
   // The state of this IC
-  ICState state_;
+  ICState state_{};
 
   // Counts the number of times the stub was entered
   //
   // See Bug 1494473 comment 6 for a mechanism to handle overflow if overflow
   // becomes a concern.
-  uint32_t enteredCount_;
+  uint32_t enteredCount_ = 0;
 
   ICFallbackStub(Kind kind, TrampolinePtr stubCode)
-      : ICStub(kind, ICStub::Fallback, stubCode.value),
-        icEntry_(nullptr),
-        state_(),
-        enteredCount_(0) {}
+      : ICStub(kind, ICStub::Fallback, stubCode.value) {}
 
   ICFallbackStub(Kind kind, Trait trait, TrampolinePtr stubCode)
-      : ICStub(kind, trait, stubCode.value),
-        icEntry_(nullptr),
-        state_(),
-        enteredCount_(0) {
+      : ICStub(kind, trait, stubCode.value) {
     MOZ_ASSERT(trait == ICStub::Fallback || trait == ICStub::MonitoredFallback);
   }
 
  public:
   inline ICEntry* icEntry() const { return icEntry_; }
 
   inline size_t numOptimizedStubs() const { return state_.numOptimizedStubs(); }
 
@@ -699,39 +693,19 @@ class ICFallbackStub : public ICStub {
   }
 
   ICStubConstIterator beginChainConst() const {
     return ICStubConstIterator(icEntry_->firstStub());
   }
 
   ICStubIterator beginChain() { return ICStubIterator(this); }
 
-  bool hasStub(ICStub::Kind kind) const {
-    for (ICStubConstIterator iter = beginChainConst(); !iter.atEnd(); iter++) {
-      if (iter->kind() == kind) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  unsigned numStubsWithKind(ICStub::Kind kind) const {
-    unsigned count = 0;
-    for (ICStubConstIterator iter = beginChainConst(); !iter.atEnd(); iter++) {
-      if (iter->kind() == kind) {
-        count++;
-      }
-    }
-    return count;
-  }
-
   void discardStubs(JSContext* cx);
 
   void unlinkStub(Zone* zone, ICStub* prev, ICStub* stub);
-  void unlinkStubsWithKind(JSContext* cx, ICStub::Kind kind);
 
   // Return the number of times this stub has successfully provided a value to
   // the caller.
   uint32_t enteredCount() const { return enteredCount_; }
   inline void incrementEnteredCount() { enteredCount_++; }
   void resetEnteredCount() { enteredCount_ = 0; }
 };