Bug 1152415 - OdinMonkey: Zero out struct padding to avoid valgrind warnings r=luke

This commit is contained in:
Dan Gohman 2015-04-08 11:41:09 -07:00
Родитель 2350ad3591
Коммит 55a78d2d88
2 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -251,6 +251,7 @@ class AsmJSModule
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());

Просмотреть файл

@ -794,27 +794,32 @@ class AsmJSHeapAccess
// 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_; }