Bug 1152415 - OdinMonkey: Zero out struct padding to avoid valgrind warnings r=luke
authorDan Gohman <sunfish@mozilla.com>
Wed, 08 Apr 2015 11:41:09 -0700
changeset 268097 1a5a05356bb9fa35c40774f475d21c668867a9c9
parent 268096 b42d9bedcbf0bd2fa145de9bd121c3863fd1f8ea
child 268098 2d75c37883a0fa30016fd7979cff6cfa98f26553
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-beta@4c2175bb0420 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1152415
milestone40.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 1152415 - OdinMonkey: Zero out struct padding to avoid valgrind warnings r=luke
js/src/asmjs/AsmJSModule.h
js/src/jit/shared/Assembler-shared.h
--- a/js/src/asmjs/AsmJSModule.h
+++ b/js/src/asmjs/AsmJSModule.h
@@ -246,16 +246,17 @@ class AsmJSModule
                 } constant;
             } u;
         } pod;
         PropertyName* name_;
 
         friend class AsmJSModule;
 
         Global(Which which, PropertyName* name) {
+            mozilla::PodZero(&pod);  // zero padding for Valgrind
             pod.which_ = which;
             name_ = name;
             MOZ_ASSERT_IF(name_, name_->isTenured());
         }
 
         void trace(JSTracer* trc) {
             if (name_)
                 TraceManuallyBarrieredEdge(trc, &name_, "asm.js global name");
--- a/js/src/jit/shared/Assembler-shared.h
+++ b/js/src/jit/shared/Assembler-shared.h
@@ -789,37 +789,42 @@ class AsmJSHeapAccess
 #if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
     static const uint32_t NoLengthCheck = UINT32_MAX;
 #endif
 
 #if defined(JS_CODEGEN_X86)
     // If 'cmp' equals 'insnOffset' or if it is not supplied then the
     // cmpDelta_ is zero indicating that there is no length to patch.
     AsmJSHeapAccess(uint32_t insnOffset, uint32_t after, uint32_t cmp = NoLengthCheck)
-      : insnOffset_(insnOffset),
-        opLength_(after - insnOffset),
-        cmpDelta_(cmp == NoLengthCheck ? 0 : insnOffset - cmp)
-    {}
+    {
+        mozilla::PodZero(this);  // zero padding for Valgrind
+        insnOffset_ = insnOffset;
+        opLength_ = after - insnOffset;
+        cmpDelta_ = cmp == NoLengthCheck ? 0 : insnOffset - cmp;
+    }
 #elif defined(JS_CODEGEN_X64)
     // If 'cmp' equals 'insnOffset' or if it is not supplied then the
     // cmpDelta_ is zero indicating that there is no length to patch.
     AsmJSHeapAccess(uint32_t insnOffset, WhatToDoOnOOB oob,
                     uint32_t cmp = NoLengthCheck,
                     uint32_t offsetWithinWholeSimdVector = 0)
-      : insnOffset_(insnOffset),
-        offsetWithinWholeSimdVector_(offsetWithinWholeSimdVector),
-        throwOnOOB_(oob == Throw),
-        cmpDelta_(cmp == NoLengthCheck ? 0 : insnOffset - cmp)
     {
+        mozilla::PodZero(this);  // zero padding for Valgrind
+        insnOffset_ = insnOffset;
+        offsetWithinWholeSimdVector_ = offsetWithinWholeSimdVector;
+        throwOnOOB_ = oob == Throw;
+        cmpDelta_ = cmp == NoLengthCheck ? 0 : insnOffset - cmp;
         MOZ_ASSERT(offsetWithinWholeSimdVector_ == offsetWithinWholeSimdVector);
     }
 #elif defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS)
     explicit AsmJSHeapAccess(uint32_t insnOffset)
-      : insnOffset_(insnOffset)
-    {}
+    {
+        mozilla::PodZero(this);  // zero padding for Valgrind
+        insnOffset_ = insnOffset;
+    }
 #endif
 
     uint32_t insnOffset() const { return insnOffset_; }
     void setInsnOffset(uint32_t insnOffset) { insnOffset_ = insnOffset; }
 #if defined(JS_CODEGEN_X86)
     void* patchHeapPtrImmAt(uint8_t* code) const { return code + (insnOffset_ + opLength_); }
 #endif
 #if defined(JS_CODEGEN_X64)