Bug 1641469 part 3 - Add Ion IC stubs at the front of the chain too. r=iain
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 29 May 2020 02:32:57 +0000
changeset 532946 d9c90baa217a733a88d2cba1125175635ee144f4
parent 532945 0117bc73a8641b7cdb254f0b1bd14a4d388777d6
child 532947 2a57e124f45d956cab265383d56c8466f3403e77
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 3 - Add Ion IC stubs at the front of the chain too. r=iain This matters less but is for consistency with Baseline ICs. Note that Ion ICs don't have a fallback stub like Baseline. Instead, the last stub's nextCodeRaw_ is a pointer to the fallback code in the IonScript. This gets initialized when the stub is allocated. Depends on D77240 Differential Revision: https://phabricator.services.mozilla.com/D77241
js/src/jit/IonIC.cpp
js/src/jit/IonIC.h
--- a/js/src/jit/IonIC.cpp
+++ b/js/src/jit/IonIC.cpp
@@ -732,20 +732,15 @@ uint8_t* IonICStub::stubDataStart() {
   return reinterpret_cast<uint8_t*>(this) + stubInfo_->stubDataOffset();
 }
 
 void IonIC::attachStub(IonICStub* newStub, JitCode* code) {
   MOZ_ASSERT(newStub);
   MOZ_ASSERT(code);
 
   if (firstStub_) {
-    IonICStub* last = firstStub_;
-    while (IonICStub* next = last->next()) {
-      last = next;
-    }
-    last->setNext(newStub, code);
-  } else {
-    firstStub_ = newStub;
-    codeRaw_ = code->raw();
+    newStub->setNext(firstStub_, codeRaw_);
   }
+  firstStub_ = newStub;
+  codeRaw_ = code->raw();
 
   state_.trackAttached();
 }
--- a/js/src/jit/IonIC.h
+++ b/js/src/jit/IonIC.h
@@ -33,21 +33,21 @@ class IonICStub {
 
   uint8_t* nextCodeRaw() const { return nextCodeRaw_; }
   uint8_t** nextCodeRawPtr() { return &nextCodeRaw_; }
   CacheIRStubInfo* stubInfo() const { return stubInfo_; }
   IonICStub* next() const { return next_; }
 
   uint8_t* stubDataStart();
 
-  void setNext(IonICStub* next, JitCode* nextCode) {
+  void setNext(IonICStub* next, uint8_t* nextCodeRaw) {
     MOZ_ASSERT(!next_);
-    MOZ_ASSERT(next && nextCode);
+    MOZ_ASSERT(next && nextCodeRaw);
     next_ = next;
-    nextCodeRaw_ = nextCode->raw();
+    nextCodeRaw_ = nextCodeRaw;
   }
 
   // Null out pointers when we unlink stubs, to ensure we never use
   // discarded stubs.
   void poison() {
     nextCodeRaw_ = nullptr;
     next_ = nullptr;
     stubInfo_ = nullptr;