Bug 1016629 - c. Add define for ThreadStackHelper pseudostack support; r=snorp

This commit is contained in:
Jim Chen
2014-07-28 13:30:20 -04:00
parent 7a41d1bffa
commit 751190fb1d
2 changed files with 17 additions and 11 deletions

View File

@@ -76,11 +76,10 @@ ThreadStackHelper::Shutdown()
}
ThreadStackHelper::ThreadStackHelper()
:
#ifdef MOZ_ENABLE_PROFILER_SPS
mPseudoStack(mozilla_get_pseudo_stack()),
: mStackToFill(nullptr)
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
, mPseudoStack(mozilla_get_pseudo_stack())
#endif
mStackToFill(nullptr)
, mMaxStackSize(Stack::sMaxInlineStorage)
, mMaxBufferSize(0)
{
@@ -196,7 +195,7 @@ ThreadStackHelper::PrepareStackBuffer(Stack& aStack)
{
// Return false to skip getting the stack and return an empty stack
aStack.clear();
#ifdef MOZ_ENABLE_PROFILER_SPS
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
/* Normally, provided the profiler is enabled, it would be an error if we
don't have a pseudostack here (the thread probably forgot to call
profiler_register_thread). However, on B2G, profiling secondary threads
@@ -219,7 +218,7 @@ ThreadStackHelper::PrepareStackBuffer(Stack& aStack)
#endif
}
#ifdef MOZ_ENABLE_PROFILER_SPS
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
namespace {
@@ -287,14 +286,14 @@ ThreadStackHelper::AppendJSEntry(const volatile StackEntry* aEntry,
return label;
}
#endif // MOZ_ENABLE_PROFILER_SPS
#endif // MOZ_THREADSTACKHELPER_PSEUDO
void
ThreadStackHelper::FillStackBuffer()
{
MOZ_ASSERT(mStackToFill->empty());
#ifdef MOZ_ENABLE_PROFILER_SPS
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
size_t reservedSize = mStackToFill->capacity();
size_t reservedBufferSize = mStackToFill->AvailableBufferSize();
intptr_t availableBufferSize = intptr_t(reservedBufferSize);