summaryrefslogtreecommitdiffstats
path: root/base/profiler
diff options
context:
space:
mode:
authorthakis <thakis@chromium.org>2015-03-23 16:22:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-23 23:23:44 +0000
commit916eb91eabfed357395b5f0aa26490a0469ce081 (patch)
treeaa53f70bda0f2041a9e4d37f92e6e4eb23263251 /base/profiler
parent03b8f5b666728f61940ba94ed99ec7b8ad171fd0 (diff)
downloadchromium_src-916eb91eabfed357395b5f0aa26490a0469ce081.zip
chromium_src-916eb91eabfed357395b5f0aa26490a0469ce081.tar.gz
chromium_src-916eb91eabfed357395b5f0aa26490a0469ce081.tar.bz2
Use a less compiler-specific way for preventing inlining / tail-call optimization.
The current method is MSVS-specific. With just NOINLINE, clang still does a tail call, which also prevents a stack frame, so also add some dummy machinery that makes the tail-call optimization impossible. BUG=469813 Review URL: https://codereview.chromium.org/1029183002 Cr-Commit-Position: refs/heads/master@{#321895}
Diffstat (limited to 'base/profiler')
-rw-r--r--base/profiler/stack_sampling_profiler_unittest.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/base/profiler/stack_sampling_profiler_unittest.cc b/base/profiler/stack_sampling_profiler_unittest.cc
index dfccab4..ad9e926 100644
--- a/base/profiler/stack_sampling_profiler_unittest.cc
+++ b/base/profiler/stack_sampling_profiler_unittest.cc
@@ -70,19 +70,16 @@ void TargetThread::SignalThreadToFinish() {
}
// static
-#if defined(_WIN64)
-// Disable optimizations for this function so that it gets its own stack frame.
-#pragma optimize("", off)
-#endif
-void TargetThread::SignalAndWaitUntilSignaled(
+// Disable inlining for this function so that it gets its own stack frame.
+NOINLINE void TargetThread::SignalAndWaitUntilSignaled(
WaitableEvent* thread_started_event,
WaitableEvent* finish_event) {
thread_started_event->Signal();
+ volatile int x = 1;
finish_event->Wait();
+ x = 0; // Prevent tail call to WaitableEvent::Wait().
+ ALLOW_UNUSED_LOCAL(x);
}
-#if defined(_WIN64)
-#pragma optimize("", on)
-#endif
// Called on the profiler thread when complete. Collects profiles produced by
// the profiler, and signals an event to allow the main thread to know that that