Bug 1317771 (part 1) - Remove SPS_STANDALONE. r=mstange.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 19 Jan 2017 08:06:59 +1100
changeset 377365 450a6f20a957ebfadde152595142421c8202d896
parent 377364 7a0ca4bad5c3449b4f0ee22d66bc051f40f044fb
child 377366 fdfd2c64c77cdc3458660e3338e9e3c952f6f535
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 1) - Remove SPS_STANDALONE. r=mstange. This patch removes all the |#ifndef SPS_STANDALONE| guards.
tools/profiler/core/GeckoSampler.cpp
tools/profiler/core/GeckoSampler.h
tools/profiler/core/ProfileEntry.cpp
tools/profiler/core/ProfileEntry.h
tools/profiler/core/ProfilerMarkers.cpp
tools/profiler/core/ThreadInfo.cpp
tools/profiler/core/ThreadInfo.h
tools/profiler/core/ThreadProfile.cpp
tools/profiler/core/ThreadProfile.h
tools/profiler/core/platform-macos.cc
tools/profiler/core/platform.cpp
tools/profiler/core/platform.h
tools/profiler/public/GeckoProfiler.h
tools/profiler/public/GeckoProfilerFunc.h
tools/profiler/public/GeckoProfilerImpl.h
tools/profiler/public/ProfilerMarkers.h
tools/profiler/public/PseudoStack.h
tools/profiler/public/shared-libraries.h
--- a/tools/profiler/core/GeckoSampler.cpp
+++ b/tools/profiler/core/GeckoSampler.cpp
@@ -4,61 +4,55 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <algorithm>
 #include <string>
 #include <stdio.h>
 #include <fstream>
 #include <sstream>
 #include "GeckoProfiler.h"
-#ifndef SPS_STANDALONE
 #include "SaveProfileTask.h"
 #include "nsThreadUtils.h"
 #include "prenv.h"
 #include "prtime.h"
 #include "nsXULAppAPI.h"
-#endif
 #include "ProfileEntry.h"
 #include "SyncProfile.h"
 #include "platform.h"
 #include "shared-libraries.h"
 #include "mozilla/StackWalk.h"
 #include "GeckoSampler.h"
 
 // JSON
 #include "ProfileJSONWriter.h"
 
-#ifndef SPS_STANDALONE
 // Meta
 #include "nsXPCOM.h"
 #include "nsXPCOMCID.h"
 #include "nsIHttpProtocolHandler.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIXULRuntime.h"
 #include "nsIXULAppInfo.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "PlatformMacros.h"
 #include "nsTArray.h"
 
 #include "mozilla/Preferences.h"
 #include "mozilla/ProfileGatherer.h"
-#endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
   #include "FennecJNIWrappers.h"
 #endif
 
-#ifndef SPS_STANDALONE
 // JS
 #include "jsfriendapi.h"
 #include "js/ProfilingFrameIterator.h"
-#endif
 
 #if defined(MOZ_PROFILING) && (defined(XP_MACOSX) || defined(XP_WIN))
  #define USE_NS_STACKWALK
 #endif
 
 #if defined(XP_WIN)
 typedef CONTEXT tickcontext_t;
 #elif defined(LINUX)
@@ -69,23 +63,21 @@ typedef ucontext_t tickcontext_t;
 #if defined(__arm__) && defined(ANDROID)
  // Should also work on ARM Linux, but not tested there yet.
  #define USE_EHABI_STACKWALK
 #endif
 #ifdef USE_EHABI_STACKWALK
  #include "EHABIStackWalk.h"
 #endif
 
-#ifndef SPS_STANDALONE
 #if defined(SPS_PLAT_amd64_linux) || defined(SPS_PLAT_x86_linux)
 # define USE_LUL_STACKWALK
 # include "lul/LulMain.h"
 # include "lul/platform-linux-lul.h"
 #endif
-#endif
 
 using std::string;
 using namespace mozilla;
 
 #ifndef MAXPATHLEN
  #ifdef PATH_MAX
   #define MAXPATHLEN PATH_MAX
  #elif defined(MAX_PATH)
@@ -276,22 +268,20 @@ GeckoSampler::~GeckoSampler()
 }
 
 void GeckoSampler::HandleSaveRequest()
 {
   if (!mSaveRequested)
     return;
   mSaveRequested = false;
 
-#ifndef SPS_STANDALONE
   // TODO: Use use the ipc/chromium Tasks here to support processes
   // without XPCOM.
   nsCOMPtr<nsIRunnable> runnable = new SaveProfileTask();
   NS_DispatchToMainThread(runnable);
-#endif
 }
 
 void GeckoSampler::DeleteExpiredMarkers()
 {
   mBuffer->deleteExpiredStoredMarkers();
 }
 
 void GeckoSampler::StreamTaskTracer(SpliceableJSONWriter& aWriter)
@@ -333,17 +323,16 @@ void GeckoSampler::StreamMetaJSCustomObj
   aWriter.IntProperty("stackwalk", mUseStackWalk);
 
 #ifdef DEBUG
   aWriter.IntProperty("debug", 1);
 #else
   aWriter.IntProperty("debug", 0);
 #endif
 
-#ifndef SPS_STANDALONE
   aWriter.IntProperty("gcpoison", JS::IsGCPoisoning() ? 1 : 0);
 
   bool asyncStacks = Preferences::GetBool("javascript.options.asyncstack");
   aWriter.IntProperty("asyncstack", asyncStacks);
 
   mozilla::TimeDuration delta = mozilla::TimeStamp::Now() - sStartTime;
   aWriter.DoubleProperty("startTime", static_cast<double>(PR_Now()/1000.0 - delta.ToMilliseconds()));
 
@@ -383,26 +372,24 @@ void GeckoSampler::StreamMetaJSCustomObj
   nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
   if (appInfo) {
     nsAutoCString string;
 
     res = appInfo->GetName(string);
     if (!NS_FAILED(res))
       aWriter.StringProperty("product", string.Data());
   }
-#endif
 }
 
 void GeckoSampler::ToStreamAsJSON(std::ostream& stream, double aSinceTime)
 {
   SpliceableJSONWriter b(mozilla::MakeUnique<OStreamJSONWriteFunc>(stream));
   StreamJSON(b, aSinceTime);
 }
 
-#ifndef SPS_STANDALONE
 JSObject* GeckoSampler::ToJSObject(JSContext *aCx, double aSinceTime)
 {
   JS::RootedValue val(aCx);
   {
     UniquePtr<char[]> buf = ToJSON(aSinceTime);
     NS_ConvertUTF8toUTF16 js_string(nsDependentCString(buf.get()));
     MOZ_ALWAYS_TRUE(JS_ParseJSON(aCx, static_cast<const char16_t*>(js_string.get()),
                                  js_string.Length(), &val));
@@ -412,17 +399,16 @@ JSObject* GeckoSampler::ToJSObject(JSCon
 
 void GeckoSampler::GetGatherer(nsISupports** aRetVal)
 {
   if (!aRetVal || NS_WARN_IF(!mGatherer)) {
     return;
   }
   NS_ADDREF(*aRetVal = mGatherer);
 }
-#endif
 
 UniquePtr<char[]> GeckoSampler::ToJSON(double aSinceTime)
 {
   SpliceableChunkedJSONWriter b;
   StreamJSON(b, aSinceTime);
   return b.WriteFunc()->CopyData();
 }
 
@@ -552,17 +538,16 @@ void GeckoSampler::StreamJSON(Spliceable
           // have been marked for pending delete.
 
           ::MutexAutoLock lock(sRegisteredThreads->at(i)->Profile()->GetMutex());
 
           sRegisteredThreads->at(i)->Profile()->StreamJSON(aWriter, aSinceTime);
         }
       }
 
-#ifndef SPS_STANDALONE
       if (Sampler::CanNotifyObservers()) {
         // Send a event asking any subprocesses (plugins) to
         // give us their information
         SubprocessClosure closure(&aWriter);
         nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
         if (os) {
           RefPtr<ProfileSaveEvent> pse = new ProfileSaveEvent(SubProcessCallback, &closure);
           os->NotifyObservers(pse, "profiler-subprocess", nullptr);
@@ -577,28 +562,26 @@ void GeckoSampler::StreamJSON(Spliceable
         {
           BuildJavaThreadJSObject(aWriter);
         }
         aWriter.End();
 
         java::GeckoJavaSampler::Unpause();
       }
   #endif
-#endif
 
       SetPaused(false);
     }
     aWriter.EndArray();
   }
   aWriter.End();
 }
 
 void GeckoSampler::FlushOnJSShutdown(JSContext* aContext)
 {
-#ifndef SPS_STANDALONE
   SetPaused(true);
 
   {
     ::MutexAutoLock lock(*sRegisteredThreadsMutex);
 
     for (size_t i = 0; i < sRegisteredThreads->size(); i++) {
       // Thread not being profiled, skip it.
       if (!sRegisteredThreads->at(i)->Profile() ||
@@ -612,28 +595,25 @@ void GeckoSampler::FlushOnJSShutdown(JSC
       }
 
       ::MutexAutoLock lock(sRegisteredThreads->at(i)->Profile()->GetMutex());
       sRegisteredThreads->at(i)->Profile()->FlushSamplesAndMarkers();
     }
   }
 
   SetPaused(false);
-#endif
 }
 
 void PseudoStack::flushSamplerOnJSShutdown()
 {
-#ifndef SPS_STANDALONE
   MOZ_ASSERT(mContext);
   GeckoSampler* t = tlsTicker.get();
   if (t) {
     t->FlushOnJSShutdown(mContext);
   }
-#endif
 }
 
 // END SaveProfileTask et al
 ////////////////////////////////////////////////////////////////////////
 
 static
 void addDynamicTag(ThreadProfile &aProfile, char aTagName, const char *aStr)
 {
@@ -668,17 +648,16 @@ void addPseudoEntry(volatile StackEntry 
   // First entry has tagName 's' (start)
   // Check for magic pointer bit 1 to indicate copy
   const char* sampleLabel = entry.label();
   if (entry.isCopyLabel()) {
     // Store the string using 1 or more 'd' (dynamic) tags
     // that will happen to the preceding tag
 
     addDynamicTag(aProfile, 'c', sampleLabel);
-#ifndef SPS_STANDALONE
     if (entry.isJs()) {
       JSScript* script = entry.script();
       if (script) {
         if (!entry.pc()) {
           // The JIT only allows the top-most entry to have a nullptr pc
           MOZ_ASSERT(&entry == &stack->mStack[stack->stackSize() - 1]);
           // If stack-walking was disabled, then that's just unfortunate
           if (lastpc) {
@@ -690,17 +669,16 @@ void addPseudoEntry(volatile StackEntry 
           }
         } else {
           lineno = JS_PCToLineNumber(script, entry.pc());
         }
       }
     } else {
       lineno = entry.line();
     }
-#endif
   } else {
     aProfile.addTag(ProfileEntry('c', sampleLabel));
 
     // XXX: Bug 1010578. Don't assume a CPP entry and try to get the
     // line for js entries as well.
     if (entry.isCpp()) {
       lineno = entry.line();
     }
@@ -759,17 +737,16 @@ void mergeStacksIntoProfile(ThreadProfil
   // entries.
   uint32_t startBufferGen;
   if (aSample->isSamplingCurrentThread) {
     startBufferGen = UINT32_MAX;
   } else {
     startBufferGen = aProfile.bufferGeneration();
   }
   uint32_t jsCount = 0;
-#ifndef SPS_STANDALONE
   JS::ProfilingFrameIterator::Frame jsFrames[1000];
   // Only walk jit stack if profiling frame iterator is turned on.
   if (pseudoStack->mContext && JS::IsProfilingEnabledForContext(pseudoStack->mContext)) {
     AutoWalkJSStack autoWalkJSStack;
     const uint32_t maxFrames = mozilla::ArrayLength(jsFrames);
 
     if (aSample && autoWalkJSStack.walkAllowed) {
       JS::ProfilingFrameIterator::RegisterState registerState;
@@ -793,17 +770,16 @@ void mergeStacksIntoProfile(ThreadProfil
           mozilla::Maybe<JS::ProfilingFrameIterator::Frame> frame =
             jsIter.getPhysicalFrameWithoutLabel();
           if (frame.isSome())
             jsFrames[jsCount++] = frame.value();
         }
       }
     }
   }
-#endif
 
   // Start the sample with a root entry.
   aProfile.addTag(ProfileEntry('s', "(root)"));
 
   // While the pseudo-stack array is ordered oldest-to-youngest, the JS and
   // native arrays are ordered youngest-to-oldest. We must add frames to
   // aProfile oldest-to-youngest. Thus, iterate over the pseudo-stack forwards
   // and JS and native arrays backwards. Note: this means the terminating
@@ -823,38 +799,34 @@ void mergeStacksIntoProfile(ThreadProfil
     uint8_t *nativeStackAddr = nullptr;
 
     if (pseudoIndex != pseudoCount) {
       volatile StackEntry &pseudoFrame = pseudoFrames[pseudoIndex];
 
       if (pseudoFrame.isCpp())
         lastPseudoCppStackAddr = (uint8_t *) pseudoFrame.stackAddress();
 
-#ifndef SPS_STANDALONE
       // Skip any pseudo-stack JS frames which are marked isOSR
       // Pseudostack frames are marked isOSR when the JS interpreter
       // enters a jit frame on a loop edge (via on-stack-replacement,
       // or OSR).  To avoid both the pseudoframe and jit frame being
       // recorded (and showing up twice), the interpreter marks the
       // interpreter pseudostack entry with the OSR flag to ensure that
       // it doesn't get counted.
       if (pseudoFrame.isJs() && pseudoFrame.isOSR()) {
           pseudoIndex++;
           continue;
       }
-#endif
 
       MOZ_ASSERT(lastPseudoCppStackAddr);
       pseudoStackAddr = lastPseudoCppStackAddr;
     }
 
-#ifndef SPS_STANDALONE
     if (jsIndex >= 0)
       jsStackAddr = (uint8_t *) jsFrames[jsIndex].stackAddress;
-#endif
 
     if (nativeIndex >= 0)
       nativeStackAddr = (uint8_t *) aNativeStack.sp_array[nativeIndex];
 
     // If there's a native stack entry which has the same SP as a
     // pseudo stack entry, pretend we didn't see the native stack
     // entry.  Ditto for a native stack entry which has the same SP as
     // a JS stack entry.  In effect this means pseudo or JS entries
@@ -877,17 +849,16 @@ void mergeStacksIntoProfile(ThreadProfil
     if (pseudoStackAddr > jsStackAddr && pseudoStackAddr > nativeStackAddr) {
       MOZ_ASSERT(pseudoIndex < pseudoCount);
       volatile StackEntry &pseudoFrame = pseudoFrames[pseudoIndex];
       addPseudoEntry(pseudoFrame, aProfile, pseudoStack, nullptr);
       pseudoIndex++;
       continue;
     }
 
-#ifndef SPS_STANDALONE
     // Check to see if JS jit stack frame is top-most
     if (jsStackAddr > nativeStackAddr) {
       MOZ_ASSERT(jsIndex >= 0);
       const JS::ProfilingFrameIterator::Frame& jsFrame = jsFrames[jsIndex];
 
       // Stringifying non-wasm JIT frames is delayed until streaming
       // time. To re-lookup the entry in the JitcodeGlobalTable, we need to
       // store the JIT code address ('J') in the circular buffer.
@@ -908,43 +879,40 @@ void mergeStacksIntoProfile(ThreadProfil
         MOZ_ASSERT(jsFrame.kind == JS::ProfilingFrameIterator::Frame_Ion ||
                    jsFrame.kind == JS::ProfilingFrameIterator::Frame_Baseline);
         aProfile.addTag(ProfileEntry('J', jsFrames[jsIndex].returnAddress));
       }
 
       jsIndex--;
       continue;
     }
-#endif
 
     // If we reach here, there must be a native stack entry and it must be the
     // greatest entry.
     if (nativeStackAddr) {
       MOZ_ASSERT(nativeIndex >= 0);
       aProfile
         .addTag(ProfileEntry('l', (void*)aNativeStack.pc_array[nativeIndex]));
     }
     if (nativeIndex >= 0) {
       nativeIndex--;
     }
   }
 
-#ifndef SPS_STANDALONE
   // Update the JS context with the current profile sample buffer generation.
   //
   // Do not do this for synchronous sampling, which create their own
   // ProfileBuffers.
   if (!aSample->isSamplingCurrentThread && pseudoStack->mContext) {
     MOZ_ASSERT(aProfile.bufferGeneration() >= startBufferGen);
     uint32_t lapCount = aProfile.bufferGeneration() - startBufferGen;
     JS::UpdateJSContextProfilerSampleBufferGen(pseudoStack->mContext,
                                                aProfile.bufferGeneration(),
                                                lapCount);
   }
-#endif
 }
 
 #ifdef USE_NS_STACKWALK
 static
 void StackWalkCallback(uint32_t aFrameNumber, void* aPC, void* aSP,
                        void* aClosure)
 {
   NativeStack* nativeStack = static_cast<NativeStack*>(aClosure);
@@ -1220,22 +1188,20 @@ void GeckoSampler::InplaceTick(TickSampl
     ProfilerMarkerLinkedList* pendingMarkersList = stack->getPendingMarkers();
     while (pendingMarkersList && pendingMarkersList->peek()) {
       ProfilerMarker* marker = pendingMarkersList->popHead();
       currThreadProfile.addStoredMarker(marker);
       currThreadProfile.addTag(ProfileEntry('m', marker));
     }
   }
 
-#ifndef SPS_STANDALONE
   if (sample && currThreadProfile.GetThreadResponsiveness()->HasData()) {
     mozilla::TimeDuration delta = currThreadProfile.GetThreadResponsiveness()->GetUnresponsiveDuration(sample->timestamp);
     currThreadProfile.addTag(ProfileEntry('r', delta.ToMilliseconds()));
   }
-#endif
 
   // rssMemory is equal to 0 when we are not recording.
   if (sample && sample->rssMemory != 0) {
     currThreadProfile.addTag(ProfileEntry('R', static_cast<double>(sample->rssMemory)));
   }
 
   // ussMemory is equal to 0 when we are not recording.
   if (sample && sample->ussMemory != 0) {
--- a/tools/profiler/core/GeckoSampler.h
+++ b/tools/profiler/core/GeckoSampler.h
@@ -81,20 +81,18 @@ class GeckoSampler: public Sampler {
   {
     mSaveRequested = true;
   }
 
   virtual void HandleSaveRequest() override;
   virtual void DeleteExpiredMarkers() override;
 
   void ToStreamAsJSON(std::ostream& stream, double aSinceTime = 0);
-#ifndef SPS_STANDALONE
   virtual JSObject *ToJSObject(JSContext *aCx, double aSinceTime = 0);
   void GetGatherer(nsISupports** aRetVal);
-#endif
   mozilla::UniquePtr<char[]> ToJSON(double aSinceTime = 0);
   virtual void ToJSObjectAsync(double aSinceTime = 0, mozilla::dom::Promise* aPromise = 0);
   void ToFileAsync(const nsACString& aFileName, double aSinceTime = 0);
   void StreamMetaJSCustomObject(SpliceableJSONWriter& aWriter);
   void StreamTaskTracer(SpliceableJSONWriter& aWriter);
   void FlushOnJSShutdown(JSContext* aContext);
   bool ProfileJS() const { return mProfileJS; }
   bool ProfileJava() const { return mProfileJava; }
--- a/tools/profiler/core/ProfileEntry.cpp
+++ b/tools/profiler/core/ProfileEntry.cpp
@@ -2,25 +2,23 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <ostream>
 #include "platform.h"
 #include "mozilla/HashFunctions.h"
 
-#ifndef SPS_STANDALONE
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
 
 // JS
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "js/TrackedOptimizationInfo.h"
-#endif
 
 // Self
 #include "ProfileEntry.h"
 
 using mozilla::MakeUnique;
 using mozilla::UniquePtr;
 using mozilla::Maybe;
 using mozilla::Some;
@@ -114,17 +112,16 @@ public:
     mWriter.IntProperty(aName, mIndex++);
   }
 
   ~JSONSchemaWriter() {
     mWriter.EndObject();
   }
 };
 
-#ifndef SPS_STANDALONE
 class StreamOptimizationTypeInfoOp : public JS::ForEachTrackedOptimizationTypeInfoOp
 {
   JSONWriter& mWriter;
   UniqueJSONStrings& mUniqueStrings;
   bool mStartedTypeList;
 
 public:
   StreamOptimizationTypeInfoOp(JSONWriter& aWriter, UniqueJSONStrings& aUniqueStrings)
@@ -290,17 +287,16 @@ public:
   }
 
   void operator()(const JS::ForEachProfiledFrameOp::FrameHandle& aFrameHandle) override {
     UniqueStacks::OnStackFrameKey frameKey(mReturnAddress, mDepth, aFrameHandle);
     mStack.AppendFrame(frameKey);
     mDepth++;
   }
 };
-#endif
 
 uint32_t UniqueJSONStrings::GetOrAddIndex(const char* aStr)
 {
   uint32_t index;
   StringKey key(aStr);
 
   auto it = mStringToIndexMap.find(key);
 
@@ -521,35 +517,29 @@ void UniqueStacks::StreamFrame(const OnS
     IMPLEMENTATION = 1,
     OPTIMIZATIONS = 2,
     LINE = 3,
     CATEGORY = 4
   };
 
   AutoArraySchemaWriter writer(mFrameTableWriter, mUniqueStrings);
 
-#ifndef SPS_STANDALONE
   if (!aFrame.mJITFrameHandle) {
-#else
-  {
-#endif
 #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);
     }
-  }
-#ifndef SPS_STANDALONE
-  else {
+  } else {
     const JS::ForEachProfiledFrameOp::FrameHandle& jitFrame = *aFrame.mJITFrameHandle;
 
     writer.StringElement(LOCATION, jitFrame.label());
 
     JS::ProfilingFrameIterator::FrameKind frameKind = jitFrame.frameKind();
     MOZ_ASSERT(frameKind == JS::ProfilingFrameIterator::Frame_Ion ||
                frameKind == JS::ProfilingFrameIterator::Frame_Baseline);
     writer.StringElement(IMPLEMENTATION,
@@ -596,17 +586,16 @@ void UniqueStacks::StreamFrame(const OnS
         unsigned line, column;
         line = JS_PCToLineNumber(script, pc, &column);
         mFrameTableWriter.IntProperty("line", line);
         mFrameTableWriter.IntProperty("column", column);
       }
       mFrameTableWriter.EndObject();
     }
   }
-#endif
 }
 
 struct ProfileSample
 {
   uint32_t mStack;
   Maybe<double> mTime;
   Maybe<double> mResponsiveness;
   Maybe<double> mRSS;
@@ -752,32 +741,30 @@ void ProfileBuffer::StreamSamplesToJSON(
               }
               readAheadPos = (framePos + incBy) % mEntrySize;
               if (readAheadPos != mWritePos &&
                   mEntries[readAheadPos].mTagName == 'y') {
                 frameKey.mCategory = Some((unsigned) mEntries[readAheadPos].mTagInt);
                 incBy++;
               }
               stack.AppendFrame(frameKey);
-#ifndef SPS_STANDALONE
             } else if (frame.mTagName == 'J') {
               // A JIT frame may expand to multiple frames due to inlining.
               void* pc = frame.mTagPtr;
               unsigned depth = aUniqueStacks.LookupJITFrameDepth(pc);
               if (depth == 0) {
                 StreamJSFramesOp framesOp(pc, stack);
                 JS::ForEachProfiledFrame(aContext, pc, framesOp);
                 aUniqueStacks.AddJITFrameDepth(pc, framesOp.depth());
               } else {
                 for (unsigned i = 0; i < depth; i++) {
                   UniqueStacks::OnStackFrameKey inlineFrameKey(pc, i);
                   stack.AppendFrame(inlineFrameKey);
                 }
               }
-#endif
             }
             framePos = (framePos + incBy) % mEntrySize;
           }
 
           sample->mStack = stack.GetOrAddIndex();
           break;
         }
       }
--- a/tools/profiler/core/ProfileEntry.h
+++ b/tools/profiler/core/ProfileEntry.h
@@ -10,29 +10,23 @@
 #include <ostream>
 #include "GeckoProfiler.h"
 #include "platform.h"
 #include "ProfileJSONWriter.h"
 #include "ProfilerBacktrace.h"
 #include "mozilla/RefPtr.h"
 #include <string>
 #include <map>
-#ifndef SPS_STANDALONE
 #include "js/ProfilingFrameIterator.h"
 #include "js/TrackedOptimizationInfo.h"
 #include "nsHashKeys.h"
 #include "nsDataHashtable.h"
-#endif
 #include "mozilla/Maybe.h"
 #include "mozilla/Vector.h"
-#ifndef SPS_STANDALONE
 #include "gtest/MozGtestFriend.h"
-#else
-#define FRIEND_TEST(a, b) // TODO Support standalone gtest
-#endif
 #include "mozilla/HashFunctions.h"
 #include "mozilla/UniquePtr.h"
 
 class ThreadProfile;
 
 // NB: Packing this structure has been shown to cause SIGBUS issues on ARM.
 #ifndef __arm__
 #pragma pack(push, 1)
@@ -192,42 +186,36 @@ public:
   private:
     uint32_t mHash;
   };
 
   // A FrameKey that holds a scoped reference to a JIT FrameHandle.
   struct MOZ_STACK_CLASS OnStackFrameKey : public FrameKey {
     explicit OnStackFrameKey(const char* aLocation)
       : FrameKey(aLocation)
-#ifndef SPS_STANDALONE
       , mJITFrameHandle(nullptr)
-#endif
     { }
 
     OnStackFrameKey(const OnStackFrameKey& aToCopy)
       : FrameKey(aToCopy)
-#ifndef SPS_STANDALONE
       , mJITFrameHandle(aToCopy.mJITFrameHandle)
-#endif
     { }
 
-#ifndef SPS_STANDALONE
     const JS::ForEachProfiledFrameOp::FrameHandle* mJITFrameHandle;
 
     OnStackFrameKey(void* aJITAddress, unsigned aJITDepth)
       : FrameKey(aJITAddress, aJITDepth)
       , mJITFrameHandle(nullptr)
     { }
 
     OnStackFrameKey(void* aJITAddress, unsigned aJITDepth,
                     const JS::ForEachProfiledFrameOp::FrameHandle& aJITFrameHandle)
       : FrameKey(aJITAddress, aJITDepth)
       , mJITFrameHandle(&aJITFrameHandle)
     { }
-#endif
   };
 
   struct StackKey {
     mozilla::Maybe<uint32_t> mPrefixHash;
     mozilla::Maybe<uint32_t> mPrefix;
     uint32_t mFrame;
 
     explicit StackKey(uint32_t aFrame)
--- a/tools/profiler/core/ProfilerMarkers.cpp
+++ b/tools/profiler/core/ProfilerMarkers.cpp
@@ -2,21 +2,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GeckoProfiler.h"
 #include "ProfilerBacktrace.h"
 #include "ProfilerMarkers.h"
 #include "SyncProfile.h"
-#ifndef SPS_STANDALONE
 #include "gfxASurface.h"
 #include "Layers.h"
 #include "mozilla/Sprintf.h"
-#endif
 
 ProfilerMarkerPayload::ProfilerMarkerPayload(UniqueProfilerBacktrace aStack)
   : mStack(mozilla::Move(aStack))
 {}
 
 ProfilerMarkerPayload::ProfilerMarkerPayload(const mozilla::TimeStamp& aStartTime,
                                              const mozilla::TimeStamp& aEndTime,
                                              UniqueProfilerBacktrace aStack)
@@ -83,17 +81,16 @@ ProfilerMarkerTracing::StreamPayload(Spl
     if (GetMetaData() == TRACING_INTERVAL_START) {
       aWriter.StringProperty("interval", "start");
     } else if (GetMetaData() == TRACING_INTERVAL_END) {
       aWriter.StringProperty("interval", "end");
     }
   }
 }
 
-#ifndef SPS_STANDALONE
 GPUMarkerPayload::GPUMarkerPayload(
   const mozilla::TimeStamp& aCpuTimeStart,
   const mozilla::TimeStamp& aCpuTimeEnd,
   uint64_t aGpuTimeStart,
   uint64_t aGpuTimeEnd)
 
   : ProfilerMarkerPayload(aCpuTimeStart, aCpuTimeEnd)
   , mCpuTimeStart(aCpuTimeStart)
@@ -223,9 +220,8 @@ VsyncPayload::VsyncPayload(mozilla::Time
 }
 
 void
 VsyncPayload::StreamPayload(SpliceableJSONWriter& aWriter, UniqueStacks& aUniqueStacks)
 {
   aWriter.DoubleProperty("vsync", profiler_time(mVsyncTimestamp));
   aWriter.StringProperty("category", "VsyncTimestamp");
 }
-#endif
--- a/tools/profiler/core/ThreadInfo.cpp
+++ b/tools/profiler/core/ThreadInfo.cpp
@@ -16,19 +16,17 @@ ThreadInfo::ThreadInfo(const char* aName
   , mThreadId(aThreadId)
   , mIsMainThread(aIsMainThread)
   , mPseudoStack(aPseudoStack)
   , mPlatformData(Sampler::AllocPlatformData(aThreadId))
   , mStackTop(aStackTop)
   , mPendingDelete(false)
 {
   MOZ_COUNT_CTOR(ThreadInfo);
-#ifndef SPS_STANDALONE
   mThread = NS_GetCurrentThread();
-#endif
 
   // We don't have to guess on mac
 #ifdef XP_MACOSX
   pthread_t self = pthread_self();
   mStackTop = pthread_get_stackaddr_np(self);
 #endif
 }
 
--- a/tools/profiler/core/ThreadInfo.h
+++ b/tools/profiler/core/ThreadInfo.h
@@ -30,37 +30,32 @@ class ThreadInfo {
   ThreadProfile* Profile() const { return mProfile.get(); }
 
   PlatformData* GetPlatformData() const { return mPlatformData.get(); }
   void* StackTop() const { return mStackTop; }
 
   virtual void SetPendingDelete();
   bool IsPendingDelete() const { return mPendingDelete; }
 
-#ifndef SPS_STANDALONE
   /**
    * May be null for the main thread if the profiler was started during startup
    */
   nsIThread* GetThread() const { return mThread.get(); }
 
-#endif
-
   bool CanInvokeJS() const;
 
  private:
   mozilla::UniqueFreePtr<char> mName;
   int mThreadId;
   const bool mIsMainThread;
   PseudoStack* mPseudoStack;
   Sampler::UniquePlatformData mPlatformData;
   mozilla::UniquePtr<ThreadProfile> mProfile;
   void* mStackTop;
-#ifndef SPS_STANDALONE
   nsCOMPtr<nsIThread> mThread;
-#endif
   bool mPendingDelete;
 };
 
 // Just like ThreadInfo, but owns a reference to the PseudoStack.
 class StackOwningThreadInfo : public ThreadInfo {
  public:
   StackOwningThreadInfo(const char* aName, int aThreadId, bool aIsMainThread, PseudoStack* aPseudoStack, void* aStackTop);
   virtual ~StackOwningThreadInfo();
--- a/tools/profiler/core/ThreadProfile.cpp
+++ b/tools/profiler/core/ThreadProfile.cpp
@@ -8,19 +8,17 @@ ThreadProfile::ThreadProfile(ThreadInfo*
   : mThreadInfo(aInfo)
   , mBuffer(aBuffer)
   , mPseudoStack(aInfo->Stack())
   , mMutex(OS::CreateMutex("ThreadProfile::mMutex"))
   , mThreadId(int(aInfo->ThreadId()))
   , mIsMainThread(aInfo->IsMainThread())
   , mPlatformData(aInfo->GetPlatformData())
   , mStackTop(aInfo->StackTop())
-#ifndef SPS_STANDALONE
   , mRespInfo(this)
-#endif
 #ifdef XP_LINUX
   , mRssMemory(0)
   , mUssMemory(0)
 #endif
 {
   MOZ_COUNT_CTOR(ThreadProfile);
   MOZ_ASSERT(aBuffer);
 
@@ -42,21 +40,17 @@ void ThreadProfile::addTag(const Profile
 void ThreadProfile::addStoredMarker(ProfilerMarker *aStoredMarker) {
   mBuffer->addStoredMarker(aStoredMarker);
 }
 
 void ThreadProfile::StreamJSON(SpliceableJSONWriter& aWriter, double aSinceTime)
 {
   // mUniqueStacks may already be emplaced from FlushSamplesAndMarkers.
   if (!mUniqueStacks.isSome()) {
-#ifndef SPS_STANDALONE
     mUniqueStacks.emplace(mPseudoStack->mContext);
-#else
-    mUniqueStacks.emplace(nullptr);
-#endif
   }
 
   aWriter.Start(SpliceableJSONWriter::SingleLineStyle);
   {
     StreamSamplesAndMarkers(aWriter, aSinceTime, *mUniqueStacks);
 
     aWriter.StartObjectProperty("stackTable");
     {
@@ -102,19 +96,17 @@ void ThreadProfile::StreamJSON(Spliceabl
   aWriter.End();
 
   mUniqueStacks.reset();
 }
 
 void ThreadProfile::StreamSamplesAndMarkers(SpliceableJSONWriter& aWriter, double aSinceTime,
                                             UniqueStacks& aUniqueStacks)
 {
-#ifndef SPS_STANDALONE
   aWriter.StringProperty("processType", XRE_ChildProcessTypeToString(XRE_GetProcessType()));
-#endif
 
   aWriter.StringProperty("name", Name());
   aWriter.IntProperty("tid", static_cast<int>(mThreadId));
 
   aWriter.StartObjectProperty("samples");
   {
     {
       JSONSchemaWriter schema(aWriter);
@@ -132,22 +124,17 @@ void ThreadProfile::StreamSamplesAndMark
         // We would only have saved streamed samples during shutdown
         // streaming, which cares about dumping the entire buffer, and thus
         // should have passed in 0 for aSinceTime.
         MOZ_ASSERT(aSinceTime == 0);
         aWriter.Splice(mSavedStreamedSamples.get());
         mSavedStreamedSamples.reset();
       }
       mBuffer->StreamSamplesToJSON(aWriter, mThreadId, aSinceTime,
-#ifndef SPS_STANDALONE
-                                   mPseudoStack->mContext,
-#else
-                                   nullptr,
-#endif
-                                   aUniqueStacks);
+                                   mPseudoStack->mContext, aUniqueStacks);
     }
     aWriter.EndArray();
   }
   aWriter.EndObject();
 
   aWriter.StartObjectProperty("markers");
   {
     {
@@ -179,33 +166,24 @@ void ThreadProfile::FlushSamplesAndMarke
 
   // Unlike StreamJSObject, do not surround the samples in brackets by calling
   // aWriter.{Start,End}BareList. The result string will be a comma-separated
   // list of JSON object literals that will prepended by StreamJSObject into
   // an existing array.
   //
   // Note that the UniqueStacks instance is persisted so that the frame-index
   // mapping is stable across JS shutdown.
-#ifndef SPS_STANDALONE
   mUniqueStacks.emplace(mPseudoStack->mContext);
-#else
-  mUniqueStacks.emplace(nullptr);
-#endif
 
   {
     SpliceableChunkedJSONWriter b;
     b.StartBareList();
     {
       mBuffer->StreamSamplesToJSON(b, mThreadId, /* aSinceTime = */ 0,
-#ifndef SPS_STANDALONE
-                                   mPseudoStack->mContext,
-#else
-                                   nullptr,
-#endif
-                                   *mUniqueStacks);
+                                   mPseudoStack->mContext, *mUniqueStacks);
     }
     b.EndBareList();
     mSavedStreamedSamples = b.WriteFunc()->CopyData();
   }
 
   {
     SpliceableChunkedJSONWriter b;
     b.StartBareList();
--- a/tools/profiler/core/ThreadProfile.h
+++ b/tools/profiler/core/ThreadProfile.h
@@ -41,19 +41,17 @@ public:
   const char* Name() const { return mThreadInfo->Name(); }
   int ThreadId() const { return mThreadId; }
 
   PlatformData* GetPlatformData() const { return mPlatformData; }
   void* GetStackTop() const { return mStackTop; }
   void DuplicateLastSample();
 
   ThreadInfo* GetThreadInfo() const { return mThreadInfo; }
-#ifndef SPS_STANDALONE
   ThreadResponsiveness* GetThreadResponsiveness() { return &mRespInfo; }
-#endif
 
   bool CanInvokeJS() const { return mThreadInfo->CanInvokeJS(); }
 
   void SetPendingDelete()
   {
     mPseudoStack = nullptr;
     mPlatformData = nullptr;
   }
@@ -85,19 +83,17 @@ private:
   mozilla::Maybe<UniqueStacks> mUniqueStacks;
 
   PseudoStack*   mPseudoStack;
   mozilla::UniquePtr<Mutex>  mMutex;
   int            mThreadId;
   bool           mIsMainThread;
   PlatformData*  mPlatformData;  // Platform specific data.
   void* const    mStackTop;
-#ifndef SPS_STANDALONE
   ThreadResponsiveness mRespInfo;
-#endif
 
   // Only Linux is using a signal sender, instead of stopping the thread, so we
   // need some space to store the data which cannot be collected in the signal
   // handler code.
 #ifdef XP_LINUX
 public:
   int64_t        mRssMemory;
   int64_t        mUssMemory;
--- a/tools/profiler/core/platform-macos.cc
+++ b/tools/profiler/core/platform-macos.cc
@@ -24,23 +24,21 @@
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <math.h>
 
-#ifndef SPS_STANDALONE
 #include "ThreadResponsiveness.h"
 #include "nsThreadUtils.h"
 
 // Memory profile
 #include "nsMemoryReporterManager.h"
-#endif
 
 #include "platform.h"
 #include "GeckoSampler.h"
 #include "mozilla/TimeStamp.h"
 
 using mozilla::TimeStamp;
 using mozilla::TimeDuration;
 
@@ -222,19 +220,17 @@ class SamplerThread : public Thread {
             continue;
 
           PseudoStack::SleepState sleeping = info->Stack()->observeSleeping();
           if (sleeping == PseudoStack::SLEEPING_AGAIN) {
             info->Profile()->DuplicateLastSample();
             continue;
           }
 
-#ifndef SPS_STANDALONE
           info->Profile()->GetThreadResponsiveness()->Update();
-#endif
 
           ThreadProfile* thread_profile = info->Profile();
 
           SampleContext(SamplerRegistry::sampler, thread_profile,
                         isFirstProfiledThread);
           isFirstProfiledThread = false;
         }
       }
@@ -257,21 +253,19 @@ class SamplerThread : public Thread {
 
     TickSample sample_obj;
     TickSample* sample = &sample_obj;
 
     // Unique Set Size is not supported on Mac.
     sample->ussMemory = 0;
     sample->rssMemory = 0;
 
-#ifndef SPS_STANDALONE
     if (isFirstProfiledThread && Sampler::GetActiveSampler()->ProfileMemory()) {
       sample->rssMemory = nsMemoryReporterManager::ResidentFast();
     }
-#endif
 
     // We're using thread_suspend on OS X because pthread_kill (which is what
     // we're using on Linux) has less consistent performance and causes
     // strange crashes, see bug 1166778 and bug 1166808.
 
     if (KERN_SUCCESS != thread_suspend(profiled_thread)) return;
 
 #if V8_HOST_ARCH_X64
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -9,55 +9,49 @@
 #include <sstream>
 #include <errno.h>
 
 #include "platform.h"
 #include "PlatformMacros.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/UniquePtr.h"
 #include "GeckoProfiler.h"
-#ifndef SPS_STANDALONE
 #include "ProfilerIOInterposeObserver.h"
 #include "mozilla/StaticPtr.h"
-#endif
 #include "mozilla/ThreadLocal.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Sprintf.h"
 #include "PseudoStack.h"
 #include "GeckoSampler.h"
-#ifndef SPS_STANDALONE
 #include "nsIObserverService.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsXULAppAPI.h"
 #include "nsProfilerStartParams.h"
 #include "mozilla/Services.h"
 #include "nsThreadUtils.h"
-#endif
 #include "ProfilerMarkers.h"
 
 #ifdef MOZ_TASK_TRACER
 #include "GeckoTaskTracer.h"
 #endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
   #include "FennecJNIWrappers.h"
 #endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
 #include "FennecJNINatives.h"
 #endif
 
-#ifndef SPS_STANDALONE
 #if defined(SPS_PLAT_amd64_linux) || defined(SPS_PLAT_x86_linux)
 # define USE_LUL_STACKWALK
 # include "lul/LulMain.h"
 # include "lul/platform-linux-lul.h"
 #endif
-#endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
 class GeckoJavaSampler : public java::GeckoJavaSampler::Natives<GeckoJavaSampler>
 {
 private:
   GeckoJavaSampler();
 
 public:
@@ -107,20 +101,18 @@ static int sUnwindInterval;   /* in mill
 static int sUnwindStackScan;  /* max # of dubious frames allowed */
 static int sProfileEntries;   /* how many entries do we store? */
 
 std::vector<ThreadInfo*>* Sampler::sRegisteredThreads = nullptr;
 mozilla::UniquePtr< ::Mutex> Sampler::sRegisteredThreadsMutex;
 
 GeckoSampler* Sampler::sActiveSampler;
 
-#ifndef SPS_STANDALONE
 static mozilla::StaticAutoPtr<mozilla::ProfilerIOInterposeObserver>
                                                             sInterposeObserver;
-#endif
 
 // The name that identifies the gecko thread for calls to
 // profiler_register_thread.
 static const char * gGeckoThreadName = "GeckoMain";
 
 void Sampler::Startup() {
   sRegisteredThreads = new std::vector<ThreadInfo*>();
   sRegisteredThreadsMutex = OS::CreateMutex("sRegisteredThreads mutex");
@@ -475,17 +467,16 @@ void set_tls_stack_top(void* stackTop)
 
 bool is_main_thread_name(const char* aName) {
   if (!aName) {
     return false;
   }
   return strcmp(aName, gGeckoThreadName) == 0;
 }
 
-#ifndef SPS_STANDALONE
 #ifdef HAVE_VA_COPY
 #define VARARGS_ASSIGN(foo, bar)        VA_COPY(foo,bar)
 #elif defined(HAVE_VA_LIST_AS_ARRAY)
 #define VARARGS_ASSIGN(foo, bar)     foo[0] = bar[0]
 #else
 #define VARARGS_ASSIGN(foo, bar)     (foo) = (bar)
 #endif
 
@@ -514,17 +505,16 @@ mozilla_sampler_log(const char *fmt, va_
       // EVENT_BACKTRACE could be used to get a source
       // for all log events. This could be a runtime
       // flag later.
       profiler_tracing("log", heapBuf, TRACING_EVENT);
       delete[] heapBuf;
     }
   }
 }
-#endif
 
 ////////////////////////////////////////////////////////////////////////
 // BEGIN externally visible functions
 
 void mozilla_sampler_init(void* stackTop)
 {
   sInitCount++;
 
@@ -561,19 +551,17 @@ void mozilla_sampler_init(void* stackTop
 
   // Read interval settings from MOZ_PROFILER_INTERVAL and stack-scan
   // threshhold from MOZ_PROFILER_STACK_SCAN.
   read_profiler_env_vars();
 
   // platform specific initialization
   OS::Startup();
 
-#ifndef SPS_STANDALONE
   set_stderr_callback(mozilla_sampler_log);
-#endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
   if (mozilla::jni::IsFennec()) {
     GeckoJavaSampler::Init();
   }
 #endif
 
   // We can't open pref so we use an environment variable
@@ -623,19 +611,17 @@ void mozilla_sampler_shutdown()
         t->ToStreamAsJSON(stream);
         stream.close();
       }
     }
   }
 
   profiler_stop();
 
-#ifndef SPS_STANDALONE
   set_stderr_callback(nullptr);
-#endif
 
   Sampler::Shutdown();
 
 #ifdef SPS_STANDALONE
   mozilla::TimeStamp::Shutdown();
 #endif
 
   PseudoStack *stack = tlsPseudoStack.get();
@@ -665,17 +651,16 @@ mozilla::UniquePtr<char[]> mozilla_sampl
   GeckoSampler *t = tlsTicker.get();
   if (!t) {
     return nullptr;
   }
 
   return t->ToJSON(aSinceTime);
 }
 
-#ifndef SPS_STANDALONE
 JSObject *mozilla_sampler_get_profile_data(JSContext *aCx, double aSinceTime)
 {
   GeckoSampler *t = tlsTicker.get();
   if (!t) {
     return nullptr;
   }
 
   return t->ToJSObject(aCx, aSinceTime);
@@ -752,18 +737,16 @@ void mozilla_sampler_get_gatherer(nsISup
   if (NS_WARN_IF(!t)) {
     *aRetVal = nullptr;
     return;
   }
 
   t->GetGatherer(aRetVal);
 }
 
-#endif
-
 void mozilla_sampler_save_profile_to_file(const char* aFilename)
 {
   GeckoSampler *t = tlsTicker.get();
   if (!t) {
     return;
   }
 
   std::ofstream stream;
@@ -881,51 +864,46 @@ void mozilla_sampler_start(int aProfileE
         if (info->IsPendingDelete()) {
           continue;
         }
         ThreadProfile* thread_profile = info->Profile();
         if (!thread_profile) {
           continue;
         }
         thread_profile->GetPseudoStack()->reinitializeOnResume();
-#ifndef SPS_STANDALONE
         if (t->ProfileJS()) {
           thread_profile->GetPseudoStack()->enableJSSampling();
         }
         if (t->InPrivacyMode()) {
           thread_profile->GetPseudoStack()->mPrivacyMode = true;
         }
-#endif
       }
   }
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
   if (t->ProfileJava()) {
     int javaInterval = aInterval;
     // Java sampling doesn't accuratly keep up with 1ms sampling
     if (javaInterval < 10) {
       aInterval = 10;
     }
     java::GeckoJavaSampler::Start(javaInterval, 1000);
   }
 #endif
 
-#ifndef SPS_STANDALONE
   if (t->AddMainThreadIO()) {
     if (!sInterposeObserver) {
       // Lazily create IO interposer observer
       sInterposeObserver = new mozilla::ProfilerIOInterposeObserver();
     }
     mozilla::IOInterposer::Register(mozilla::IOInterposeObserver::OpAll,
                                     sInterposeObserver);
   }
-#endif
 
   sIsProfiling = true;
-#ifndef SPS_STANDALONE
   sIsGPUProfiling = t->ProfileGPU();
   sIsLayersDump = t->LayersDump();
   sIsDisplayListDump = t->DisplayListDump();
   sIsRestyleProfiling = t->ProfileRestyle();
 
   if (Sampler::CanNotifyObservers()) {
     nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
     if (os) {
@@ -942,17 +920,16 @@ void mozilla_sampler_start(int aProfileE
 
       nsCOMPtr<nsIProfilerStartParams> params =
         new nsProfilerStartParams(aProfileEntries, aInterval, featuresArray,
                                   threadNameFiltersArray);
 
       os->NotifyObservers(params, "profiler-started", nullptr);
     }
   }
-#endif
 
   LOG("END   mozilla_sampler_start");
 }
 
 void mozilla_sampler_stop()
 {
   LOG("BEGIN mozilla_sampler_stop");
 
@@ -966,76 +943,68 @@ void mozilla_sampler_stop()
   }
 
   bool disableJS = t->ProfileJS();
 
   t->Stop();
   delete t;
   tlsTicker.set(nullptr);
 
-#ifndef SPS_STANDALONE
   if (disableJS) {
     PseudoStack *stack = tlsPseudoStack.get();
     ASSERT(stack != nullptr);
     stack->disableJSSampling();
   }
 
   mozilla::IOInterposer::Unregister(mozilla::IOInterposeObserver::OpAll,
                                     sInterposeObserver);
   sInterposeObserver = nullptr;
-#endif
 
   sIsProfiling = false;
-#ifndef SPS_STANDALONE
   sIsGPUProfiling = false;
   sIsLayersDump = false;
   sIsDisplayListDump = false;
   sIsRestyleProfiling = false;
 
   if (Sampler::CanNotifyObservers()) {
     nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
     if (os)
       os->NotifyObservers(nullptr, "profiler-stopped", nullptr);
   }
-#endif
 
   LOG("END   mozilla_sampler_stop");
 }
 
 bool mozilla_sampler_is_paused() {
   if (Sampler::GetActiveSampler()) {
     return Sampler::GetActiveSampler()->IsPaused();
   } else {
     return false;
   }
 }
 
 void mozilla_sampler_pause() {
   if (Sampler::GetActiveSampler()) {
     Sampler::GetActiveSampler()->SetPaused(true);
-#ifndef SPS_STANDALONE
-  if (Sampler::CanNotifyObservers()) {
-    nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
-    if (os)
-      os->NotifyObservers(nullptr, "profiler-paused", nullptr);
-  }
-#endif
+    if (Sampler::CanNotifyObservers()) {
+      nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
+      if (os)
+        os->NotifyObservers(nullptr, "profiler-paused", nullptr);
+    }
   }
 }
 
 void mozilla_sampler_resume() {
   if (Sampler::GetActiveSampler()) {
     Sampler::GetActiveSampler()->SetPaused(false);
-#ifndef SPS_STANDALONE
-  if (Sampler::CanNotifyObservers()) {
-    nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
-    if (os)
-      os->NotifyObservers(nullptr, "profiler-resumed", nullptr);
-  }
-#endif
+    if (Sampler::CanNotifyObservers()) {
+      nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
+      if (os)
+        os->NotifyObservers(nullptr, "profiler-resumed", nullptr);
+    }
   }
 }
 
 bool mozilla_sampler_feature_active(const char* aName)
 {
   if (!profiler_is_active()) {
     return false;
   }
@@ -1072,30 +1041,26 @@ void mozilla_sampler_responsiveness(cons
 void mozilla_sampler_frame_number(int frameNumber)
 {
   sFrameNumber = frameNumber;
 }
 
 void mozilla_sampler_lock()
 {
   profiler_stop();
-#ifndef SPS_STANDALONE
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (os)
     os->NotifyObservers(nullptr, "profiler-locked", nullptr);
-#endif
 }
 
 void mozilla_sampler_unlock()
 {
-#ifndef SPS_STANDALONE
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (os)
     os->NotifyObservers(nullptr, "profiler-unlocked", nullptr);
-#endif
 }
 
 bool mozilla_sampler_register_thread(const char* aName, void* aGuessStackTop)
 {
   if (sInitCount == 0) {
     return false;
   }
 
@@ -1276,17 +1241,16 @@ void mozilla_sampler_add_marker(const ch
   }
 
   mozilla::TimeStamp origin = (aPayload && !aPayload->GetStartTime().IsNull()) ?
                      aPayload->GetStartTime() : mozilla::TimeStamp::Now();
   mozilla::TimeDuration delta = origin - sStartTime;
   stack->addMarker(aMarker, payload.release(), delta.ToMilliseconds());
 }
 
-#ifndef SPS_STANDALONE
 #include "mozilla/Mutex.h"
 
 class GeckoMutex : public ::Mutex {
  public:
   explicit GeckoMutex(const char* aDesc) :
     mMutex(aDesc)
   {}
 
@@ -1305,42 +1269,10 @@ class GeckoMutex : public ::Mutex {
  private:
   mozilla::Mutex mMutex;
 };
 
 mozilla::UniquePtr< ::Mutex> OS::CreateMutex(const char* aDesc) {
   return mozilla::MakeUnique<GeckoMutex>(aDesc);
 }
 
-#else
-// Otherwise use c++11 Mutex
-#include <mutex>
-
-class OSXMutex : public ::Mutex {
- public:
-  OSXMutex(const char* aDesc) :
-    mMutex()
-  {}
-
-  virtual ~OSXMutex() {}
-
-  virtual int Lock() {
-    mMutex.lock();
-    return 0;
-  }
-
-  virtual int Unlock() {
-    mMutex.unlock();
-    return 0;
-  }
-
- private:
-  std::mutex mMutex;
-};
-
-mozilla::UniquePtr< ::Mutex> OS::CreateMutex(const char* aDesc) {
-  return mozilla::MakeUnique<GeckoMutex>(aDesc);
-}
-
-#endif
-
 // END externally visible functions
 ////////////////////////////////////////////////////////////////////////
--- a/tools/profiler/core/platform.h
+++ b/tools/profiler/core/platform.h
@@ -41,21 +41,19 @@
 #endif
 
 #ifdef XP_UNIX
 #include <pthread.h>
 #endif
 
 #include <stdint.h>
 #include <math.h>
-#ifndef SPS_STANDALONE
 #include "MainThreadUtils.h"
 #include "mozilla/Mutex.h"
 #include "ThreadResponsiveness.h"
-#endif
 #include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Unused.h"
 #include "PlatformMacros.h"
 #include "v8-support.h"
 #include <vector>
 #include "StackTop.h"
 
--- a/tools/profiler/public/GeckoProfiler.h
+++ b/tools/profiler/public/GeckoProfiler.h
@@ -46,36 +46,32 @@
  *
  */
 
 #ifndef SAMPLER_H
 #define SAMPLER_H
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
-#ifndef SPS_STANDALONE
 #include "js/TypeDecls.h"
-#endif
 #include "mozilla/GuardObjects.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Vector.h"
 #include "GeckoProfilerTypes.h"
 
 namespace mozilla {
 class TimeStamp;
 
 namespace dom {
 class Promise;
 } // namespace dom
 
 } // namespace mozilla
 
-#ifndef SPS_STANDALONE
 class nsIProfilerStartParams;
-#endif
 
 enum TracingMetadata {
   TRACING_DEFAULT,
   TRACING_INTERVAL_START,
   TRACING_INTERVAL_END,
   TRACING_EVENT,
   TRACING_EVENT_BACKTRACE,
   TRACING_TIMESTAMP
@@ -180,25 +176,23 @@ static inline mozilla::UniquePtr<char[]>
 }
 
 // Get the profile encoded as a JSON object.
 static inline JSObject* profiler_get_profile_jsobject(JSContext* aCx,
                                                       double aSinceTime = 0) {
   return nullptr;
 }
 
-#ifndef SPS_STANDALONE
 // Get the profile encoded as a JSON object.
 static inline void profiler_get_profile_jsobject_async(double aSinceTime = 0,
                                                        mozilla::dom::Promise* = 0) {}
 static inline void profiler_get_start_params(int* aEntrySize,
                                              double* aInterval,
                                              mozilla::Vector<const char*>* aFilters,
                                              mozilla::Vector<const char*>* aFeatures) {}
-#endif
 
 // Get the profile and write it into a file
 static inline void profiler_save_profile_to_file(char* aFilename) { }
 
 // Get the features supported by the profiler that are accepted by profiler_init.
 // Returns a null terminated char* array.
 static inline char** profiler_get_features() { return nullptr; }
 
--- a/tools/profiler/public/GeckoProfilerFunc.h
+++ b/tools/profiler/public/GeckoProfilerFunc.h
@@ -1,19 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef PROFILER_FUNCS_H
 #define PROFILER_FUNCS_H
 
-#ifndef SPS_STANDALONE
 #include "js/TypeDecls.h"
-#endif
 #include "js/ProfilingStack.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Vector.h"
 #include "GeckoProfilerTypes.h"
 #include <stdint.h>
 
 class nsISupports;
 
@@ -62,29 +60,27 @@ void mozilla_sampler_responsiveness(cons
 void mozilla_sampler_frame_number(int frameNumber);
 
 const double* mozilla_sampler_get_responsiveness();
 
 void mozilla_sampler_save();
 
 mozilla::UniquePtr<char[]> mozilla_sampler_get_profile(double aSinceTime);
 
-#ifndef SPS_STANDALONE
 JSObject *mozilla_sampler_get_profile_data(JSContext* aCx, double aSinceTime);
 void mozilla_sampler_get_profile_data_async(double aSinceTime,
                                             mozilla::dom::Promise* aPromise);
 MOZ_EXPORT
 void mozilla_sampler_save_profile_to_file_async(double aSinceTime,
                                                 const char* aFileName);
 void mozilla_sampler_get_profiler_start_params(int* aEntrySize,
                                                double* aInterval,
                                                mozilla::Vector<const char*>* aFilters,
                                                mozilla::Vector<const char*>* aFeatures);
 void mozilla_sampler_get_gatherer(nsISupports** aRetVal);
-#endif
 
 // Make this function easily callable from a debugger in a build without
 // debugging information (work around http://llvm.org/bugs/show_bug.cgi?id=22211)
 extern "C" {
   void mozilla_sampler_save_profile_to_file(const char* aFilename);
 }
 
 const char** mozilla_sampler_get_features();
--- a/tools/profiler/public/GeckoProfilerImpl.h
+++ b/tools/profiler/public/GeckoProfilerImpl.h
@@ -10,20 +10,18 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <stdarg.h>
 #include "mozilla/Assertions.h"
 #include "mozilla/GuardObjects.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/ThreadLocal.h"
 #include "mozilla/UniquePtr.h"
-#ifndef SPS_STANDALONE
 #include "nscore.h"
 #include "nsISupports.h"
-#endif
 #include "GeckoProfilerFunc.h"
 #include "PseudoStack.h"
 #include "ProfilerBacktrace.h"
 
 // Make sure that we can use std::min here without the Windows headers messing with us.
 #ifdef min
 #undef min
 #endif
@@ -130,17 +128,16 @@ void profiler_set_frame_number(int frame
 }
 
 static inline
 mozilla::UniquePtr<char[]> profiler_get_profile(double aSinceTime = 0)
 {
   return mozilla_sampler_get_profile(aSinceTime);
 }
 
-#ifndef SPS_STANDALONE
 static inline
 JSObject* profiler_get_profile_jsobject(JSContext* aCx, double aSinceTime = 0)
 {
   return mozilla_sampler_get_profile_data(aCx, aSinceTime);
 }
 
 static inline
 void profiler_get_profile_jsobject_async(double aSinceTime = 0,
@@ -159,18 +156,16 @@ void profiler_get_start_params(int* aEnt
 }
 
 static inline
 void profiler_get_gatherer(nsISupports** aRetVal)
 {
   mozilla_sampler_get_gatherer(aRetVal);
 }
 
-#endif
-
 static inline
 void profiler_save_profile_to_file(const char* aFilename)
 {
   return mozilla_sampler_save_profile_to_file(aFilename);
 }
 
 static inline
 const char** profiler_get_features()
@@ -222,28 +217,26 @@ void profiler_sleep_end()
 }
 
 static inline
 bool profiler_is_sleeping()
 {
   return mozilla_sampler_is_sleeping();
 }
 
-#ifndef SPS_STANDALONE
 static inline
 void profiler_js_operation_callback()
 {
   PseudoStack *stack = tlsPseudoStack.get();
   if (!stack) {
     return;
   }
 
   stack->jsOperationCallback();
 }
-#endif
 
 static inline
 double profiler_time()
 {
   return mozilla_sampler_time();
 }
 
 static inline
--- a/tools/profiler/public/ProfilerMarkers.h
+++ b/tools/profiler/public/ProfilerMarkers.h
@@ -6,16 +6,18 @@
 #ifndef PROFILER_MARKERS_H
 #define PROFILER_MARKERS_H
 
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Attributes.h"
 
 #include "GeckoProfiler.h"
 
+#include "gfxASurface.h"
+
 namespace mozilla {
 namespace layers {
 class Layer;
 } // namespace layers
 } // namespace mozilla
 
 class SpliceableJSONWriter;
 class UniqueStacks;
@@ -81,19 +83,16 @@ public:
   virtual void StreamPayload(SpliceableJSONWriter& aWriter,
                              UniqueStacks& aUniqueStacks) override;
 
 private:
   const char *mCategory;
   TracingMetadata mMetaData;
 };
 
-
-#ifndef SPS_STANDALONE
-#include "gfxASurface.h"
 class ProfilerMarkerImagePayload : public ProfilerMarkerPayload
 {
 public:
   explicit ProfilerMarkerImagePayload(gfxASurface *aImg);
 
   virtual void StreamPayload(SpliceableJSONWriter& aWriter,
                              UniqueStacks& aUniqueStacks) override;
 
@@ -199,11 +198,10 @@ public:
                              UniqueStacks& aUniqueStacks) override;
 
 private:
   mozilla::TimeStamp mCpuTimeStart;
   mozilla::TimeStamp mCpuTimeEnd;
   uint64_t mGpuTimeStart;
   uint64_t mGpuTimeEnd;
 };
-#endif
 
 #endif // PROFILER_MARKERS_H
--- a/tools/profiler/public/PseudoStack.h
+++ b/tools/profiler/public/PseudoStack.h
@@ -6,19 +6,17 @@
 #ifndef PROFILER_PSEUDO_STACK_H_
 #define PROFILER_PSEUDO_STACK_H_
 
 #include "mozilla/ArrayUtils.h"
 #include <stdint.h>
 #include "js/ProfilingStack.h"
 #include <stdlib.h>
 #include "mozilla/Atomics.h"
-#ifndef SPS_STANDALONE
 #include "nsISupportsImpl.h"
-#endif
 
 /* we duplicate this code here to avoid header dependencies
  * which make it more difficult to include in other places */
 #if defined(_M_X64) || defined(__x86_64__)
 #define V8_HOST_ARCH_X64 1
 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
 #define V8_HOST_ARCH_IA32 1
 #elif defined(__ARMEL__)
@@ -311,17 +309,16 @@ public:
     return mStackPointer == 0;
   }
   uint32_t stackSize() const
   {
     return sMin(mStackPointer, mozilla::sig_safe_t(mozilla::ArrayLength(mStack)));
   }
 
   void sampleContext(JSContext* context) {
-#ifndef SPS_STANDALONE
     if (mContext && !context) {
       // On JS shut down, flush the current buffer as stringifying JIT samples
       // requires a live JSContext.
       flushSamplerOnJSShutdown();
     }
 
     mContext = context;
 
@@ -332,19 +329,17 @@ public:
     static_assert(sizeof(mStack[0]) == sizeof(js::ProfileEntry),
                   "mStack must be binary compatible with js::ProfileEntry.");
     js::SetContextProfilingStack(context,
                                  (js::ProfileEntry*) mStack,
                                  (uint32_t*) &mStackPointer,
                                  (uint32_t) mozilla::ArrayLength(mStack));
     if (mStartJSSampling)
       enableJSSampling();
-#endif
   }
-#ifndef SPS_STANDALONE
   void enableJSSampling() {
     if (mContext) {
       js::EnableContextProfilingStack(mContext, true);
       js::RegisterContextProfilingEventMarker(mContext, &ProfilerJSEventMarker);
       mStartJSSampling = false;
     } else {
       mStartJSSampling = true;
     }
@@ -353,32 +348,29 @@ public:
     if (mStartJSSampling)
       enableJSSampling();
   }
   void disableJSSampling() {
     mStartJSSampling = false;
     if (mContext)
       js::EnableContextProfilingStack(mContext, false);
   }
-#endif
 
   // Keep a list of active checkpoints
   StackEntry volatile mStack[1024];
  private:
 
   // A PseudoStack can only be created via the "create" method.
   PseudoStack()
     : mStackPointer(0)
     , mSleepId(0)
     , mSleepIdObserved(0)
     , mSleeping(false)
     , mRefCnt(1)
-#ifndef SPS_STANDALONE
     , mContext(nullptr)
-#endif
     , mStartJSSampling(false)
     , mPrivacyMode(false)
   {
     MOZ_COUNT_CTOR(PseudoStack);
   }
 
   // A PseudoStack can only be deleted via deref.
   ~PseudoStack() {
@@ -411,20 +403,18 @@ public:
   // Keeps tack of whether the thread is sleeping or not (1 when sleeping 0 when awake)
   mozilla::Atomic<int> mSleeping;
   // This class is reference counted because it must be kept alive by
   // the ThreadInfo, by the reference from tlsPseudoStack, and by the
   // current thread when callbacks are in progress.
   mozilla::Atomic<int> mRefCnt;
 
  public:
-#ifndef SPS_STANDALONE
   // The context which is being sampled
   JSContext *mContext;
-#endif
   // Start JS Profiling when possible
   bool mStartJSSampling;
   bool mPrivacyMode;
 
   enum SleepState {NOT_SLEEPING, SLEEPING_FIRST, SLEEPING_AGAIN};
 
   // The first time this is called per sleep cycle we return SLEEPING_FIRST
   // and any other subsequent call within the same sleep cycle we return SLEEPING_AGAIN
--- a/tools/profiler/public/shared-libraries.h
+++ b/tools/profiler/public/shared-libraries.h
@@ -11,19 +11,17 @@
 #error This header does not have a useful implementation on your platform!
 #endif
 
 #include <algorithm>
 #include <vector>
 #include <string>
 #include <stdlib.h>
 #include <stdint.h>
-#ifndef SPS_STANDALONE
 #include <nsID.h>
-#endif
 
 class SharedLibrary {
 public:
 
   SharedLibrary(uintptr_t aStart,
                 uintptr_t aEnd,
                 uintptr_t aOffset,
                 const std::string& aBreakpadId,