summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-07-01 16:16:38 +0200
committerMoonchild <moonchild@palemoon.org>2022-07-01 16:16:38 +0200
commit1e25e4d7aa8497dda463fb1ca000f64e2393c8fa (patch)
treead5586ba874b6b16c9231e0c2955d18c3144fbe3
parent8d88a9328eb57666297760f6da6af29d9396b6d3 (diff)
downloaduxp-1e25e4d7aa8497dda463fb1ca000f64e2393c8fa.tar.gz
Issue #1817 - Re-work some static_asserts to get VS2017 compiling.
BZ Bug 1319971
-rw-r--r--js/src/ds/OrderedHashTable.h2
-rw-r--r--js/src/jit/CodeGenerator.cpp6
2 files changed, 5 insertions, 3 deletions
diff --git a/js/src/ds/OrderedHashTable.h b/js/src/ds/OrderedHashTable.h
index c12d43caa7..940b421330 100644
--- a/js/src/ds/OrderedHashTable.h
+++ b/js/src/ds/OrderedHashTable.h
@@ -532,6 +532,8 @@ class OrderedHashTable
return offsetof(OrderedHashTable, data);
}
static constexpr size_t offsetOfDataElement() {
+ static_assert(offsetof(Data, element) == 0,
+ "RangeFront and RangePopFront depend on offsetof(Data, element) being 0");
return offsetof(Data, element);
}
static constexpr size_t sizeofData() {
diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp
index 66e8e25ddf..89d0d3b6e7 100644
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -6251,7 +6251,7 @@ RangeFront<ValueMap>(MacroAssembler& masm, Register range, Register i, Register
masm.loadPtr(Address(range, ValueMap::Range::offsetOfHashTable()), front);
masm.loadPtr(Address(front, ValueMap::offsetOfImplData()), front);
- static_assert(ValueMap::offsetOfImplDataElement() == 0, "offsetof(Data, element) is 0");
+ MOZ_ASSERT(ValueMap::offsetOfImplDataElement() == 0, "offsetof(Data, element) is 0");
static_assert(ValueMap::sizeofImplData() == 24, "sizeof(Data) is 24");
masm.mulBy3(i, i);
masm.lshiftPtr(Imm32(3), i);
@@ -6265,7 +6265,7 @@ RangeFront<ValueSet>(MacroAssembler& masm, Register range, Register i, Register
masm.loadPtr(Address(range, ValueSet::Range::offsetOfHashTable()), front);
masm.loadPtr(Address(front, ValueSet::offsetOfImplData()), front);
- static_assert(ValueSet::offsetOfImplDataElement() == 0, "offsetof(Data, element) is 0");
+ MOZ_ASSERT(ValueSet::offsetOfImplDataElement() == 0, "offsetof(Data, element) is 0");
static_assert(ValueSet::sizeofImplData() == 16, "sizeof(Data) is 16");
masm.lshiftPtr(Imm32(4), i);
masm.addPtr(i, front);
@@ -6289,7 +6289,7 @@ RangePopFront(MacroAssembler& masm, Register range, Register front, Register dat
// We can add sizeof(Data) to |front| to select the next element, because
// |front| and |range.ht.data[i]| point to the same location.
- static_assert(OrderedHashTable::offsetOfImplDataElement() == 0, "offsetof(Data, element) is 0");
+ MOZ_ASSERT(OrderedHashTable::offsetOfImplDataElement() == 0, "offsetof(Data, element) is 0");
masm.addPtr(Imm32(OrderedHashTable::sizeofImplData()), front);
masm.branchTestMagic(Assembler::NotEqual, Address(front, OrderedHashTable::offsetOfEntryKey()),