Bug 1317771 (part 2) - Remove SPS_STANDALONE. r=mstange.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 19 Jan 2017 08:07:00 +1100
changeset 377366 fdfd2c64c77cdc3458660e3338e9e3c952f6f535
parent 377365 450a6f20a957ebfadde152595142421c8202d896
child 377367 868ebc11e44f9305d82fe569fa798ca366a6f9d0
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1317771
milestone53.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 1317771 (part 2) - Remove SPS_STANDALONE. r=mstange. This patch removes all the |#ifdef SPS_STANDALONE| blocks.
tools/profiler/core/ProfileEntry.cpp
tools/profiler/core/ProfileEntry.h
tools/profiler/core/ThreadInfo.cpp
tools/profiler/core/platform.cpp
tools/profiler/core/platform.h
--- a/tools/profiler/core/ProfileEntry.cpp
+++ b/tools/profiler/core/ProfileEntry.cpp
@@ -342,21 +342,17 @@ uint32_t UniqueStacks::Stack::GetOrAddIn
 {
   return mUniqueStacks.GetOrAddStackIndex(mStack);
 }
 
 uint32_t UniqueStacks::FrameKey::Hash() const
 {
   uint32_t hash = 0;
   if (!mLocation.IsEmpty()) {
-#ifdef SPS_STANDALONE
-    hash = mozilla::HashString(mLocation.c_str());
-#else
     hash = mozilla::HashString(mLocation.get());
-#endif
   }
   if (mLine.isSome()) {
     hash = mozilla::AddToHash(hash, *mLine);
   }
   if (mCategory.isSome()) {
     hash = mozilla::AddToHash(hash, *mCategory);
   }
   if (mJITAddress.isSome()) {
@@ -384,65 +380,30 @@ UniqueStacks::Stack UniqueStacks::BeginS
 UniqueStacks::UniqueStacks(JSContext* aContext)
  : mContext(aContext)
  , mFrameCount(0)
 {
   mFrameTableWriter.StartBareList();
   mStackTableWriter.StartBareList();
 }
 
-#ifdef SPS_STANDALONE
-uint32_t UniqueStacks::GetOrAddStackIndex(const StackKey& aStack)
-{
-  uint32_t index;
-  auto it = mStackToIndexMap.find(aStack);
-
-  if (it != mStackToIndexMap.end()) {
-    return it->second;
-  }
-
-  index = mStackToIndexMap.size();
-  mStackToIndexMap[aStack] = index;
-  StreamStack(aStack);
-  return index;
-}
-#else
 uint32_t UniqueStacks::GetOrAddStackIndex(const StackKey& aStack)
 {
   uint32_t index;
   if (mStackToIndexMap.Get(aStack, &index)) {
     MOZ_ASSERT(index < mStackToIndexMap.Count());
     return index;
   }
 
   index = mStackToIndexMap.Count();
   mStackToIndexMap.Put(aStack, index);
   StreamStack(aStack);
   return index;
 }
-#endif
 
-#ifdef SPS_STANDALONE
-uint32_t UniqueStacks::GetOrAddFrameIndex(const OnStackFrameKey& aFrame)
-{
-  uint32_t index;
-  auto it = mFrameToIndexMap.find(aFrame);
-  if (it != mFrameToIndexMap.end()) {
-    MOZ_ASSERT(it->second < mFrameCount);
-    return it->second;
-  }
-
-  // A manual count is used instead of mFrameToIndexMap.Count() due to
-  // forwarding of canonical JIT frames above.
-  index = mFrameCount++;
-  mFrameToIndexMap[aFrame] = index;
-  StreamFrame(aFrame);
-  return index;
-}
-#else
 uint32_t UniqueStacks::GetOrAddFrameIndex(const OnStackFrameKey& aFrame)
 {
   uint32_t index;
   if (mFrameToIndexMap.Get(aFrame, &index)) {
     MOZ_ASSERT(index < mFrameCount);
     return index;
   }
 
@@ -459,17 +420,16 @@ uint32_t UniqueStacks::GetOrAddFrameInde
 
   // A manual count is used instead of mFrameToIndexMap.Count() due to
   // forwarding of canonical JIT frames above.
   index = mFrameCount++;
   mFrameToIndexMap.Put(aFrame, index);
   StreamFrame(aFrame);
   return index;
 }
-#endif
 
 uint32_t UniqueStacks::LookupJITFrameDepth(void* aAddr)
 {
   uint32_t depth;
 
   auto it = mJITFrameDepthMap.find(aAddr);
   if (it != mJITFrameDepthMap.end()) {
     depth = it->second;
@@ -518,21 +478,17 @@ void UniqueStacks::StreamFrame(const OnS
     OPTIMIZATIONS = 2,
     LINE = 3,
     CATEGORY = 4
   };
 
   AutoArraySchemaWriter writer(mFrameTableWriter, mUniqueStrings);
 
   if (!aFrame.mJITFrameHandle) {
-#ifdef SPS_STANDALONE
-    writer.StringElement(LOCATION, aFrame.mLocation.c_str());
-#else
     writer.StringElement(LOCATION, aFrame.mLocation.get());
-#endif
     if (aFrame.mLine.isSome()) {
       writer.IntElement(LINE, *aFrame.mLine);
     }
     if (aFrame.mCategory.isSome()) {
       writer.IntElement(CATEGORY, *aFrame.mCategory);
     }
   } else {
     const JS::ForEachProfiledFrameOp::FrameHandle& jitFrame = *aFrame.mJITFrameHandle;
--- a/tools/profiler/core/ProfileEntry.h
+++ b/tools/profiler/core/ProfileEntry.h
@@ -137,23 +137,19 @@ private:
   SpliceableChunkedJSONWriter mStringTableWriter;
   std::map<StringKey, uint32_t> mStringToIndexMap;
 };
 
 class UniqueStacks
 {
 public:
   struct FrameKey {
-#ifdef SPS_STANDALONE
-    std::string mLocation;
-#else
     // This cannot be a std::string, as it is not memmove compatible, which
     // is used by nsHashTable
     nsCString mLocation;
-#endif
     mozilla::Maybe<unsigned> mLine;
     mozilla::Maybe<unsigned> mCategory;
     mozilla::Maybe<void*> mJITAddress;
     mozilla::Maybe<uint32_t> mJITDepth;
 
     explicit FrameKey(const char* aLocation)
      : mLocation(aLocation)
     {
@@ -284,24 +280,17 @@ private:
 #ifdef SPS_STANDALNOE
   std::map<FrameKey, uint32_t> mFrameToIndexMap;
 #else
   nsDataHashtable<nsGenericHashKey<FrameKey>, uint32_t> mFrameToIndexMap;
 #endif
 
   SpliceableChunkedJSONWriter mStackTableWriter;
 
-  // This sucks but this is really performance critical, nsDataHashtable is way faster
-  // than map/unordered_map but nsDataHashtable is tied to xpcom so we ifdef
-  // until we can find a better solution.
-#ifdef SPS_STANDALONE
-  std::map<StackKey, uint32_t> mStackToIndexMap;
-#else
   nsDataHashtable<nsGenericHashKey<StackKey>, uint32_t> mStackToIndexMap;
-#endif
 };
 
 //
 // ThreadProfile JSON Format
 // -------------------------
 //
 // The profile contains much duplicate information. The output JSON of the
 // profile attempts to deduplicate strings, frames, and stack prefixes, to cut
--- a/tools/profiler/core/ThreadInfo.cpp
+++ b/tools/profiler/core/ThreadInfo.cpp
@@ -43,22 +43,18 @@ ThreadInfo::SetPendingDelete()
   if (mProfile) {
     mProfile->SetPendingDelete();
   }
 }
 
 bool
 ThreadInfo::CanInvokeJS() const
 {
-#ifdef SPS_STANDALONE
-  return false;
-#else
   nsIThread* thread = GetThread();
   if (!thread) {
     MOZ_ASSERT(IsMainThread());
     return true;
   }
   bool result;
   mozilla::DebugOnly<nsresult> rv = thread->GetCanInvokeJS(&result);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
   return result;
-#endif
 }
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -520,20 +520,16 @@ void mozilla_sampler_init(void* stackTop
 
   if (stack_key_initialized)
     return;
 
 #ifdef MOZ_TASK_TRACER
   mozilla::tasktracer::InitTaskTracer();
 #endif
 
-#ifdef SPS_STANDALONE
-  mozilla::TimeStamp::Startup();
-#endif
-
   LOG("BEGIN mozilla_sampler_init");
   if (!tlsPseudoStack.init() || !tlsTicker.init() || !tlsStackTop.init()) {
     LOG("Failed to init.");
     return;
   }
   bool ignore;
   sStartTime = mozilla::TimeStamp::ProcessCreation(ignore);
 
@@ -615,20 +611,16 @@ void mozilla_sampler_shutdown()
   }
 
   profiler_stop();
 
   set_stderr_callback(nullptr);
 
   Sampler::Shutdown();
 
-#ifdef SPS_STANDALONE
-  mozilla::TimeStamp::Shutdown();
-#endif
-
   PseudoStack *stack = tlsPseudoStack.get();
   stack->deref();
   tlsPseudoStack.set(nullptr);
 
 #ifdef MOZ_TASK_TRACER
   mozilla::tasktracer::ShutdownTaskTracer();
 #endif
 }
--- a/tools/profiler/core/platform.h
+++ b/tools/profiler/core/platform.h
@@ -24,21 +24,16 @@
 // AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 // SUCH DAMAGE.
 
 #ifndef TOOLS_PLATFORM_H_
 #define TOOLS_PLATFORM_H_
 
-#ifdef SPS_STANDALONE
-#define MOZ_COUNT_CTOR(name)
-#define MOZ_COUNT_DTOR(name)
-#endif
-
 #ifdef ANDROID
 #include <android/log.h>
 #else
 #define __android_log_print(a, ...)
 #endif
 
 #ifdef XP_UNIX
 #include <pthread.h>