Bug 1380286 (follow-up) - Fix hazard bustage. r=bustage.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 25 Jul 2017 20:16:02 +1000
changeset 419568 4ce87710ff85998f8afcf821e961fe6ee03554bb
parent 419567 b0e703b451c1e5f4bae54b45992f1250a91ef8c7
child 419569 e33e38d61829005fe095310a1036cf90781eec26
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs1380286
milestone56.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 1380286 (follow-up) - Fix hazard bustage. r=bustage.
tools/profiler/core/platform.cpp
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -688,24 +688,25 @@ AddPseudoEntry(uint32_t aFeatures, NotNu
   int lineno = -1;
 
   // XXX: it's unclear why the computation of lineno should depend on
   // |dynamicString|. Perhaps it shouldn't?
 
   if (dynamicString) {
     bool isChromeJSEntry = false;
     if (entry.isJs()) {
-      JSScript* script = entry.script();
-      if (script) {
-        isChromeJSEntry = IsChromeJSScript(script);
+      // We call entry.script() repeatedly -- rather than storing the result in
+      // a local variable in order -- to avoid rooting hazards.
+      if (entry.script()) {
+        isChromeJSEntry = IsChromeJSScript(entry.script());
         if (!entry.pc()) {
           // The JIT only allows the top-most entry to have a nullptr pc.
           MOZ_ASSERT(&entry == &aRacyInfo->entries[aRacyInfo->stackSize() - 1]);
         } else {
-          lineno = JS_PCToLineNumber(script, entry.pc());
+          lineno = JS_PCToLineNumber(entry.script(), entry.pc());
         }
       }
     } else {
       lineno = entry.line();
     }
 
     // Adjust the dynamic string as necessary.
     if (ProfilerFeature::HasPrivacy(aFeatures) && !isChromeJSEntry) {