Bug 1505689 part 3 - Clean up lazy linking code a bit, remove ION_PENDING_SCRIPT. r=tcampbell
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 15 Aug 2019 16:13:41 +0000
changeset 488275 515f936e0df687205b4c99fa0c4c0aba9e1d0dde
parent 488274 c437f2caa6d04b33e445d6defcb49a0b8e882e1b
child 488276 257f973566ba9b0331af6858092345cce9832b34
push id113906
push userncsoregi@mozilla.com
push dateFri, 16 Aug 2019 04:07:24 +0000
treeherdermozilla-inbound@d887276421d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1505689
milestone70.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 1505689 part 3 - Clean up lazy linking code a bit, remove ION_PENDING_SCRIPT. r=tcampbell ION_PENDING_SCRIPT didn't add anything over setting |ion| to nullptr. Differential Revision: https://phabricator.services.mozilla.com/D41575
js/src/jit/BaselineJIT.h
js/src/vm/JSScript.h
--- a/js/src/jit/BaselineJIT.h
+++ b/js/src/jit/BaselineJIT.h
@@ -375,29 +375,32 @@ struct BaselineScript final {
 
   js::jit::IonBuilder* pendingIonBuilder() {
     MOZ_ASSERT(hasPendingIonBuilder());
     return pendingBuilder_;
   }
   void setPendingIonBuilder(JSRuntime* rt, JSScript* script,
                             js::jit::IonBuilder* builder) {
     MOZ_ASSERT(script->baselineScript() == this);
-    MOZ_ASSERT(!builder || !hasPendingIonBuilder());
+    MOZ_ASSERT(builder);
+    MOZ_ASSERT(!hasPendingIonBuilder());
 
     if (script->isIonCompilingOffThread()) {
-      script->setHasPendingIonScript(rt);
+      script->clearIsIonCompilingOffThread(rt);
     }
 
     pendingBuilder_ = builder;
-
     script->updateJitCodeRaw(rt);
   }
   void removePendingIonBuilder(JSRuntime* rt, JSScript* script) {
-    setPendingIonBuilder(rt, script, nullptr);
-    script->clearHasPendingIonScript(rt);
+    MOZ_ASSERT(script->baselineScript() == this);
+    MOZ_ASSERT(hasPendingIonBuilder());
+
+    pendingBuilder_ = nullptr;
+    script->updateJitCodeRaw(rt);
   }
 
   size_t allocBytes() const { return allocBytes_; }
 };
 static_assert(
     sizeof(BaselineScript) % sizeof(uintptr_t) == 0,
     "The data attached to the script must be aligned for fast JIT access.");
 
--- a/js/src/vm/JSScript.h
+++ b/js/src/vm/JSScript.h
@@ -58,17 +58,16 @@ namespace jit {
 class AutoKeepJitScripts;
 struct BaselineScript;
 struct IonScriptCounts;
 class JitScript;
 }  // namespace jit
 
 #define ION_DISABLED_SCRIPT ((js::jit::IonScript*)0x1)
 #define ION_COMPILING_SCRIPT ((js::jit::IonScript*)0x2)
-#define ION_PENDING_SCRIPT ((js::jit::IonScript*)0x3)
 
 #define BASELINE_DISABLED_SCRIPT ((js::jit::BaselineScript*)0x1)
 
 class AutoSweepJitScript;
 class GCParallelTask;
 class LazyScript;
 class ModuleObject;
 class RegExpObject;
@@ -2280,19 +2279,17 @@ class JSScript : public js::BaseScript {
   JS::Realm* realm_ = nullptr;
 
  private:
   // JIT and type inference data for this script. May be purged on GC.
   js::jit::JitScript* jitScript_ = nullptr;
 
   /*
    * Information attached by Ion. Nexto a valid IonScript this could be
-   * ION_DISABLED_SCRIPT, ION_COMPILING_SCRIPT or ION_PENDING_SCRIPT.
-   * The later is a ion compilation that is ready, but hasn't been linked
-   * yet.
+   * ION_DISABLED_SCRIPT or ION_COMPILING_SCRIPT.
    */
   js::jit::IonScript* ion = nullptr;
 
   /* Information attached by Baseline. */
   js::jit::BaselineScript* baseline = nullptr;
 
   /* Information used to re-lazify a lazily-parsed interpreted function. */
   js::LazyScript* lazyScript = nullptr;
@@ -2606,18 +2603,17 @@ class JSScript : public js::BaseScript {
   // Methods to set |ion| to an IonScript*, nullptr, or one of the special
   // ION_{DISABLED,COMPILING,PENDING}_SCRIPT values.
   void setIonScriptImpl(JSFreeOp* fop, js::jit::IonScript* ionScript);
   void setIonScriptImpl(JSRuntime* rt, js::jit::IonScript* ionScript);
 
  public:
   // Methods for getting/setting/clearing an IonScript*.
   bool hasIonScript() const {
-    bool res = ion && ion != ION_DISABLED_SCRIPT &&
-               ion != ION_COMPILING_SCRIPT && ion != ION_PENDING_SCRIPT;
+    bool res = ion && ion != ION_DISABLED_SCRIPT && ion != ION_COMPILING_SCRIPT;
     MOZ_ASSERT_IF(res, baseline);
     return res;
   }
   js::jit::IonScript* ionScript() const {
     MOZ_ASSERT(hasIonScript());
     return ion;
   }
   void setIonScript(JSRuntime* rt, js::jit::IonScript* ionScript) {
@@ -2640,28 +2636,16 @@ class JSScript : public js::BaseScript {
     MOZ_ASSERT(!ion);
     setIonScriptImpl(rt, ION_COMPILING_SCRIPT);
   }
   void clearIsIonCompilingOffThread(JSRuntime* rt) {
     MOZ_ASSERT(isIonCompilingOffThread());
     setIonScriptImpl(rt, nullptr);
   }
 
-  // Methods for lazy linking after off-thread compilation. In this case the
-  // BaselineScript has a pending builder that is linked by the lazy link stub.
-  void setHasPendingIonScript(JSRuntime* rt) {
-    MOZ_ASSERT(isIonCompilingOffThread());
-    setIonScriptImpl(rt, ION_PENDING_SCRIPT);
-  }
-  void clearHasPendingIonScript(JSRuntime* rt) {
-    if (ion == ION_PENDING_SCRIPT) {
-      setIonScriptImpl(rt, nullptr);
-    }
-  }
-
  private:
   // Methods to set |baseline| to a BaselineScript*, nullptr, or
   // BASELINE_DISABLED_SCRIPT.
   void setBaselineScriptImpl(JSRuntime* rt,
                              js::jit::BaselineScript* baselineScript);
   void setBaselineScriptImpl(JSFreeOp* fop,
                              js::jit::BaselineScript* baselineScript);