Merge inbound to mozilla-central. a=merge
authorMargareta Eliza Balazs <ebalazs@mozilla.com>
Mon, 19 Nov 2018 11:28:37 +0200
changeset 446949 e44bb5b4bc79
parent 446946 88ba9f723934 (current diff)
parent 446948 20c99b0e8e4e (diff)
child 446950 5f31d040aab4
child 446961 51587462b49f
push id35062
push userebalazs@mozilla.com
push dateMon, 19 Nov 2018 09:29:21 +0000
treeherdermozilla-central@e44bb5b4bc79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone65.0a1
first release with
nightly linux32
e44bb5b4bc79 / 65.0a1 / 20181119100448 / files
nightly linux64
e44bb5b4bc79 / 65.0a1 / 20181119100448 / files
nightly mac
e44bb5b4bc79 / 65.0a1 / 20181119100448 / files
nightly win32
e44bb5b4bc79 / 65.0a1 / 20181119100448 / files
nightly win64
e44bb5b4bc79 / 65.0a1 / 20181119100448 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
--- a/gfx/layers/wr/AsyncImagePipelineManager.cpp
+++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ -165,17 +165,17 @@ AsyncImagePipelineManager::AddAsyncImage
   }
   MOZ_ASSERT(aImageHost);
   uint64_t id = wr::AsUint64(aPipelineId);
 
   MOZ_ASSERT(!mAsyncImagePipelines.Get(id));
   AsyncImagePipeline* holder = new AsyncImagePipeline();
   holder->mImageHost = aImageHost;
   mAsyncImagePipelines.Put(id, holder);
-  AddPipeline(aPipelineId);
+  AddPipeline(aPipelineId, /* aWrBridge */ nullptr);
 }
 
 void
 AsyncImagePipelineManager::RemoveAsyncImagePipeline(const wr::PipelineId& aPipelineId, wr::TransactionBuilder& aTxn)
 {
   if (mDestroyed) {
     return;
   }
--- a/gfx/layers/wr/AsyncImagePipelineManager.h
+++ b/gfx/layers/wr/AsyncImagePipelineManager.h
@@ -42,17 +42,17 @@ public:
   explicit AsyncImagePipelineManager(already_AddRefed<wr::WebRenderAPI>&& aApi);
 
 protected:
   ~AsyncImagePipelineManager();
 
 public:
   void Destroy();
 
-  void AddPipeline(const wr::PipelineId& aPipelineId, WebRenderBridgeParent* aWrBridge = nullptr);
+  void AddPipeline(const wr::PipelineId& aPipelineId, WebRenderBridgeParent* aWrBridge);
   void RemovePipeline(const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch);
   WebRenderBridgeParent* GetWrBridge(const wr::PipelineId& aPipelineId);
 
   void HoldExternalImage(const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch, WebRenderTextureHost* aTexture);
   void HoldExternalImage(const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch, WebRenderTextureHostWrapper* aWrTextureWrapper);
   void HoldExternalImage(const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch, const wr::ExternalImageId& aImageId);
 
   // This is called from the Renderer thread to notify this class about the
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1527,17 +1527,17 @@ WebRenderBridgeParent::UpdateWebRender(C
   ClearResources();
   mCompositorBridge = cBridge;
   mCompositorScheduler = aScheduler;
   mApi = aApi;
   mAsyncImageManager = aImageMgr;
   mAnimStorage = aAnimStorage;
 
   // Register pipeline to updated AsyncImageManager.
-  mAsyncImageManager->AddPipeline(mPipelineId);
+  mAsyncImageManager->AddPipeline(mPipelineId, this);
 
   return GetNextWrEpoch(); // Update webrender epoch
 }
 
 mozilla::ipc::IPCResult
 WebRenderBridgeParent::RecvScheduleComposite()
 {
   ScheduleGenerateFrame();
--- a/js/public/Utility.h
+++ b/js/public/Utility.h
@@ -137,32 +137,34 @@ class FailureSimulator
     enum class Kind : uint8_t { Nothing, OOM, StackOOM, Interrupt };
 
   private:
     Kind kind_ = Kind::Nothing;
     uint32_t targetThread_ = 0;
     uint64_t maxChecks_ = UINT64_MAX;
     uint64_t counter_ = 0;
     bool failAlways_ = true;
+    bool inUnsafeRegion_ = false;
 
   public:
     uint64_t maxChecks() const {
         return maxChecks_;
     }
-    void setMaxChecks(uint64_t value) {
-        maxChecks_ = value;
-    }
     uint64_t counter() const {
         return counter_;
     }
+    void setInUnsafeRegion(bool b) {
+        MOZ_ASSERT(inUnsafeRegion_ != b);
+        inUnsafeRegion_ = b;
+    }
     uint32_t targetThread() const {
         return targetThread_;
     }
     bool isThreadSimulatingAny() const {
-        return targetThread_ && targetThread_ == js::oom::GetThreadType();
+        return targetThread_ && targetThread_ == js::oom::GetThreadType() && !inUnsafeRegion_;
     }
     bool isThreadSimulating(Kind kind) const {
         return kind_ == kind && isThreadSimulatingAny();
     }
     bool isSimulatedFailure(Kind kind) const {
         if (!isThreadSimulating(kind)) {
             return false;
         }
@@ -314,45 +316,36 @@ struct MOZ_RAII JS_PUBLIC_DATA(AutoEnter
     using AnnotateOOMAllocationSizeCallback = void(*)(size_t);
     static AnnotateOOMAllocationSizeCallback annotateOOMSizeCallback;
     static void setAnnotateOOMAllocationSizeCallback(AnnotateOOMAllocationSizeCallback callback) {
         annotateOOMSizeCallback = callback;
     }
 
 #if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
     AutoEnterOOMUnsafeRegion()
-      : oomEnabled_(oom::simulator.isThreadSimulatingAny() &&
-                    oom::simulator.maxChecks() != UINT64_MAX),
-        oomAfter_(0)
+      : oomEnabled_(oom::simulator.isThreadSimulatingAny())
     {
         if (oomEnabled_) {
             MOZ_ALWAYS_TRUE(owner_.compareExchange(nullptr, this));
-            oomAfter_ = (int64_t(oom::simulator.maxChecks()) -
-                         int64_t(oom::simulator.counter()));
-            oom::simulator.setMaxChecks(UINT64_MAX);
+            oom::simulator.setInUnsafeRegion(true);
         }
     }
 
     ~AutoEnterOOMUnsafeRegion() {
         if (oomEnabled_) {
-            MOZ_ASSERT(oom::simulator.maxChecks() == UINT64_MAX);
-            int64_t maxChecks = int64_t(oom::simulator.counter()) + oomAfter_;
-            MOZ_ASSERT(maxChecks >= 0,
-                       "alloc count + oom limit exceeds range, your oom limit is probably too large");
-            oom::simulator.setMaxChecks(maxChecks);
+            oom::simulator.setInUnsafeRegion(false);
             MOZ_ALWAYS_TRUE(owner_.compareExchange(this, nullptr));
         }
     }
 
   private:
     // Used to catch concurrent use from other threads.
     static mozilla::Atomic<AutoEnterOOMUnsafeRegion*> owner_;
 
     bool oomEnabled_;
-    int64_t oomAfter_;
 #endif
 };
 
 } /* namespace js */
 
 // Malloc allocation.
 
 namespace js {
--- a/js/src/jit-test/tests/modules/dynamic-import-oom.js
+++ b/js/src/jit-test/tests/modules/dynamic-import-oom.js
@@ -1,4 +1,7 @@
-// |jit-test| skip-if: !('oomTest' in this)
+// |jit-test| skip-if: !('oomTest' in this); --ion-offthread-compile=off
+//
+// Note: without --ion-offthread-compile=off this test takes a long time and
+// may timeout on some platforms. See bug 1507721.
 
 oomTest(() => import("module1.js"));
 oomTest(() => import("cyclicImport1.js"));