Bug 1282795 - Extract a side effect on a variable from an assertion expression to avoid a clang compiler warning when a side-effectful expression occurs in an unevaluated context. r=froydnj
authorJeff Walden <jwalden@mit.edu>
Tue, 28 Jun 2016 17:14:18 +0100
changeset 303020 00aadbafd1140805346013c0ab505a96294cbe25
parent 303019 6fef5909e6174def4b8d545dfd239a491055fa90
child 303021 9b85f918f0db94b8bb5875069686406cc3b19023
push id78958
push userjwalden@mit.edu
push dateWed, 29 Jun 2016 09:35:06 +0000
treeherdermozilla-inbound@00aadbafd114 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1282795
milestone50.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 1282795 - Extract a side effect on a variable from an assertion expression to avoid a clang compiler warning when a side-effectful expression occurs in an unevaluated context. r=froydnj
js/src/vm/StructuredClone.cpp
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -883,18 +883,20 @@ JSStructuredCloneWriter::checkStack()
         total += counts[i];
     }
     if (counts.length() <= MAX)
         MOZ_ASSERT(total == entries.length());
     else
         MOZ_ASSERT(total <= entries.length());
 
     size_t j = objs.length();
-    for (size_t i = 0; i < limit; i++)
-        MOZ_ASSERT(memory.has(&objs[--j].toObject()));
+    for (size_t i = 0; i < limit; i++) {
+        --j;
+        MOZ_ASSERT(memory.has(&objs[j].toObject()));
+    }
 #endif
 }
 
 /*
  * Write out a typed array. Note that post-v1 structured clone buffers do not
  * perform endianness conversion on stored data, so multibyte typed arrays
  * cannot be deserialized into a different endianness machine. Endianness
  * conversion would prevent sharing ArrayBuffers: if you have Int8Array and