Bug 815931 - Fix up valgrind stack-scan annotations. r=terrence
authorRalph Giles <giles@thaumas.net>
Thu, 06 Dec 2012 13:19:58 -0800
changeset 115503 90d31802945123b94cfc3a848c31167c40f567a0
parent 115502 100a1ea225f34f674ec74387463549d03d934feb
child 115504 5b80ceb7da7270678668ddae46b76d2b73e4a32f
push id19374
push userryanvm@gmail.com
push dateMon, 10 Dec 2012 14:06:34 +0000
treeherdermozilla-inbound@21d667b49f3a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs815931
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 815931 - Fix up valgrind stack-scan annotations. r=terrence Conditionalize on MOZ_VALGRIND instead of aliasing it to JS_VALGRIND, and add includes for the memcheck macros. The memcheck header is removed from jsgc.cpp, where is is no longer necessary.
js/src/gc/RootMarking.cpp
js/src/gc/Verifier.cpp
js/src/jsgc.cpp
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -22,16 +22,20 @@
 # include "ion/IonFrameIterator.h"
 #endif
 #include "js/HashTable.h"
 #include "vm/Debugger.h"
 
 #include "jsgcinlines.h"
 #include "jsobjinlines.h"
 
+#ifdef MOZ_VALGRIND
+# include <valgrind/memcheck.h>
+#endif
+
 using namespace js;
 using namespace js::gc;
 
 using mozilla::ArrayEnd;
 
 typedef RootedValueMap::Range RootRange;
 typedef RootedValueMap::Entry RootEntry;
 typedef RootedValueMap::Enum RootEnum;
@@ -250,17 +254,17 @@ static void
 MarkWordConservatively(JSTracer *trc, uintptr_t w)
 {
     /*
      * The conservative scanner may access words that valgrind considers as
      * undefined. To avoid false positives and not to alter valgrind view of
      * the memory we make as memcheck-defined the argument, a copy of the
      * original word. See bug 572678.
      */
-#ifdef JS_VALGRIND
+#ifdef MOZ_VALGRIND
     JS_SILENCE_UNUSED_VALUE_IN_EXPR(VALGRIND_MAKE_MEM_DEFINED(&w, sizeof(w)));
 #endif
 
     MarkIfGCThingWord(trc, w);
 }
 
 MOZ_ASAN_BLACKLIST
 static void
--- a/js/src/gc/Verifier.cpp
+++ b/js/src/gc/Verifier.cpp
@@ -11,16 +11,20 @@
 #include "jsprf.h"
 #include "jsutil.h"
 
 #include "js/HashTable.h"
 #include "gc/GCInternals.h"
 
 #include "jsgcinlines.h"
 
+#ifdef MOZ_VALGRIND
+# include <valgrind/memcheck.h>
+#endif
+
 using namespace js;
 using namespace js::gc;
 
 #if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
 
 JS_ALWAYS_INLINE bool
 CheckStackRootThing(uintptr_t *w, void *address, ThingRootKind kind)
 {
@@ -35,17 +39,17 @@ struct Rooter {
     Rooted<void*> *rooter;
     ThingRootKind kind;
 };
 
 static void
 CheckStackRoot(JSRuntime *rt, uintptr_t *w, Rooter *begin, Rooter *end)
 {
     /* Mark memory as defined for valgrind, as in MarkWordConservatively. */
-#ifdef JS_VALGRIND
+#ifdef MOZ_VALGRIND
     VALGRIND_MAKE_MEM_DEFINED(&w, sizeof(w));
 #endif
 
     void *thing;
     ArenaHeader *aheader;
     AllocKind thingKind;
     ConservativeGCTest status =
         IsAddressableGCThing(rt, *w, false, &thingKind, &aheader, &thing);
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -90,23 +90,16 @@
 #include "jsgcinlines.h"
 #include "jsinterpinlines.h"
 #include "jsobjinlines.h"
 
 #include "gc/FindSCCs-inl.h"
 #include "vm/ScopeObject-inl.h"
 #include "vm/String-inl.h"
 
-#ifdef MOZ_VALGRIND
-# define JS_VALGRIND
-#endif
-#ifdef JS_VALGRIND
-# include <valgrind/memcheck.h>
-#endif
-
 #ifdef XP_WIN
 # include "jswin.h"
 #else
 # include <unistd.h>
 #endif
 
 #if JS_TRACE_LOGGING
 #include "TraceLogging.h"