summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-20 23:29:23 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-20 23:29:23 +0000
commit26f54611eef9cfcd3318e6ed3512cea4679e622e (patch)
tree7c5b799438578883d628b034588a974d9f185981 /base
parent7cb308099ffcb330f52f3b32553d1b5c3d950f19 (diff)
downloadchromium_src-26f54611eef9cfcd3318e6ed3512cea4679e622e.zip
chromium_src-26f54611eef9cfcd3318e6ed3512cea4679e622e.tar.gz
chromium_src-26f54611eef9cfcd3318e6ed3512cea4679e622e.tar.bz2
Try another way to alias a variable in optimized builds.
The previous way did not fool LTCG optimization. I tested that this works by doing and LTCG build without this change and verified that the compiler strips out the assignment to program_counter in MessageLoop::RunTask. Then I repeated with this change and verified that the compiler did not strip it out. TEST=compiles plus the above BUG=81449 Review URL: http://codereview.chromium.org/7054025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86172 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/debug/alias.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/base/debug/alias.cc b/base/debug/alias.cc
index 04122fb..6b0caaa 100644
--- a/base/debug/alias.cc
+++ b/base/debug/alias.cc
@@ -8,13 +8,16 @@
namespace base {
namespace debug {
-namespace {
-const void* g_global;
-}
+#if defined(COMPILER_MSVC)
+#pragma optimize("", off)
+#endif
void Alias(const void* var) {
- g_global = var;
}
+#if defined(COMPILER_MSVC)
+#pragma optimize("", on)
+#endif
+
} // namespace debug
} // namespace base