Bug 1533636 - Define XDRBufferBase::{is,set}Aligned only once, and move #ifdef DEBUG into function definitions. r=tcampbell
authorJeff Walden <jwalden@mit.edu>
Mon, 04 Mar 2019 18:01:08 -0800
changeset 521364 a4438c2ef6a3301d41ea17f6f4b5ab5f7f906263
parent 521363 211218d95e2c73d3e0c6a1b1911dc602d24ab8e7
child 521365 0e054a2c650a484e6a547d5fa4a6cde490445b53
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1533636
milestone67.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 1533636 - Define XDRBufferBase::{is,set}Aligned only once, and move #ifdef DEBUG into function definitions. r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D22650
js/src/vm/Xdr.h
--- a/js/src/vm/Xdr.h
+++ b/js/src/vm/Xdr.h
@@ -41,27 +41,33 @@ class XDRBufferBase {
 #endif
   {
   }
 
   JSContext* cx() const { return context_; }
 
   size_t cursor() const { return cursor_; }
 
-#ifdef DEBUG
   // This function records if the cursor got changed by codeAlign or by any
   // other read/write of data. This is used for AutoXDRTree assertions, as a
   // way to ensure that the last thing done is properly setting the alignment
   // with codeAlign function.
-  void setAligned(bool aligned) { aligned_ = aligned; }
-  bool isAligned() const { return aligned_; }
+  void setAligned(bool aligned) {
+#ifdef DEBUG
+    aligned_ = aligned;
+#endif
+  }
+
+  bool isAligned() const {
+#ifdef DEBUG
+    return aligned_;
 #else
-  void setAligned(bool) const {}
-  bool isAligned() const { return true; }
+    return true;
 #endif
+  }
 
  protected:
   JSContext* const context_;
   size_t cursor_;
 #ifdef DEBUG
   bool aligned_;
 #endif
 };