Bug 1536159 - Crash diagnositic for js::TypeZone::addPendingRecompile. r=jwalden a=pascalc
☠☠ backed out by 92601d63125e ☠ ☠
authorTed Campbell <tcampbell@mozilla.com>
Mon, 01 Apr 2019 22:33:12 +0000
changeset 526114 1452b03b01d45740bd3f54a15f95360fcc0597a5
parent 526113 6a427ed74d6533bde36358c434af42d5da67b891
child 526115 11ddfc9bd642f08e487fb76d23b7626f0b179e58
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden, pascalc
bugs1536159
milestone67.0
Bug 1536159 - Crash diagnositic for js::TypeZone::addPendingRecompile. r=jwalden a=pascalc Record the size of allocation in crashreporter to determine if these are genuine small OOM or if something problematic has happened. Differential Revision: https://phabricator.services.mozilla.com/D25152
js/src/vm/TypeInference.cpp
--- a/js/src/vm/TypeInference.cpp
+++ b/js/src/vm/TypeInference.cpp
@@ -2704,18 +2704,24 @@ void TypeZone::processPendingRecompiles(
   MOZ_ASSERT(recompiles.empty());
 }
 
 void TypeZone::addPendingRecompile(JSContext* cx, const RecompileInfo& info) {
   InferSpew(ISpewOps, "addPendingRecompile: %p:%s:%u", info.script(),
             info.script()->filename(), info.script()->lineno());
 
   AutoEnterOOMUnsafeRegion oomUnsafe;
-  if (!cx->zone()->types.activeAnalysis->pendingRecompiles.append(info)) {
-    oomUnsafe.crash("Could not update pendingRecompiles");
+  RecompileInfoVector& vector =
+      cx->zone()->types.activeAnalysis->pendingRecompiles;
+  if (!vector.append(info)) {
+    // BUG 1536159: For diagnostics, compute the size of the failed allocation.
+    // This presumes the vector growth strategy is to double. This is only used
+    // for crash reporting so not a problem if we get it wrong.
+    size_t allocSize = 2 * sizeof(RecompileInfo) * vector.capacity();
+    oomUnsafe.crash(allocSize, "Could not update pendingRecompiles");
   }
 }
 
 void TypeZone::addPendingRecompile(JSContext* cx, JSScript* script) {
   MOZ_ASSERT(script);
 
   CancelOffThreadIonCompile(script);