Bug 1419637 - do not call memset on a non-trivial type. r=jandem
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Thu, 23 Nov 2017 10:57:10 +0200
changeset 437973 da6568fa82df358453279e7ec5c22be7b8aad7c0
parent 437972 11885fe0fa5e0b49499057d945d39ef4c08c7515
child 437974 f320e72a945f5f2c39c6a8fbddb30f3ada3834fe
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersjandem
bugs1419637
milestone59.0a1
Bug 1419637 - do not call memset on a non-trivial type. r=jandem MozReview-Commit-ID: DSTv14zw8Tp
js/src/jit/shared/Assembler-shared.h
--- a/js/src/jit/shared/Assembler-shared.h
+++ b/js/src/jit/shared/Assembler-shared.h
@@ -309,17 +309,18 @@ struct PatchedAbsoluteAddress
 struct Address
 {
     Register base;
     int32_t offset;
 
     Address(Register base, int32_t offset) : base(base), offset(offset)
     { }
 
-    Address() { mozilla::PodZero(this); }
+    Address() : base(Registers::Invalid), offset(0)
+    { }
 };
 
 #if JS_BITS_PER_WORD == 32
 
 static inline Address
 LowWord(const Address& address) {
     CheckedInt<int32_t> offset = CheckedInt<int32_t>(address.offset) + INT64LOW_OFFSET;
     MOZ_ALWAYS_TRUE(offset.isValid());
@@ -343,17 +344,22 @@ struct BaseIndex
     Register index;
     Scale scale;
     int32_t offset;
 
     BaseIndex(Register base, Register index, Scale scale, int32_t offset = 0)
       : base(base), index(index), scale(scale), offset(offset)
     { }
 
-    BaseIndex() { mozilla::PodZero(this); }
+    BaseIndex()
+      : base(Registers::Invalid)
+      , index(Registers::Invalid)
+      , scale(TimesOne)
+      , offset(0)
+    {}
 };
 
 #if JS_BITS_PER_WORD == 32
 
 static inline BaseIndex
 LowWord(const BaseIndex& address) {
     CheckedInt<int32_t> offset = CheckedInt<int32_t>(address.offset) + INT64LOW_OFFSET;
     MOZ_ALWAYS_TRUE(offset.isValid());