Bug 1861078: apply code formatting via Lando

# ignore-this-changeset
This commit is contained in:
Otto Länd
2025-03-03 16:40:41 +00:00
parent e2c94653c9
commit 39f7dc3e29
4 changed files with 23 additions and 26 deletions

View File

@@ -16284,8 +16284,7 @@ bool CodeGenerator::generateWasm(wasm::CallIndirectId callIndirectId,
MOZ_ASSERT(functionEntryStackMap); MOZ_ASSERT(functionEntryStackMap);
if (functionEntryStackMap && if (functionEntryStackMap &&
!stackMaps->add(trapInsnOffset.offset(), !stackMaps->add(trapInsnOffset.offset(), functionEntryStackMap)) {
functionEntryStackMap)) {
functionEntryStackMap->destroy(); functionEntryStackMap->destroy();
return false; return false;
} }

View File

@@ -318,11 +318,11 @@ bool wasm::IsPlausibleStackMapKey(const uint8_t* nextPC) {
void StackMaps::checkInvariants(const uint8_t* base) const { void StackMaps::checkInvariants(const uint8_t* base) const {
#ifdef DEBUG #ifdef DEBUG
// Chech that each entry points from the stackmap structure points // Chech that each entry points from the stackmap structure points
// to a plausible instruction. // to a plausible instruction.
for (auto iter = mapping_.iter(); !iter.done(); iter.next()) { for (auto iter = mapping_.iter(); !iter.done(); iter.next()) {
MOZ_ASSERT(IsPlausibleStackMapKey(base + iter.get().key()), MOZ_ASSERT(IsPlausibleStackMapKey(base + iter.get().key()),
"wasm stackmap does not reference a valid insn"); "wasm stackmap does not reference a valid insn");
}
#endif
} }
#endif
}

View File

@@ -247,29 +247,28 @@ struct StackMap final {
static_assert(sizeof(StackMap) == 12, "wasm::StackMap has unexpected size"); static_assert(sizeof(StackMap) == 12, "wasm::StackMap has unexpected size");
// A map from an offset relative to the beginning of a code block to a StackMap // A map from an offset relative to the beginning of a code block to a StackMap
using StackMapHashMap = HashMap<uint32_t, StackMap*, DefaultHasher<uint32_t>, SystemAllocPolicy>; using StackMapHashMap =
HashMap<uint32_t, StackMap*, DefaultHasher<uint32_t>, SystemAllocPolicy>;
class StackMaps { class StackMaps {
private: private:
// Map for finding a stack map at a specific code offset. // Map for finding a stack map at a specific code offset.
StackMapHashMap mapping_; StackMapHashMap mapping_;
public: public:
StackMaps() {} StackMaps() {}
~StackMaps() { ~StackMaps() {
for (auto iter = mapping_.modIter(); !iter.done(); iter.next()) { for (auto iter = mapping_.modIter(); !iter.done(); iter.next()) {
StackMap* stackmap = iter.getMutable().value(); StackMap* stackmap = iter.getMutable().value();
stackmap->destroy(); stackmap->destroy();
} }
mapping_.clear(); mapping_.clear();
} }
[[nodiscard]] bool add(uint32_t codeOffset, StackMap* map) { [[nodiscard]] bool add(uint32_t codeOffset, StackMap* map) {
return mapping_.put(codeOffset, map); return mapping_.put(codeOffset, map);
} }
void clear() { void clear() { mapping_.clear(); }
mapping_.clear();
}
bool empty() const { return mapping_.empty(); } bool empty() const { return mapping_.empty(); }
// Return the number of stack maps contained in this. // Return the number of stack maps contained in this.
size_t length() const { return mapping_.count(); } size_t length() const { return mapping_.count(); }

View File

@@ -1892,8 +1892,7 @@ static bool AddStackCheckForImportFunctionEntry(jit::MacroAssembler& masm,
// In debug builds, we'll always have a stack map, even if there are no // In debug builds, we'll always have a stack map, even if there are no
// refs to track. // refs to track.
MOZ_ASSERT(stackMap); MOZ_ASSERT(stackMap);
if (stackMap && if (stackMap && !stackMaps->add(trapInsnOffset.offset(), stackMap)) {
!stackMaps->add(trapInsnOffset.offset(), stackMap)) {
stackMap->destroy(); stackMap->destroy();
return false; return false;
} }