Bug 1401421 - Remove profiler_get_backtrace_noalloc. r=mstange.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 20 Sep 2017 11:46:26 +1000
changeset 668869 2558072d1c5f1d951a0e9011c07f043676212ee7
parent 668868 8f4a95f9255cfdc6f9bf41cdcb11ba2110f27603
child 668870 c86578718e191af2dac78dfde75b002448ea80ec
push id81146
push userbmo:topwu.tw@gmail.com
push dateFri, 22 Sep 2017 05:24:51 +0000
reviewersmstange
bugs1401421, 1385953
milestone58.0a1
Bug 1401421 - Remove profiler_get_backtrace_noalloc. r=mstange. Bug 1385953 removed MemProfiler, which was its only user.
tools/profiler/core/platform.cpp
tools/profiler/public/GeckoProfiler.h
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -3184,76 +3184,16 @@ profiler_get_backtrace()
 }
 
 void
 ProfilerBacktraceDestructor::operator()(ProfilerBacktrace* aBacktrace)
 {
   delete aBacktrace;
 }
 
-// Fill the output buffer with the following pattern:
-// "Label 1" "\0" "Label 2" "\0" ... "Label N" "\0" "\0"
-// TODO: use the unwinder instead of pseudo stack.
-void
-profiler_get_backtrace_noalloc(char *output, size_t outputSize)
-{
-  MOZ_RELEASE_ASSERT(CorePS::Exists());
-
-  MOZ_ASSERT(outputSize >= 2);
-  char *bound = output + outputSize - 2;
-  output[0] = output[1] = '\0';
-
-  PSAutoLock lock(gPSMutex);
-
-  if (!ActivePS::Exists(lock)) {
-    return;
-  }
-
-  PseudoStack* pseudoStack = TLSInfo::Stack();
-  if (!pseudoStack) {
-    return;
-  }
-
-  bool includeDynamicString = !ActivePS::FeaturePrivacy(lock);
-
-  js::ProfileEntry* pseudoEntries = pseudoStack->entries;
-  uint32_t pseudoCount = pseudoStack->stackSize();
-
-  for (uint32_t i = 0; i < pseudoCount; i++) {
-    const char* label = pseudoEntries[i].label();
-    const char* dynamicString =
-      includeDynamicString ? pseudoEntries[i].dynamicString() : nullptr;
-    size_t labelLength = strlen(label);
-    if (dynamicString) {
-      // Put the label, maybe a space, and the dynamic string into output.
-      size_t spaceLength = label[0] == '\0' ? 0 : 1;
-      size_t dynamicStringLength = strlen(dynamicString);
-      if (output + labelLength + spaceLength + dynamicStringLength >= bound) {
-        break;
-      }
-      strcpy(output, label);
-      output += labelLength;
-      if (spaceLength != 0) {
-        *output++ = ' ';
-      }
-      strcpy(output, dynamicString);
-      output += dynamicStringLength;
-    } else {
-      // Only put the label into output.
-      if (output + labelLength >= bound) {
-        break;
-      }
-      strcpy(output, label);
-      output += labelLength;
-    }
-    *output++ = '\0';
-    *output = '\0';
-  }
-}
-
 static void
 racy_profiler_add_marker(const char* aMarkerName,
                          UniquePtr<ProfilerMarkerPayload> aPayload)
 {
   MOZ_RELEASE_ASSERT(CorePS::Exists());
 
   // We don't assert that RacyFeatures::IsActiveWithoutPrivacy() is true here,
   // because it's possible that the result has changed since we tested it in
--- a/tools/profiler/public/GeckoProfiler.h
+++ b/tools/profiler/public/GeckoProfiler.h
@@ -314,19 +314,16 @@ struct ProfilerBacktraceDestructor
 
 using UniqueProfilerBacktrace =
   mozilla::UniquePtr<ProfilerBacktrace, ProfilerBacktraceDestructor>;
 
 // Immediately capture the current thread's call stack and return it. A no-op
 // if the profiler is inactive or in privacy mode.
 PROFILER_FUNC(UniqueProfilerBacktrace profiler_get_backtrace(), nullptr)
 
-PROFILER_FUNC_VOID(profiler_get_backtrace_noalloc(char* aOutput,
-                                                  size_t aOutputSize))
-
 // Get information about the current buffer status. A no-op when the profiler
 // is inactive. Do not call this function; call profiler_get_buffer_info()
 // instead.
 PROFILER_FUNC_VOID(profiler_get_buffer_info_helper(uint32_t* aCurrentPosition,
                                                    uint32_t* aEntries,
                                                    uint32_t* aGeneration))
 
 // Get information about the current buffer status. Returns (via outparams) the