summaryrefslogtreecommitdiff
path: root/experimental/firefox-esr/endianness-js.patch
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/firefox-esr/endianness-js.patch')
-rw-r--r--experimental/firefox-esr/endianness-js.patch175
1 files changed, 86 insertions, 89 deletions
diff --git a/experimental/firefox-esr/endianness-js.patch b/experimental/firefox-esr/endianness-js.patch
index 98e1bd092..1a04573ea 100644
--- a/experimental/firefox-esr/endianness-js.patch
+++ b/experimental/firefox-esr/endianness-js.patch
@@ -1,52 +1,44 @@
-# HG changeset patch
-# User Steve Fink <sfink@mozilla.com>
-# Date 1536603384 25200
-# Mon Sep 10 11:16:24 2018 -0700
-# Node ID f598dceb588d1adf503d30acf4e0915d07d34006
-# Parent b7dd3969261896020d7a9449d22f350a97e3517a
-# EXP-Topic b1488552.enD
-Bug 1488552 - JSString flags bit must alias the low 32 bits of JSObject.group_, not the high 32. r=tcampbell
+Bug 1488552 - Ensure proper running on 64-bit and 32-bit BE platforms.
diff --git a/js/src/gc/RelocationOverlay.h b/js/src/gc/RelocationOverlay.h
--- a/js/src/gc/RelocationOverlay.h
+++ b/js/src/gc/RelocationOverlay.h
-@@ -29,24 +29,35 @@ struct Cell;
+@@ -29,23 +29,34 @@ struct Cell;
* This structure overlays a Cell that has been moved and provides a way to find
* its new location. It's used during generational and compacting GC.
*/
- class RelocationOverlay
- {
- /* See comment in js/public/HeapAPI.h. */
- static const uint32_t Relocated = js::gc::Relocated;
+ class RelocationOverlay {
+ /* See comment in js/public/HeapAPI.h. */
+ static const uint32_t Relocated = js::gc::Relocated;
-+#if MOZ_LITTLE_ENDIAN
- /*
-- * Keep the low 32 bits untouched. Use them to distinguish strings from
-+ * Keep the first 32 bits untouched. Use them to distinguish strings from
- * objects in the nursery.
- */
- uint32_t preserve_;
++#if MOZ_LITTLE_ENDIAN || JS_BITS_PER_WORD == 32
+ /*
+- * Keep the low 32 bits untouched. Use them to distinguish strings from
++ * Keep the first 32 bits untouched. Use them to distinguish strings from
+ * objects in the nursery.
+ */
+ uint32_t preserve_;
- /* Set to Relocated when moved. */
- uint32_t magic_;
+ /* Set to Relocated when moved. */
+ uint32_t magic_;
+#elif JS_BITS_PER_WORD == 64
-+ /*
-+ * On big-endian, we need to reorder to keep preserve_ lined up with the
-+ * low 32 bits of the aligned group_ pointer in JSObject.
-+ */
-+ uint32_t magic_;
-+ uint32_t preserve_;
++ /*
++ * On big-endian, we need to reorder to keep preserve_ lined up with the
++ * low 32 bits of the aligned group_ pointer in JSObject.
++ */
++ uint32_t magic_;
++ uint32_t preserve_;
+#else
-+# error "Support for 32-bit big-endian architectures is untested. See bug 1488552."
++# error "Unknown endianness or word size"
+#endif
- /* The location |this| was moved to. */
- Cell* newLocation_;
+ /* The location |this| was moved to. */
+ Cell* newLocation_;
- /* A list entry to track all relocated things. */
- RelocationOverlay* next_;
+ /* A list entry to track all relocated things. */
+ RelocationOverlay* next_;
- public:
+ public:
diff --git a/js/src/vm/StringType.h b/js/src/vm/StringType.h
--- a/js/src/vm/StringType.h
+++ b/js/src/vm/StringType.h
@@ -68,54 +60,59 @@ diff --git a/js/src/vm/StringType.h b/js/src/vm/StringType.h
#include "jsfriendapi.h"
#include "builtin/String.h"
-@@ -161,18 +162,30 @@ class JSString : public js::gc::Cell
- static const size_t NUM_INLINE_CHARS_LATIN1 = 2 * sizeof(void*) / sizeof(JS::Latin1Char);
- static const size_t NUM_INLINE_CHARS_TWO_BYTE = 2 * sizeof(void*) / sizeof(char16_t);
-
- /* Fields only apply to string types commented on the right. */
- struct Data
- {
- union {
- struct {
-+#if MOZ_LITTLE_ENDIAN
- uint32_t flags; /* JSString */
- uint32_t length; /* JSString */
+@@ -168,8 +168,20 @@ class JSString : public js::gc::Cell
+ struct Data {
+ union {
+ struct {
++#if MOZ_LITTLE_ENDIAN || JS_BITS_PER_WORD == 32
+ uint32_t flags; /* JSString */
+ uint32_t length; /* JSString */
+#elif JS_BITS_PER_WORD == 64
-+ /*
-+ * On big-endian, we need to reorder to keep flags lined up
-+ * with the low 32 bits of the aligned group_ pointer in
-+ * JSObject.
-+ */
-+ uint32_t length; /* JSString */
-+ uint32_t flags; /* JSString */
++ /*
++ * On big-endian, we need to reorder to keep flags lined up
++ * with the low 32 bits of the aligned group_ pointer in
++ * JSObject.
++ */
++ uint32_t length; /* JSString */
++ uint32_t flags; /* JSString */
+#else
-+# error "Support for 32-bit big-endian architectures is untested. See bug 1488552."
++# error "Unknown endianness or word size"
+#endif
- };
- uintptr_t flattenData; /* JSRope (temporary while flattening) */
- } u1;
- union {
- union {
- /* JS(Fat)InlineString */
- JS::Latin1Char inlineStorageLatin1[NUM_INLINE_CHARS_LATIN1];
- char16_t inlineStorageTwoByte[NUM_INLINE_CHARS_TWO_BYTE];
+ };
+ uintptr_t flattenData; /* JSRope (temporary while flattening) */
+ } u1;
--- thunderbird-60.2.1/js/src/gc/Marking-inl.h.old 2018-10-01 14:51:12.000000000 +0000
+++ thunderbird-60.2.1/js/src/gc/Marking-inl.h 2018-10-12 19:08:28.260000000 +0000
-@@ -92,10 +92,10 @@
- MOZ_ASSERT(!isForwarded());
- // The location of magic_ is important because it must never be valid to see
- // the value Relocated there in a GC thing that has not been moved.
-- static_assert(offsetof(RelocationOverlay, magic_) == offsetof(JSObject, group_) + sizeof(uint32_t),
-- "RelocationOverlay::magic_ is in the wrong location");
-- static_assert(offsetof(RelocationOverlay, magic_) == offsetof(js::Shape, base_) + sizeof(uint32_t),
-- "RelocationOverlay::magic_ is in the wrong location");
-+ //static_assert(offsetof(RelocationOverlay, magic_) == offsetof(JSObject, group_) + sizeof(uint32_t),
-+ // "RelocationOverlay::magic_ is in the wrong location");
-+ //static_assert(offsetof(RelocationOverlay, magic_) == offsetof(js::Shape, base_) + sizeof(uint32_t),
-+ // "RelocationOverlay::magic_ is in the wrong location");
- static_assert(offsetof(RelocationOverlay, magic_) == offsetof(JSString, d.u1.length),
- "RelocationOverlay::magic_ is in the wrong location");
- magic_ = Relocated;
+@@ -92,13 +92,29 @@
+ MOZ_ASSERT(!isForwarded());
+ // The location of magic_ is important because it must never be valid to see
+ // the value Relocated there in a GC thing that has not been moved.
++#if MOZ_LITTLE_ENDIAN || JS_BITS_PER_WORD == 32
++ // On 32-bit, the magic_ aliases with whatever comes after the first
++ // pointer; on little-endian 64-bit, the magic_ aliases with the
++ // 32 most significant bits of the pointer, which are the second half.
+ static_assert(offsetof(RelocationOverlay, magic_) ==
+ offsetof(JSObject, group_) + sizeof(uint32_t),
+ "RelocationOverlay::magic_ is in the wrong location");
+ static_assert(offsetof(RelocationOverlay, magic_) ==
+ offsetof(js::Shape, base_) + sizeof(uint32_t),
+ "RelocationOverlay::magic_ is in the wrong location");
++#elif JS_BITS_PER_WORD == 64
++ // On big-endian 64-bit, the magic_ aliases with the 32 most
++ // significant bits of the pointer, but now that's the first half.
++ static_assert(offsetof(RelocationOverlay, magic_) ==
++ offsetof(JSObject, group_),
++ "RelocationOverlay::magic_ is in the wrong location");
++ static_assert(offsetof(RelocationOverlay, magic_) ==
++ offsetof(js::Shape, base_),
++ "RelocationOverlay::magic_ is in the wrong location");
++#else
++# error "Unknown endianness or word size"
++#endif
+ static_assert(
+ offsetof(RelocationOverlay, magic_) == offsetof(JSString, d.u1.length),
+ "RelocationOverlay::magic_ is in the wrong location");
+ magic_ = Relocated;
--- thunderbird-60.2.1/js/src/jsfriendapi.h.old 2018-10-01 14:51:13.000000000 +0000
+++ thunderbird-60.2.1/js/src/jsfriendapi.h 2018-10-12 19:12:06.190000000 +0000
@@ -9,6 +9,7 @@
@@ -127,18 +124,18 @@ diff --git a/js/src/vm/StringType.h b/js/src/vm/StringType.h
#include "mozilla/MemoryReporting.h"
#include "mozilla/UniquePtr.h"
@@ -640,8 +641,15 @@
- static const uint32_t LATIN1_CHARS_BIT = JS_BIT(6);
- static const uint32_t EXTERNAL_FLAGS = LINEAR_BIT | NON_ATOM_BIT | JS_BIT(5);
- static const uint32_t TYPE_FLAGS_MASK = JS_BIT(6) - 1;
-+#if MOZ_LITTLE_ENDIAN
- uint32_t flags;
- uint32_t length;
+ static const uint32_t LATIN1_CHARS_BIT = JS_BIT(6);
+ static const uint32_t EXTERNAL_FLAGS = LINEAR_BIT | NON_ATOM_BIT | JS_BIT(5);
+ static const uint32_t TYPE_FLAGS_MASK = JS_BIT(6) - 1;
++#if MOZ_LITTLE_ENDIAN || JS_BITS_PER_WORD == 32
+ uint32_t flags;
+ uint32_t length;
+#elif JS_BITS_PER_WORD == 64
-+ uint32_t length;
-+ uint32_t flags;
++ uint32_t length;
++ uint32_t flags;
+#else
-+# error "Support for 32-bit big-endian architectures is untested. See bug 1488552."
++# error "Unknown endianness or word size"
+#endif
- union {
- const JS::Latin1Char* nonInlineCharsLatin1;
- const char16_t* nonInlineCharsTwoByte;
+ union {
+ const JS::Latin1Char* nonInlineCharsLatin1;
+ const char16_t* nonInlineCharsTwoByte;