Bug 1499277 - Remove unnecessary SCInput::readNativeEndian; fix SCInput::readPtr on big endian systems. r=sfink
authorA. Wilcox <AWilcox@Wilcox-Tech.com>
Tue, 16 Oct 2018 05:43:43 +0000
changeset 441707 3a58f94c3f5a
parent 441706 7a7d5508f873
child 441708 37647eaadbc2
push id109038
push userarchaeopteryx@coole-files.de
push dateWed, 17 Oct 2018 19:09:31 +0000
treeherdermozilla-inbound@3a58f94c3f5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1499277
milestone64.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 1499277 - Remove unnecessary SCInput::readNativeEndian; fix SCInput::readPtr on big endian systems. r=sfink
js/src/vm/StructuredClone.cpp
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -361,17 +361,16 @@ class SCInput {
     SCInput(JSContext* cx, JSStructuredCloneData& data);
 
     JSContext* context() const { return cx; }
 
     static void getPtr(uint64_t data, void** ptr);
     static void getPair(uint64_t data, uint32_t* tagp, uint32_t* datap);
 
     MOZ_MUST_USE bool read(uint64_t* p);
-    MOZ_MUST_USE bool readNativeEndian(uint64_t* p);
     MOZ_MUST_USE bool readPair(uint32_t* tagp, uint32_t* datap);
     MOZ_MUST_USE bool readDouble(double* p);
     MOZ_MUST_USE bool readBytes(void* p, size_t nbytes);
     MOZ_MUST_USE bool readChars(Latin1Char* p, size_t nchars);
     MOZ_MUST_USE bool readChars(char16_t* p, size_t nchars);
     MOZ_MUST_USE bool readPtr(void**);
 
     MOZ_MUST_USE bool get(uint64_t* p);
@@ -698,28 +697,16 @@ SCInput::read(uint64_t* p)
         return reportTruncated();
     }
     *p = NativeEndian::swapFromLittleEndian(point.peek());
     point.next();
     return true;
 }
 
 bool
-SCInput::readNativeEndian(uint64_t* p)
-{
-    if (!point.canPeek()) {
-        *p = 0;  // initialize to shut GCC up
-        return reportTruncated();
-    }
-    *p = point.peek();
-    point.next();
-    return true;
-}
-
-bool
 SCInput::readPair(uint32_t* tagp, uint32_t* datap)
 {
     uint64_t u;
     bool ok = read(&u);
     if (ok) {
         *tagp = uint32_t(u >> 32);
         *datap = uint32_t(u);
     }
@@ -849,17 +836,17 @@ SCInput::getPtr(uint64_t data, void** pt
 {
     *ptr = reinterpret_cast<void*>(NativeEndian::swapFromLittleEndian(data));
 }
 
 bool
 SCInput::readPtr(void** p)
 {
     uint64_t u;
-    if (!readNativeEndian(&u)) {
+    if (!read(&u)) {
         return false;
     }
     *p = reinterpret_cast<void*>(u);
     return true;
 }
 
 SCOutput::SCOutput(JSContext* cx, JS::StructuredCloneScope scope)
   : cx(cx), buf(scope)