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

Unified Diff: src/ia32/cpu-ia32.cc

Issue 13612: Notify valgrind when we modify code on x86. (Closed)
Patch Set: Merge. Created 11 years, 5 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 | « LICENSE ('k') | src/third_party/valgrind/valgrind.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/cpu-ia32.cc
diff --git a/src/ia32/cpu-ia32.cc b/src/ia32/cpu-ia32.cc
index 82a5565700df67695f4854a33db9c72ca4ea8a93..2107ad96f4bbb90db3d968d7cd62773b075e46cd 100644
--- a/src/ia32/cpu-ia32.cc
+++ b/src/ia32/cpu-ia32.cc
@@ -27,6 +27,10 @@
// CPU specific code for ia32 independent of OS goes here.
+#ifdef __GNUC__
+#include "third_party/valgrind/valgrind.h"
iposva 2009/07/23 18:01:57 The code in valgrind.h does not appear to distingu
+#endif
+
#include "v8.h"
#include "cpu.h"
@@ -49,6 +53,15 @@ void CPU::FlushICache(void* start, size_t size) {
// If flushing of the instruction cache becomes necessary Windows has the
// API function FlushInstructionCache.
+
+ // By default, valgrind only checks the stack for writes that might need to
+ // invalidate already cached translated code. This leads to random
+ // instability when code patches or moves are sometimes unnoticed. One
+ // solution is to run valgrind with --smc-check=all, but this comes at a big
+ // performance cost. We can notify valgrind to invalidate its cache.
+#ifdef VALGRIND_DISCARD_TRANSLATIONS
+ VALGRIND_DISCARD_TRANSLATIONS(start, size);
+#endif
}
« no previous file with comments | « LICENSE ('k') | src/third_party/valgrind/valgrind.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698