Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2357)

Unified Diff: base/profiler/stack_sampling_profiler_unittest.cc

Issue 1029183002: Use a less compiler-specific way for preventing inlining / tail-call optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gcccccccc Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/profiler/stack_sampling_profiler_unittest.cc
diff --git a/base/profiler/stack_sampling_profiler_unittest.cc b/base/profiler/stack_sampling_profiler_unittest.cc
index dfccab4e1a893ae7da9c768f0e5c17aef4f9b692..ad9e92655719b6271fda394ba2fcb42711b32bbf 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698