Bug 1433014 - Cancel off thread job if we fail to append it to job list r=luke
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 25 Jan 2018 17:12:47 +0000
changeset 400823 dba07e79c9a9225c82e7ab295dd32c26a9e6f0d4
parent 400822 df2586dc442d6b16ef0061d0461bd0189aad2451
child 400824 2115f173c005489509a2464ca85d1be4ea413cfe
push id99235
push userjcoppeard@mozilla.com
push dateThu, 25 Jan 2018 17:19:04 +0000
treeherdermozilla-inbound@dba07e79c9a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1433014
milestone60.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 1433014 - Cancel off thread job if we fail to append it to job list r=luke
js/src/jit-test/tests/parser/bug-1433014.js
js/src/shell/js.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/parser/bug-1433014.js
@@ -0,0 +1,8 @@
+if (helperThreadCount() === 0)
+    quit();
+
+options('strict');
+evaluate(`
+    oomTest(() => {
+        offThreadCompileScript("");
+    });`);
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -266,16 +266,17 @@ static OffThreadJob*
 NewOffThreadJob(JSContext* cx, ScriptKind kind, OffThreadJob::Source&& source)
 {
     ShellContext* sc = GetShellContext(cx);
     UniquePtr<OffThreadJob> job(cx->new_<OffThreadJob>(sc, kind, Move(source)));
     if (!job)
         return nullptr;
 
     if (!sc->offThreadJobs.append(job.get())) {
+        job->cancel();
         JS_ReportErrorASCII(cx, "OOM adding off-thread job");
         return nullptr;
     }
 
     return job.release();
 }
 
 static OffThreadJob*