commit 3fc985a858eb49c1e51f4b1ee763af52ca94f70e
parent 91721a390fcffde5d6e7da27c98fbc3829ab6560
Author: Bryan Thrall <bthrall@mozilla.com>
Date: Wed, 7 Jan 2026 15:00:03 +0000
Bug 2007231 - Avoid AttachFinishedCompilations in HandleInterrupt while handling exceptions r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D277884
Diffstat:
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/js/src/jit-test/tests/bug2007231.js b/js/src/jit-test/tests/bug2007231.js
@@ -0,0 +1,5 @@
+// |jit-test|
+
+setJitCompilerOption("offthread-compilation.enable", 1);
+for (let i = 0; i < 99; i++) {};
+oomTest(Iterator.prototype.map, { keepFailing: true });
diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp
@@ -400,14 +400,17 @@ static bool HandleInterrupt(JSContext* cx, bool invokeCallback,
cx->runtime()->gc.gcIfRequested();
- // A worker thread may have requested an interrupt after finishing an
- // offthread compilation.
- jit::AttachFinishedCompilations(cx);
-
if (oomStackTrace) {
// Capture OOM stack trace this way because we don't have memory to handle
// it the way ComputeStackString does.
cx->captureOOMStackTrace();
+ } else {
+ // We can handle OOM interrupts while handling exceptions, when it isn't
+ // safe to attach finished compilations
+
+ // A worker thread may have requested an interrupt after finishing an
+ // offthread compilation.
+ jit::AttachFinishedCompilations(cx);
}
// Don't call the interrupt callback if we only interrupted for GC, Ion, or