| File: | root/firefox-clang/js/src/jit/MIR-wasm.h |
| Warning: | line 622, column 17 Value stored to 'what' during its initialization is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | |
| 5 | /* |
| 6 | * Everything needed to build actual MIR instructions: the actual opcodes and |
| 7 | * instructions, the instruction interface, and use chains. |
| 8 | */ |
| 9 | |
| 10 | #ifndef jit_MIR_wasm_h |
| 11 | #define jit_MIR_wasm_h |
| 12 | |
| 13 | #include "mozilla/HashFunctions.h" |
| 14 | #include "mozilla/Vector.h" |
| 15 | #ifdef JS_JITSPEW1 |
| 16 | # include "mozilla/Sprintf.h" |
| 17 | #endif |
| 18 | |
| 19 | #include <algorithm> |
| 20 | #include <bit> |
| 21 | |
| 22 | #include "jit/MIR.h" |
| 23 | #include "util/DifferentialTesting.h" |
| 24 | #include "wasm/WasmGcObject.h" |
| 25 | #include "wasm/WasmStacks.h" |
| 26 | |
| 27 | namespace js { |
| 28 | |
| 29 | class WasmInstanceObject; |
| 30 | |
| 31 | namespace wasm { |
| 32 | class FuncExport; |
| 33 | extern uint32_t MIRTypeToABIResultSize(jit::MIRType); |
| 34 | } // namespace wasm |
| 35 | |
| 36 | namespace jit { |
| 37 | |
| 38 | // For a defaultable wasm type, synthesize the default constant value. |
| 39 | MInstruction* NewWasmDefaultConstant(TempAllocator& alloc, wasm::ValType type); |
| 40 | |
| 41 | class MWasmNullConstant : public MNullaryInstruction { |
| 42 | mozilla::Maybe<wasm::RefTypeHierarchy> hierarchy_; |
| 43 | |
| 44 | explicit MWasmNullConstant(wasm::MaybeRefType type) |
| 45 | : MNullaryInstruction(classOpcode), |
| 46 | hierarchy_(type.isSome() ? mozilla::Some(type.value().hierarchy()) |
| 47 | : mozilla::Nothing()) { |
| 48 | setResultType(MIRType::WasmAnyRef); |
| 49 | setMovable(); |
| 50 | if (type.isSome()) { |
| 51 | setWasmRefType(wasm::MaybeRefType(type.value().bottomType())); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | public: |
| 56 | INSTRUCTION_HEADER(WasmNullConstant) |
| 57 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 58 | |
| 59 | mozilla::Maybe<wasm::RefTypeHierarchy> hierarchy() const { |
| 60 | return hierarchy_; |
| 61 | } |
| 62 | |
| 63 | HashNumber valueHash() const override; |
| 64 | bool congruentTo(const MDefinition* ins) const override { |
| 65 | return ins->isWasmNullConstant() && |
| 66 | hierarchy() == ins->toWasmNullConstant()->hierarchy(); |
| 67 | } |
| 68 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 69 | |
| 70 | ALLOW_CLONE(MWasmNullConstant)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 70); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 70); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmNullConstant(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 71 | }; |
| 72 | |
| 73 | // Floating-point value as created by wasm. Just a constant value, used to |
| 74 | // effectively inhibit all the MIR optimizations. This uses the same LIR nodes |
| 75 | // as a MConstant of the same type would. |
| 76 | class MWasmFloatConstant : public MNullaryInstruction { |
| 77 | union { |
| 78 | float f32_; |
| 79 | double f64_; |
| 80 | #ifdef ENABLE_WASM_SIMD1 |
| 81 | int8_t s128_[16]; |
| 82 | uint64_t bits_[2]; |
| 83 | #else |
| 84 | uint64_t bits_[1]; |
| 85 | #endif |
| 86 | } u; |
| 87 | |
| 88 | explicit MWasmFloatConstant(MIRType type) : MNullaryInstruction(classOpcode) { |
| 89 | u.bits_[0] = 0; |
| 90 | #ifdef ENABLE_WASM_SIMD1 |
| 91 | u.bits_[1] = 0; |
| 92 | #endif |
| 93 | setResultType(type); |
| 94 | } |
| 95 | |
| 96 | public: |
| 97 | INSTRUCTION_HEADER(WasmFloatConstant) |
| 98 | |
| 99 | static MWasmFloatConstant* NewDouble(TempAllocator& alloc, double d) { |
| 100 | auto* ret = new (alloc) MWasmFloatConstant(MIRType::Double); |
| 101 | ret->u.f64_ = d; |
| 102 | return ret; |
| 103 | } |
| 104 | |
| 105 | static MWasmFloatConstant* NewFloat32(TempAllocator& alloc, float f) { |
| 106 | auto* ret = new (alloc) MWasmFloatConstant(MIRType::Float32); |
| 107 | ret->u.f32_ = f; |
| 108 | return ret; |
| 109 | } |
| 110 | |
| 111 | #ifdef ENABLE_WASM_SIMD1 |
| 112 | static MWasmFloatConstant* NewSimd128(TempAllocator& alloc, |
| 113 | const SimdConstant& s) { |
| 114 | auto* ret = new (alloc) MWasmFloatConstant(MIRType::Simd128); |
| 115 | memcpy(ret->u.s128_, s.bytes(), 16); |
| 116 | return ret; |
| 117 | } |
| 118 | #endif |
| 119 | |
| 120 | HashNumber valueHash() const override; |
| 121 | bool congruentTo(const MDefinition* ins) const override; |
| 122 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 123 | |
| 124 | const double& toDouble() const { |
| 125 | MOZ_ASSERT(type() == MIRType::Double)do { static_assert( mozilla::detail::AssertionConditionType< decltype(type() == MIRType::Double)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(type() == MIRType::Double))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("type() == MIRType::Double" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 125); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type() == MIRType::Double" ")"); do { MOZ_CrashSequence (__null, 125); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); |
| 126 | return u.f64_; |
| 127 | } |
| 128 | const float& toFloat32() const { |
| 129 | MOZ_ASSERT(type() == MIRType::Float32)do { static_assert( mozilla::detail::AssertionConditionType< decltype(type() == MIRType::Float32)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(type() == MIRType::Float32)) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("type() == MIRType::Float32" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 129); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type() == MIRType::Float32" ")"); do { MOZ_CrashSequence (__null, 129); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); |
| 130 | return u.f32_; |
| 131 | } |
| 132 | #ifdef ENABLE_WASM_SIMD1 |
| 133 | const SimdConstant toSimd128() const { |
| 134 | MOZ_ASSERT(type() == MIRType::Simd128)do { static_assert( mozilla::detail::AssertionConditionType< decltype(type() == MIRType::Simd128)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(type() == MIRType::Simd128)) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("type() == MIRType::Simd128" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 134); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type() == MIRType::Simd128" ")"); do { MOZ_CrashSequence (__null, 134); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); |
| 135 | return SimdConstant::CreateX16(u.s128_); |
| 136 | } |
| 137 | #endif |
| 138 | #ifdef JS_JITSPEW1 |
| 139 | void getExtras(ExtrasCollector* extras) const override { |
| 140 | char buf[64]; |
| 141 | switch (type()) { |
| 142 | case MIRType::Float32: |
| 143 | SprintfLiteral(buf, "f32{%e}", (double)u.f32_); |
| 144 | break; |
| 145 | case MIRType::Double: |
| 146 | SprintfLiteral(buf, "f64{%e}", u.f64_); |
| 147 | break; |
| 148 | # ifdef ENABLE_WASM_SIMD1 |
| 149 | case MIRType::Simd128: |
| 150 | SprintfLiteral(buf, "v128{[1]=%016llx:[0]=%016llx}", |
| 151 | (unsigned long long int)u.bits_[1], |
| 152 | (unsigned long long int)u.bits_[0]); |
| 153 | break; |
| 154 | # endif |
| 155 | default: |
| 156 | SprintfLiteral(buf, "!!getExtras: missing case!!"); |
| 157 | break; |
| 158 | } |
| 159 | extras->add(buf); |
| 160 | } |
| 161 | #endif |
| 162 | |
| 163 | ALLOW_CLONE(MWasmFloatConstant)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 163); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 163); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmFloatConstant(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 164 | }; |
| 165 | |
| 166 | // Converts a uint32 to a float32 (coming from wasm). |
| 167 | class MWasmUnsignedToFloat32 : public MUnaryInstruction, |
| 168 | public NoTypePolicy::Data { |
| 169 | explicit MWasmUnsignedToFloat32(MDefinition* def) |
| 170 | : MUnaryInstruction(classOpcode, def) { |
| 171 | setResultType(MIRType::Float32); |
| 172 | setMovable(); |
| 173 | } |
| 174 | |
| 175 | public: |
| 176 | INSTRUCTION_HEADER(WasmUnsignedToFloat32) |
| 177 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 178 | |
| 179 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 180 | bool congruentTo(const MDefinition* ins) const override { |
| 181 | return congruentIfOperandsEqual(ins); |
| 182 | } |
| 183 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 184 | |
| 185 | bool canProduceFloat32() const override { return true; } |
| 186 | |
| 187 | ALLOW_CLONE(MWasmUnsignedToFloat32)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 187); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 187); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmUnsignedToFloat32(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 188 | }; |
| 189 | |
| 190 | class MWasmNewI31Ref : public MUnaryInstruction, public NoTypePolicy::Data { |
| 191 | explicit MWasmNewI31Ref(MDefinition* input) |
| 192 | : MUnaryInstruction(classOpcode, input) { |
| 193 | MOZ_ASSERT(input->type() == MIRType::Int32)do { static_assert( mozilla::detail::AssertionConditionType< decltype(input->type() == MIRType::Int32)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(input->type() == MIRType:: Int32))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("input->type() == MIRType::Int32", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 193); AnnotateMozCrashReason("MOZ_ASSERT" "(" "input->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 193); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 194 | setResultType(MIRType::WasmAnyRef); |
| 195 | setMovable(); |
| 196 | setWasmRefType(wasm::MaybeRefType(wasm::RefType::i31().asNonNullable())); |
| 197 | } |
| 198 | |
| 199 | public: |
| 200 | INSTRUCTION_HEADER(WasmNewI31Ref) |
| 201 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 202 | |
| 203 | bool congruentTo(const MDefinition* ins) const override { |
| 204 | return congruentIfOperandsEqual(ins); |
| 205 | } |
| 206 | |
| 207 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 208 | }; |
| 209 | |
| 210 | // The same as MWasmTruncateToInt64 but with the Instance dependency. |
| 211 | // It used only for arm now because on arm we need to call builtin to truncate |
| 212 | // to i64. |
| 213 | class MWasmBuiltinTruncateToInt64 : public MAryInstruction<2>, |
| 214 | public NoTypePolicy::Data { |
| 215 | TruncFlags flags_; |
| 216 | wasm::TrapSiteDesc trapSiteDesc_; |
| 217 | |
| 218 | MWasmBuiltinTruncateToInt64(MDefinition* def, MDefinition* instance, |
| 219 | TruncFlags flags, |
| 220 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 221 | : MAryInstruction(classOpcode), |
| 222 | flags_(flags), |
| 223 | trapSiteDesc_(trapSiteDesc) { |
| 224 | initOperand(0, def); |
| 225 | initOperand(1, instance); |
| 226 | |
| 227 | setResultType(MIRType::Int64); |
| 228 | setGuard(); // neither removable nor movable because of possible |
| 229 | // side-effects. |
| 230 | } |
| 231 | |
| 232 | public: |
| 233 | INSTRUCTION_HEADER(WasmBuiltinTruncateToInt64) |
| 234 | NAMED_OPERANDS((0, input), (1, instance))static constexpr size_t inputOperand = 0; MDefinition* input( ) const { return getOperand(0); } static constexpr size_t instanceOperand = 1; MDefinition* instance() const { return getOperand(1); }; |
| 235 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 236 | |
| 237 | bool isUnsigned() const { return flags_ & TRUNC_UNSIGNED; } |
| 238 | bool isSaturating() const { return flags_ & TRUNC_SATURATING; } |
| 239 | TruncFlags flags() const { return flags_; } |
| 240 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 241 | |
| 242 | bool congruentTo(const MDefinition* ins) const override { |
| 243 | return congruentIfOperandsEqual(ins) && |
| 244 | ins->toWasmBuiltinTruncateToInt64()->flags() == flags_; |
| 245 | } |
| 246 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 247 | }; |
| 248 | |
| 249 | class MWasmTruncateToInt64 : public MUnaryInstruction, |
| 250 | public NoTypePolicy::Data { |
| 251 | TruncFlags flags_; |
| 252 | wasm::TrapSiteDesc trapSiteDesc_; |
| 253 | |
| 254 | MWasmTruncateToInt64(MDefinition* def, TruncFlags flags, |
| 255 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 256 | : MUnaryInstruction(classOpcode, def), |
| 257 | flags_(flags), |
| 258 | trapSiteDesc_(trapSiteDesc) { |
| 259 | setResultType(MIRType::Int64); |
| 260 | setGuard(); // neither removable nor movable because of possible |
| 261 | // side-effects. |
| 262 | } |
| 263 | |
| 264 | public: |
| 265 | INSTRUCTION_HEADER(WasmTruncateToInt64) |
| 266 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 267 | |
| 268 | bool isUnsigned() const { return flags_ & TRUNC_UNSIGNED; } |
| 269 | bool isSaturating() const { return flags_ & TRUNC_SATURATING; } |
| 270 | TruncFlags flags() const { return flags_; } |
| 271 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 272 | |
| 273 | bool congruentTo(const MDefinition* ins) const override { |
| 274 | return congruentIfOperandsEqual(ins) && |
| 275 | ins->toWasmTruncateToInt64()->flags() == flags_; |
| 276 | } |
| 277 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 278 | }; |
| 279 | |
| 280 | // Truncate a value to an int32, with wasm semantics: this will trap when the |
| 281 | // value is out of range. |
| 282 | class MWasmTruncateToInt32 : public MUnaryInstruction, |
| 283 | public NoTypePolicy::Data { |
| 284 | TruncFlags flags_; |
| 285 | wasm::TrapSiteDesc trapSiteDesc_; |
| 286 | |
| 287 | explicit MWasmTruncateToInt32(MDefinition* def, TruncFlags flags, |
| 288 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 289 | : MUnaryInstruction(classOpcode, def), |
| 290 | flags_(flags), |
| 291 | trapSiteDesc_(trapSiteDesc) { |
| 292 | setResultType(MIRType::Int32); |
| 293 | setGuard(); // neither removable nor movable because of possible |
| 294 | // side-effects. |
| 295 | } |
| 296 | |
| 297 | public: |
| 298 | INSTRUCTION_HEADER(WasmTruncateToInt32) |
| 299 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 300 | |
| 301 | bool isUnsigned() const { return flags_ & TRUNC_UNSIGNED; } |
| 302 | bool isSaturating() const { return flags_ & TRUNC_SATURATING; } |
| 303 | TruncFlags flags() const { return flags_; } |
| 304 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 305 | |
| 306 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 307 | |
| 308 | bool congruentTo(const MDefinition* ins) const override { |
| 309 | return congruentIfOperandsEqual(ins) && |
| 310 | ins->toWasmTruncateToInt32()->flags() == flags_; |
| 311 | } |
| 312 | |
| 313 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 314 | }; |
| 315 | |
| 316 | // It is like MTruncateToInt32 but with instance dependency. |
| 317 | class MWasmBuiltinTruncateToInt32 : public MAryInstruction<2>, |
| 318 | public ToInt32Policy::Data { |
| 319 | wasm::TrapSiteDesc trapSiteDesc_; |
| 320 | |
| 321 | MWasmBuiltinTruncateToInt32( |
| 322 | MDefinition* def, MDefinition* instance, |
| 323 | wasm::TrapSiteDesc trapSiteDesc = wasm::TrapSiteDesc()) |
| 324 | : MAryInstruction(classOpcode), trapSiteDesc_(trapSiteDesc) { |
| 325 | initOperand(0, def); |
| 326 | initOperand(1, instance); |
| 327 | setResultType(MIRType::Int32); |
| 328 | setMovable(); |
| 329 | |
| 330 | // Guard unless the conversion is known to be non-effectful & non-throwing. |
| 331 | if (MTruncateToInt32::mightHaveSideEffects(def)) { |
| 332 | setGuard(); |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | public: |
| 337 | INSTRUCTION_HEADER(WasmBuiltinTruncateToInt32) |
| 338 | NAMED_OPERANDS((0, input), (1, instance))static constexpr size_t inputOperand = 0; MDefinition* input( ) const { return getOperand(0); } static constexpr size_t instanceOperand = 1; MDefinition* instance() const { return getOperand(1); } |
| 339 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 340 | |
| 341 | bool congruentTo(const MDefinition* ins) const override { |
| 342 | return congruentIfOperandsEqual(ins); |
| 343 | } |
| 344 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 345 | |
| 346 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 347 | |
| 348 | ALLOW_CLONE(MWasmBuiltinTruncateToInt32)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 348); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 348); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmBuiltinTruncateToInt32(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i ++) { res->replaceOperand(i, inputs[i]); } return res; } |
| 349 | }; |
| 350 | |
| 351 | class MWasmBuiltinDivI64 : public MAryInstruction<3>, public ArithPolicy::Data { |
| 352 | bool canBeNegativeZero_; |
| 353 | bool canBeNegativeOverflow_; |
| 354 | bool canBeDivideByZero_; |
| 355 | bool canBeNegativeDividend_; |
| 356 | bool unsigned_; // If false, signedness will be derived from operands |
| 357 | bool trapOnError_; |
| 358 | wasm::TrapSiteDesc trapSiteDesc_; |
| 359 | |
| 360 | MWasmBuiltinDivI64(MDefinition* left, MDefinition* right, |
| 361 | MDefinition* instance) |
| 362 | : MAryInstruction(classOpcode), |
| 363 | canBeNegativeZero_(true), |
| 364 | canBeNegativeOverflow_(true), |
| 365 | canBeDivideByZero_(true), |
| 366 | canBeNegativeDividend_(true), |
| 367 | unsigned_(false), |
| 368 | trapOnError_(false) { |
| 369 | initOperand(0, left); |
| 370 | initOperand(1, right); |
| 371 | initOperand(2, instance); |
| 372 | |
| 373 | setResultType(MIRType::Int64); |
| 374 | setMovable(); |
| 375 | } |
| 376 | |
| 377 | public: |
| 378 | INSTRUCTION_HEADER(WasmBuiltinDivI64) |
| 379 | |
| 380 | NAMED_OPERANDS((0, lhs), (1, rhs), (2, instance))static constexpr size_t lhsOperand = 0; MDefinition* lhs() const { return getOperand(0); } static constexpr size_t rhsOperand = 1; MDefinition* rhs() const { return getOperand(1); } static constexpr size_t instanceOperand = 2; MDefinition* instance( ) const { return getOperand(2); } |
| 381 | |
| 382 | static MWasmBuiltinDivI64* New( |
| 383 | TempAllocator& alloc, MDefinition* left, MDefinition* right, |
| 384 | MDefinition* instance, bool unsignd, bool trapOnError = false, |
| 385 | wasm::TrapSiteDesc trapSiteDesc = wasm::TrapSiteDesc()) { |
| 386 | auto* wasm64Div = new (alloc) MWasmBuiltinDivI64(left, right, instance); |
| 387 | wasm64Div->unsigned_ = unsignd; |
| 388 | wasm64Div->trapOnError_ = trapOnError; |
| 389 | wasm64Div->trapSiteDesc_ = trapSiteDesc; |
| 390 | if (trapOnError) { |
| 391 | wasm64Div->setGuard(); // not removable because of possible side-effects. |
| 392 | wasm64Div->setNotMovable(); |
| 393 | } |
| 394 | return wasm64Div; |
| 395 | } |
| 396 | |
| 397 | bool canBeNegativeZero() const { return canBeNegativeZero_; } |
| 398 | void setCanBeNegativeZero(bool negativeZero) { |
| 399 | canBeNegativeZero_ = negativeZero; |
| 400 | } |
| 401 | |
| 402 | bool canBeNegativeOverflow() const { return canBeNegativeOverflow_; } |
| 403 | |
| 404 | bool canBeDivideByZero() const { return canBeDivideByZero_; } |
| 405 | |
| 406 | bool canBeNegativeDividend() const { |
| 407 | // "Dividend" is an ambiguous concept for unsigned truncated |
| 408 | // division, because of the truncation procedure: |
| 409 | // ((x>>>0)/2)|0, for example, gets transformed in |
| 410 | // MWasmDiv::truncate into a node with lhs representing x (not |
| 411 | // x>>>0) and rhs representing the constant 2; in other words, |
| 412 | // the MIR node corresponds to "cast operands to unsigned and |
| 413 | // divide" operation. In this case, is the dividend x or is it |
| 414 | // x>>>0? In order to resolve such ambiguities, we disallow |
| 415 | // the usage of this method for unsigned division. |
| 416 | MOZ_ASSERT(!unsigned_)do { static_assert( mozilla::detail::AssertionConditionType< decltype(!unsigned_)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!unsigned_))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!unsigned_", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 416); AnnotateMozCrashReason("MOZ_ASSERT" "(" "!unsigned_" ")" ); do { MOZ_CrashSequence(__null, 416); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 417 | return canBeNegativeDividend_; |
| 418 | } |
| 419 | |
| 420 | bool isUnsigned() const { return unsigned_; } |
| 421 | |
| 422 | bool trapOnError() const { return trapOnError_; } |
| 423 | const wasm::TrapSiteDesc& trapSiteDesc() const { |
| 424 | MOZ_ASSERT(trapSiteDesc_.isValid())do { static_assert( mozilla::detail::AssertionConditionType< decltype(trapSiteDesc_.isValid())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(trapSiteDesc_.isValid()))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("trapSiteDesc_.isValid()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 424); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "trapSiteDesc_.isValid()" ")"); do { MOZ_CrashSequence (__null, 424); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); |
| 425 | return trapSiteDesc_; |
| 426 | } |
| 427 | |
| 428 | ALLOW_CLONE(MWasmBuiltinDivI64)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 428); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 428); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmBuiltinDivI64(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 429 | }; |
| 430 | |
| 431 | class MWasmBuiltinModD : public MAryInstruction<3>, public ArithPolicy::Data { |
| 432 | wasm::BytecodeOffset bytecodeOffset_; |
| 433 | |
| 434 | MWasmBuiltinModD(MDefinition* left, MDefinition* right, MDefinition* instance, |
| 435 | MIRType type) |
| 436 | : MAryInstruction(classOpcode) { |
| 437 | initOperand(0, left); |
| 438 | initOperand(1, right); |
| 439 | initOperand(2, instance); |
| 440 | |
| 441 | setResultType(type); |
| 442 | setMovable(); |
| 443 | } |
| 444 | |
| 445 | public: |
| 446 | INSTRUCTION_HEADER(WasmBuiltinModD) |
| 447 | NAMED_OPERANDS((0, lhs), (1, rhs), (2, instance))static constexpr size_t lhsOperand = 0; MDefinition* lhs() const { return getOperand(0); } static constexpr size_t rhsOperand = 1; MDefinition* rhs() const { return getOperand(1); } static constexpr size_t instanceOperand = 2; MDefinition* instance( ) const { return getOperand(2); } |
| 448 | |
| 449 | static MWasmBuiltinModD* New( |
| 450 | TempAllocator& alloc, MDefinition* left, MDefinition* right, |
| 451 | MDefinition* instance, MIRType type, |
| 452 | wasm::BytecodeOffset bytecodeOffset = wasm::BytecodeOffset()) { |
| 453 | auto* wasmBuiltinModD = |
| 454 | new (alloc) MWasmBuiltinModD(left, right, instance, type); |
| 455 | wasmBuiltinModD->bytecodeOffset_ = bytecodeOffset; |
| 456 | return wasmBuiltinModD; |
| 457 | } |
| 458 | |
| 459 | wasm::BytecodeOffset bytecodeOffset() const { |
| 460 | MOZ_ASSERT(bytecodeOffset_.isValid())do { static_assert( mozilla::detail::AssertionConditionType< decltype(bytecodeOffset_.isValid())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bytecodeOffset_.isValid()))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("bytecodeOffset_.isValid()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 460); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "bytecodeOffset_.isValid()" ")"); do { MOZ_CrashSequence (__null, 460); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); |
| 461 | return bytecodeOffset_; |
| 462 | } |
| 463 | |
| 464 | ALLOW_CLONE(MWasmBuiltinModD)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 464); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 464); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmBuiltinModD(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 465 | }; |
| 466 | |
| 467 | class MWasmBuiltinModI64 : public MAryInstruction<3>, public ArithPolicy::Data { |
| 468 | bool unsigned_; // If false, signedness will be derived from operands |
| 469 | bool canBeNegativeDividend_; |
| 470 | bool canBeDivideByZero_; |
| 471 | bool trapOnError_; |
| 472 | wasm::TrapSiteDesc trapSiteDesc_; |
| 473 | |
| 474 | MWasmBuiltinModI64(MDefinition* left, MDefinition* right, |
| 475 | MDefinition* instance) |
| 476 | : MAryInstruction(classOpcode), |
| 477 | unsigned_(false), |
| 478 | canBeNegativeDividend_(true), |
| 479 | canBeDivideByZero_(true), |
| 480 | trapOnError_(false) { |
| 481 | initOperand(0, left); |
| 482 | initOperand(1, right); |
| 483 | initOperand(2, instance); |
| 484 | |
| 485 | setResultType(MIRType::Int64); |
| 486 | setMovable(); |
| 487 | } |
| 488 | |
| 489 | public: |
| 490 | INSTRUCTION_HEADER(WasmBuiltinModI64) |
| 491 | |
| 492 | NAMED_OPERANDS((0, lhs), (1, rhs), (2, instance))static constexpr size_t lhsOperand = 0; MDefinition* lhs() const { return getOperand(0); } static constexpr size_t rhsOperand = 1; MDefinition* rhs() const { return getOperand(1); } static constexpr size_t instanceOperand = 2; MDefinition* instance( ) const { return getOperand(2); } |
| 493 | |
| 494 | static MWasmBuiltinModI64* New( |
| 495 | TempAllocator& alloc, MDefinition* left, MDefinition* right, |
| 496 | MDefinition* instance, bool unsignd, bool trapOnError = false, |
| 497 | wasm::TrapSiteDesc trapSiteDesc = wasm::TrapSiteDesc()) { |
| 498 | auto* mod = new (alloc) MWasmBuiltinModI64(left, right, instance); |
| 499 | mod->unsigned_ = unsignd; |
| 500 | mod->trapOnError_ = trapOnError; |
| 501 | mod->trapSiteDesc_ = trapSiteDesc; |
| 502 | if (trapOnError) { |
| 503 | mod->setGuard(); // not removable because of possible side-effects. |
| 504 | mod->setNotMovable(); |
| 505 | } |
| 506 | return mod; |
| 507 | } |
| 508 | |
| 509 | bool canBeNegativeDividend() const { |
| 510 | MOZ_ASSERT(!unsigned_)do { static_assert( mozilla::detail::AssertionConditionType< decltype(!unsigned_)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!unsigned_))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!unsigned_", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 510); AnnotateMozCrashReason("MOZ_ASSERT" "(" "!unsigned_" ")" ); do { MOZ_CrashSequence(__null, 510); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 511 | return canBeNegativeDividend_; |
| 512 | } |
| 513 | |
| 514 | bool canBeDivideByZero() const { return canBeDivideByZero_; } |
| 515 | |
| 516 | bool isUnsigned() const { return unsigned_; } |
| 517 | |
| 518 | bool trapOnError() const { return trapOnError_; } |
| 519 | const wasm::TrapSiteDesc& trapSiteDesc() const { |
| 520 | MOZ_ASSERT(trapSiteDesc_.isValid())do { static_assert( mozilla::detail::AssertionConditionType< decltype(trapSiteDesc_.isValid())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(trapSiteDesc_.isValid()))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("trapSiteDesc_.isValid()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 520); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "trapSiteDesc_.isValid()" ")"); do { MOZ_CrashSequence (__null, 520); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); |
| 521 | return trapSiteDesc_; |
| 522 | } |
| 523 | |
| 524 | ALLOW_CLONE(MWasmBuiltinModI64)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 524); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 524); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmBuiltinModI64(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 525 | }; |
| 526 | |
| 527 | // Check whether we need to fire the interrupt handler (in wasm code). |
| 528 | class MWasmInterruptCheck : public MUnaryInstruction, |
| 529 | public NoTypePolicy::Data { |
| 530 | wasm::TrapSiteDesc trapSiteDesc_; |
| 531 | |
| 532 | MWasmInterruptCheck(MDefinition* instance, |
| 533 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 534 | : MUnaryInstruction(classOpcode, instance), trapSiteDesc_(trapSiteDesc) { |
| 535 | setGuard(); |
| 536 | } |
| 537 | |
| 538 | public: |
| 539 | INSTRUCTION_HEADER(WasmInterruptCheck) |
| 540 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 541 | NAMED_OPERANDS((0, instance))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } |
| 542 | |
| 543 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 544 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 545 | |
| 546 | ALLOW_CLONE(MWasmInterruptCheck)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 546); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 546); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmInterruptCheck(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 547 | }; |
| 548 | |
| 549 | // Directly jumps to the indicated trap, leaving Wasm code and reporting a |
| 550 | // runtime error. |
| 551 | |
| 552 | class MWasmTrap : public MAryControlInstruction<0, 0>, |
| 553 | public NoTypePolicy::Data { |
| 554 | wasm::Trap trap_; |
| 555 | wasm::TrapSiteDesc trapSiteDesc_; |
| 556 | |
| 557 | explicit MWasmTrap(wasm::Trap trap, const wasm::TrapSiteDesc& trapSiteDesc) |
| 558 | : MAryControlInstruction(classOpcode), |
| 559 | trap_(trap), |
| 560 | trapSiteDesc_(trapSiteDesc) {} |
| 561 | |
| 562 | public: |
| 563 | INSTRUCTION_HEADER(WasmTrap) |
| 564 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 565 | |
| 566 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 567 | |
| 568 | wasm::Trap trap() const { return trap_; } |
| 569 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 570 | }; |
| 571 | |
| 572 | // Flips the input's sign bit, independently of the rest of the number's |
| 573 | // payload. Note this is different from multiplying by minus-one, which has |
| 574 | // side-effects for e.g. NaNs. |
| 575 | class MWasmNeg : public MUnaryInstruction, public NoTypePolicy::Data { |
| 576 | MWasmNeg(MDefinition* op, MIRType type) : MUnaryInstruction(classOpcode, op) { |
| 577 | setResultType(type); |
| 578 | setMovable(); |
| 579 | } |
| 580 | |
| 581 | public: |
| 582 | INSTRUCTION_HEADER(WasmNeg) |
| 583 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 584 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 585 | ALLOW_CLONE(MWasmNeg)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 585); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 585); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmNeg(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 586 | }; |
| 587 | |
| 588 | // Machine-level bitwise AND/OR/XOR, avoiding all JS-level complexity embodied |
| 589 | // in MBinaryBitwiseInstruction. |
| 590 | class MWasmBinaryBitwise : public MBinaryInstruction, |
| 591 | public NoTypePolicy::Data { |
| 592 | public: |
| 593 | enum class SubOpcode { And, Or, Xor }; |
| 594 | |
| 595 | protected: |
| 596 | MWasmBinaryBitwise(MDefinition* left, MDefinition* right, MIRType type, |
| 597 | SubOpcode subOpcode) |
| 598 | : MBinaryInstruction(classOpcode, left, right), subOpcode_(subOpcode) { |
| 599 | MOZ_ASSERT(type == MIRType::Int32 || type == MIRType::Int64)do { static_assert( mozilla::detail::AssertionConditionType< decltype(type == MIRType::Int32 || type == MIRType::Int64)> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(type == MIRType::Int32 || type == MIRType::Int64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("type == MIRType::Int32 || type == MIRType::Int64" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 599); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type == MIRType::Int32 || type == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 599); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 600 | setResultType(type); |
| 601 | setMovable(); |
| 602 | setCommutative(); |
| 603 | } |
| 604 | |
| 605 | public: |
| 606 | INSTRUCTION_HEADER(WasmBinaryBitwise) |
| 607 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 608 | |
| 609 | SubOpcode subOpcode() const { return subOpcode_; } |
| 610 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 611 | |
| 612 | bool congruentTo(const MDefinition* ins) const override { |
| 613 | return ins->isWasmBinaryBitwise() && |
| 614 | ins->toWasmBinaryBitwise()->subOpcode() == subOpcode() && |
| 615 | binaryCongruentTo(ins); |
| 616 | } |
| 617 | |
| 618 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 619 | |
| 620 | #ifdef JS_JITSPEW1 |
| 621 | void getExtras(ExtrasCollector* extras) const override { |
| 622 | const char* what = "!!unknown!!"; |
Value stored to 'what' during its initialization is never read | |
| 623 | switch (subOpcode()) { |
| 624 | case SubOpcode::And: |
| 625 | what = "And"; |
| 626 | break; |
| 627 | case SubOpcode::Or: |
| 628 | what = "Or"; |
| 629 | break; |
| 630 | case SubOpcode::Xor: |
| 631 | what = "Xor"; |
| 632 | break; |
| 633 | } |
| 634 | extras->add(what); |
| 635 | } |
| 636 | #endif |
| 637 | |
| 638 | private: |
| 639 | SubOpcode subOpcode_; |
| 640 | |
| 641 | ALLOW_CLONE(MWasmBinaryBitwise)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 641); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 641); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmBinaryBitwise(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 642 | }; |
| 643 | |
| 644 | class MWasmLoadInstance : public MUnaryInstruction, public NoTypePolicy::Data { |
| 645 | uint32_t offset_; |
| 646 | AliasSet aliases_; |
| 647 | |
| 648 | explicit MWasmLoadInstance(MDefinition* instance, uint32_t offset, |
| 649 | MIRType type, AliasSet aliases) |
| 650 | : MUnaryInstruction(classOpcode, instance), |
| 651 | offset_(offset), |
| 652 | aliases_(aliases) { |
| 653 | // Different instance data have different alias classes and only those |
| 654 | // classes are allowed. |
| 655 | MOZ_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags())> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 660); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" ")"); do { MOZ_CrashSequence(__null, 660); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 656 | aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags())> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 660); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" ")"); do { MOZ_CrashSequence(__null, 660); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 657 | aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags())> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 660); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" ")"); do { MOZ_CrashSequence(__null, 660); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 658 | aliases_.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags())> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 660); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" ")"); do { MOZ_CrashSequence(__null, 660); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 659 | AliasSet::Load(AliasSet::WasmPendingException).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags())> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 660); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" ")"); do { MOZ_CrashSequence(__null, 660); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 660 | aliases_.flags() == AliasSet::None().flags())do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags())> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta ).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException ).flags() || aliases_.flags() == AliasSet::None().flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 660); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases_.flags() == AliasSet::Load(AliasSet::WasmHeapMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmTableMeta).flags() || aliases_.flags() == AliasSet::Load(AliasSet::WasmPendingException).flags() || aliases_.flags() == AliasSet::None().flags()" ")"); do { MOZ_CrashSequence(__null, 660); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 661 | |
| 662 | // The only types supported at the moment. |
| 663 | MOZ_ASSERT(type == MIRType::Pointer || type == MIRType::Int32 ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef)>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 664); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef" ")"); do { MOZ_CrashSequence(__null, 664); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 664 | type == MIRType::Int64 || type == MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef)>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 664); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef" ")"); do { MOZ_CrashSequence(__null, 664); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 665 | |
| 666 | setMovable(); |
| 667 | setResultType(type); |
| 668 | } |
| 669 | |
| 670 | public: |
| 671 | INSTRUCTION_HEADER(WasmLoadInstance) |
| 672 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 673 | NAMED_OPERANDS((0, instance))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } |
| 674 | |
| 675 | uint32_t offset() const { return offset_; } |
| 676 | |
| 677 | bool congruentTo(const MDefinition* ins) const override { |
| 678 | return op() == ins->op() && |
| 679 | offset() == ins->toWasmLoadInstance()->offset() && |
| 680 | type() == ins->type(); |
| 681 | } |
| 682 | |
| 683 | HashNumber valueHash() const override { |
| 684 | HashNumber hash = MUnaryInstruction::valueHash(); |
| 685 | hash = addU32ToHash(hash, offset()); |
| 686 | return hash; |
| 687 | } |
| 688 | |
| 689 | AliasSet getAliasSet() const override { return aliases_; } |
| 690 | }; |
| 691 | |
| 692 | class MWasmHeapReg : public MNullaryInstruction { |
| 693 | AliasSet aliases_; |
| 694 | |
| 695 | explicit MWasmHeapReg(AliasSet aliases) |
| 696 | : MNullaryInstruction(classOpcode), aliases_(aliases) { |
| 697 | setMovable(); |
| 698 | setResultType(MIRType::Pointer); |
| 699 | } |
| 700 | |
| 701 | public: |
| 702 | INSTRUCTION_HEADER(WasmHeapReg) |
| 703 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 704 | |
| 705 | bool congruentTo(const MDefinition* ins) const override { |
| 706 | return ins->isWasmHeapReg(); |
| 707 | } |
| 708 | |
| 709 | AliasSet getAliasSet() const override { return aliases_; } |
| 710 | }; |
| 711 | |
| 712 | // For memory32, bounds check nodes are of type Int32 on 32-bit systems and |
| 713 | // on 64-bit systems for wasm code that is known to have a bounds check limit |
| 714 | // that fits into 32 bits. |
| 715 | // They are of type Int64 only on 64-bit systems for wasm code with 4GB heaps. |
| 716 | // There is no way for nodes of both types to be present in the same function. |
| 717 | // Should this change, then BCE must be updated to take type into account. |
| 718 | // |
| 719 | // For memory64, bounds check nodes are always of type Int64. |
| 720 | |
| 721 | class MWasmBoundsCheck : public MBinaryInstruction, public NoTypePolicy::Data { |
| 722 | public: |
| 723 | enum Target { |
| 724 | // If using the following options, `targetIndex` must be specified. |
| 725 | Memory, |
| 726 | Table, |
| 727 | // Everything else. Currently used for arrays in the GC proposal. If using |
| 728 | // this, targetIndex should not be used. |
| 729 | Other, |
| 730 | }; |
| 731 | |
| 732 | private: |
| 733 | wasm::TrapSiteDesc trapSiteDesc_; |
| 734 | Target target_; |
| 735 | uint32_t targetIndex_; |
| 736 | |
| 737 | explicit MWasmBoundsCheck(MDefinition* index, MDefinition* boundsCheckLimit, |
| 738 | const wasm::TrapSiteDesc& trapSiteDesc, |
| 739 | Target target, uint32_t targetIndex = UINT32_MAX(4294967295U)) |
| 740 | : MBinaryInstruction(classOpcode, index, boundsCheckLimit), |
| 741 | trapSiteDesc_(trapSiteDesc), |
| 742 | target_(target), |
| 743 | targetIndex_(targetIndex) { |
| 744 | MOZ_ASSERT(index->type() == boundsCheckLimit->type())do { static_assert( mozilla::detail::AssertionConditionType< decltype(index->type() == boundsCheckLimit->type())> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(index->type() == boundsCheckLimit->type()))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("index->type() == boundsCheckLimit->type()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 744); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "index->type() == boundsCheckLimit->type()" ")"); do { MOZ_CrashSequence(__null, 744); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 745 | MOZ_ASSERT_IF(target == Memory || target == Table,do { if (target == Memory || target == Table) { do { static_assert ( mozilla::detail::AssertionConditionType<decltype(targetIndex != (4294967295U))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(targetIndex != (4294967295U) ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "targetIndex != (4294967295U)", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 746); AnnotateMozCrashReason("MOZ_ASSERT" "(" "targetIndex != (4294967295U)" ")"); do { MOZ_CrashSequence(__null, 746); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
| 746 | targetIndex != UINT32_MAX)do { if (target == Memory || target == Table) { do { static_assert ( mozilla::detail::AssertionConditionType<decltype(targetIndex != (4294967295U))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(targetIndex != (4294967295U) ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "targetIndex != (4294967295U)", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 746); AnnotateMozCrashReason("MOZ_ASSERT" "(" "targetIndex != (4294967295U)" ")"); do { MOZ_CrashSequence(__null, 746); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
| 747 | MOZ_ASSERT_IF(target == Other, targetIndex == UINT32_MAX)do { if (target == Other) { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(targetIndex == (4294967295U ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(targetIndex == (4294967295U)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("targetIndex == (4294967295U)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 747); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "targetIndex == (4294967295U)" ")"); do { MOZ_CrashSequence (__null, 747); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); } } while (false); |
| 748 | |
| 749 | // Bounds check is effectful: it throws for OOB. |
| 750 | setGuard(); |
| 751 | |
| 752 | if (JitOptions.spectreIndexMasking) { |
| 753 | setResultType(index->type()); |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | public: |
| 758 | INSTRUCTION_HEADER(WasmBoundsCheck) |
| 759 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 760 | NAMED_OPERANDS((0, index), (1, boundsCheckLimit))static constexpr size_t indexOperand = 0; MDefinition* index( ) const { return getOperand(0); } static constexpr size_t boundsCheckLimitOperand = 1; MDefinition* boundsCheckLimit() const { return getOperand (1); } |
| 761 | |
| 762 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 763 | |
| 764 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 765 | Target target() const { return target_; } |
| 766 | uint32_t targetIndex() const { return targetIndex_; } |
| 767 | |
| 768 | bool isRedundant() const { return !isGuard(); } |
| 769 | void setRedundant() { setNotGuard(); } |
| 770 | |
| 771 | bool congruentTo(const MDefinition* ins) const override { |
| 772 | return congruentIfOperandsEqual(ins) && |
| 773 | ins->toWasmBoundsCheck()->target() == target() && |
| 774 | ins->toWasmBoundsCheck()->targetIndex() == targetIndex(); |
| 775 | } |
| 776 | |
| 777 | ALLOW_CLONE(MWasmBoundsCheck)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 777); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 777); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmBoundsCheck(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 778 | }; |
| 779 | |
| 780 | class MWasmAddOffset : public MUnaryInstruction, public NoTypePolicy::Data { |
| 781 | uint64_t offset_; |
| 782 | wasm::TrapSiteDesc trapSiteDesc_; |
| 783 | |
| 784 | MWasmAddOffset(MDefinition* base, uint64_t offset, |
| 785 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 786 | : MUnaryInstruction(classOpcode, base), |
| 787 | offset_(offset), |
| 788 | trapSiteDesc_(trapSiteDesc) { |
| 789 | setGuard(); |
| 790 | MOZ_ASSERT(base->type() == MIRType::Int32 ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == MIRType::Int32 || base->type() == MIRType::Int64)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == MIRType:: Int32 || base->type() == MIRType::Int64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == MIRType::Int32 || base->type() == MIRType::Int64" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 791); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::Int32 || base->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 791); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 791 | base->type() == MIRType::Int64)do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == MIRType::Int32 || base->type() == MIRType::Int64)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == MIRType:: Int32 || base->type() == MIRType::Int64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == MIRType::Int32 || base->type() == MIRType::Int64" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 791); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::Int32 || base->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 791); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 792 | setResultType(base->type()); |
| 793 | } |
| 794 | |
| 795 | public: |
| 796 | INSTRUCTION_HEADER(WasmAddOffset) |
| 797 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 798 | NAMED_OPERANDS((0, base))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } |
| 799 | |
| 800 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 801 | |
| 802 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 803 | |
| 804 | uint64_t offset() const { return offset_; } |
| 805 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 806 | }; |
| 807 | |
| 808 | class MWasmAlignmentCheck : public MUnaryInstruction, |
| 809 | public NoTypePolicy::Data { |
| 810 | uint32_t byteSize_; |
| 811 | wasm::TrapSiteDesc trapSiteDesc_; |
| 812 | |
| 813 | explicit MWasmAlignmentCheck(MDefinition* index, uint32_t byteSize, |
| 814 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 815 | : MUnaryInstruction(classOpcode, index), |
| 816 | byteSize_(byteSize), |
| 817 | trapSiteDesc_(trapSiteDesc) { |
| 818 | MOZ_ASSERT(std::has_single_bit(byteSize))do { static_assert( mozilla::detail::AssertionConditionType< decltype(std::has_single_bit(byteSize))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(std::has_single_bit(byteSize )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("std::has_single_bit(byteSize)", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 818); AnnotateMozCrashReason("MOZ_ASSERT" "(" "std::has_single_bit(byteSize)" ")"); do { MOZ_CrashSequence(__null, 818); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 819 | // Alignment check is effectful: it throws for unaligned. |
| 820 | setGuard(); |
| 821 | } |
| 822 | |
| 823 | public: |
| 824 | INSTRUCTION_HEADER(WasmAlignmentCheck) |
| 825 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 826 | NAMED_OPERANDS((0, index))static constexpr size_t indexOperand = 0; MDefinition* index( ) const { return getOperand(0); } |
| 827 | |
| 828 | bool congruentTo(const MDefinition* ins) const override; |
| 829 | |
| 830 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 831 | |
| 832 | uint32_t byteSize() const { return byteSize_; } |
| 833 | |
| 834 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 835 | |
| 836 | ALLOW_CLONE(MWasmAlignmentCheck)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 836); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 836); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmAlignmentCheck(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 837 | }; |
| 838 | |
| 839 | class MWasmLoad |
| 840 | : public MVariadicInstruction, // memoryBase is nullptr on some platforms |
| 841 | public NoTypePolicy::Data { |
| 842 | wasm::MemoryAccessDesc access_; |
| 843 | |
| 844 | explicit MWasmLoad(const wasm::MemoryAccessDesc& access, MIRType resultType) |
| 845 | : MVariadicInstruction(classOpcode), access_(access) { |
| 846 | setGuard(); |
| 847 | setResultType(resultType); |
| 848 | } |
| 849 | |
| 850 | public: |
| 851 | INSTRUCTION_HEADER(WasmLoad) |
| 852 | NAMED_OPERANDS((0, base), (1, memoryBase))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t memoryBaseOperand = 1; MDefinition* memoryBase() const { return getOperand(1); }; |
| 853 | |
| 854 | static MWasmLoad* New(TempAllocator& alloc, MDefinition* memoryBase, |
| 855 | MDefinition* base, const wasm::MemoryAccessDesc& access, |
| 856 | MIRType resultType) { |
| 857 | MWasmLoad* load = new (alloc) MWasmLoad(access, resultType); |
| 858 | if (!load->init(alloc, 1 + !!memoryBase)) { |
| 859 | return nullptr; |
| 860 | } |
| 861 | |
| 862 | load->initOperand(0, base); |
| 863 | if (memoryBase) { |
| 864 | load->initOperand(1, memoryBase); |
| 865 | } |
| 866 | |
| 867 | return load; |
| 868 | } |
| 869 | |
| 870 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 871 | |
| 872 | AliasSet getAliasSet() const override { |
| 873 | // When a barrier is needed, make the instruction effectful by giving |
| 874 | // it a "store" effect. |
| 875 | if (access_.isAtomic()) { |
| 876 | return AliasSet::Store(AliasSet::WasmHeap); |
| 877 | } |
| 878 | return AliasSet::Load(AliasSet::WasmHeap); |
| 879 | } |
| 880 | |
| 881 | bool hasMemoryBase() const { return numOperands() > 1; } |
| 882 | |
| 883 | #ifdef JS_JITSPEW1 |
| 884 | void getExtras(ExtrasCollector* extras) const override { |
| 885 | char buf[64]; |
| 886 | SprintfLiteral(buf, "(offs=%lld)", (long long int)access().offset64()); |
| 887 | extras->add(buf); |
| 888 | } |
| 889 | #endif |
| 890 | |
| 891 | // Unfortunately we cannot use ALLOW_CLONE here, due to the variable number |
| 892 | // of operands. |
| 893 | bool canClone() const override { return true; } |
| 894 | MInstruction* clone(TempAllocator& alloc, |
| 895 | const MDefinitionVector& inputs) const override { |
| 896 | MInstruction* res = |
| 897 | MWasmLoad::New(alloc, hasMemoryBase() ? memoryBase() : nullptr, base(), |
| 898 | access(), type()); |
| 899 | if (!res) { |
| 900 | return nullptr; |
| 901 | } |
| 902 | for (size_t i = 0; i < numOperands(); i++) { |
| 903 | res->replaceOperand(i, inputs[i]); |
| 904 | } |
| 905 | return res; |
| 906 | } |
| 907 | }; |
| 908 | |
| 909 | class MWasmStore : public MVariadicInstruction, public NoTypePolicy::Data { |
| 910 | wasm::MemoryAccessDesc access_; |
| 911 | |
| 912 | explicit MWasmStore(const wasm::MemoryAccessDesc& access) |
| 913 | : MVariadicInstruction(classOpcode), access_(access) { |
| 914 | setGuard(); |
| 915 | } |
| 916 | |
| 917 | public: |
| 918 | INSTRUCTION_HEADER(WasmStore) |
| 919 | NAMED_OPERANDS((0, base), (1, value), (2, memoryBase))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t valueOperand = 1; MDefinition* value() const { return getOperand(1); } static constexpr size_t memoryBaseOperand = 2; MDefinition* memoryBase () const { return getOperand(2); } |
| 920 | |
| 921 | static MWasmStore* New(TempAllocator& alloc, MDefinition* memoryBase, |
| 922 | MDefinition* base, |
| 923 | const wasm::MemoryAccessDesc& access, |
| 924 | MDefinition* value) { |
| 925 | MWasmStore* store = new (alloc) MWasmStore(access); |
| 926 | if (!store->init(alloc, 2 + !!memoryBase)) { |
| 927 | return nullptr; |
| 928 | } |
| 929 | |
| 930 | store->initOperand(0, base); |
| 931 | store->initOperand(1, value); |
| 932 | if (memoryBase) { |
| 933 | store->initOperand(2, memoryBase); |
| 934 | } |
| 935 | |
| 936 | return store; |
| 937 | } |
| 938 | |
| 939 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 940 | |
| 941 | AliasSet getAliasSet() const override { |
| 942 | return AliasSet::Store(AliasSet::WasmHeap); |
| 943 | } |
| 944 | |
| 945 | bool hasMemoryBase() const { return numOperands() > 2; } |
| 946 | |
| 947 | #ifdef JS_JITSPEW1 |
| 948 | void getExtras(ExtrasCollector* extras) const override { |
| 949 | char buf[64]; |
| 950 | SprintfLiteral(buf, "(offs=%lld)", (long long int)access().offset64()); |
| 951 | extras->add(buf); |
| 952 | } |
| 953 | #endif |
| 954 | |
| 955 | bool canClone() const override { return true; } |
| 956 | MInstruction* clone(TempAllocator& alloc, |
| 957 | const MDefinitionVector& inputs) const override { |
| 958 | MInstruction* res = |
| 959 | MWasmStore::New(alloc, hasMemoryBase() ? memoryBase() : nullptr, base(), |
| 960 | access(), value()); |
| 961 | if (!res) { |
| 962 | return nullptr; |
| 963 | } |
| 964 | for (size_t i = 0; i < numOperands(); i++) { |
| 965 | res->replaceOperand(i, inputs[i]); |
| 966 | } |
| 967 | return res; |
| 968 | } |
| 969 | }; |
| 970 | |
| 971 | class MWasmCompareExchangeHeap : public MVariadicInstruction, |
| 972 | public NoTypePolicy::Data { |
| 973 | wasm::MemoryAccessDesc access_; |
| 974 | wasm::BytecodeOffset bytecodeOffset_; |
| 975 | |
| 976 | explicit MWasmCompareExchangeHeap(const wasm::MemoryAccessDesc& access, |
| 977 | wasm::BytecodeOffset bytecodeOffset) |
| 978 | : MVariadicInstruction(classOpcode), |
| 979 | access_(access), |
| 980 | bytecodeOffset_(bytecodeOffset) { |
| 981 | setGuard(); // Not removable |
| 982 | setResultType(ScalarTypeToMIRType(access.type())); |
| 983 | } |
| 984 | |
| 985 | public: |
| 986 | INSTRUCTION_HEADER(WasmCompareExchangeHeap) |
| 987 | NAMED_OPERANDS((0, base), (1, oldValue), (2, newValue), (3, instance),static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t oldValueOperand = 1; MDefinition* oldValue() const { return getOperand(1); } static constexpr size_t newValueOperand = 2; MDefinition* newValue () const { return getOperand(2); } static constexpr size_t instanceOperand = 3; MDefinition* instance() const { return getOperand(3); } static constexpr size_t memoryBaseOperand = 4; MDefinition* memoryBase () const { return getOperand(4); } |
| 988 | (4, memoryBase))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t oldValueOperand = 1; MDefinition* oldValue() const { return getOperand(1); } static constexpr size_t newValueOperand = 2; MDefinition* newValue () const { return getOperand(2); } static constexpr size_t instanceOperand = 3; MDefinition* instance() const { return getOperand(3); } static constexpr size_t memoryBaseOperand = 4; MDefinition* memoryBase () const { return getOperand(4); } |
| 989 | |
| 990 | static MWasmCompareExchangeHeap* New(TempAllocator& alloc, |
| 991 | wasm::BytecodeOffset bytecodeOffset, |
| 992 | MDefinition* memoryBase, |
| 993 | MDefinition* base, |
| 994 | const wasm::MemoryAccessDesc& access, |
| 995 | MDefinition* oldv, MDefinition* newv, |
| 996 | MDefinition* instance) { |
| 997 | MWasmCompareExchangeHeap* cas = |
| 998 | new (alloc) MWasmCompareExchangeHeap(access, bytecodeOffset); |
| 999 | if (!cas->init(alloc, 4 + !!memoryBase)) { |
| 1000 | return nullptr; |
| 1001 | } |
| 1002 | cas->initOperand(0, base); |
| 1003 | cas->initOperand(1, oldv); |
| 1004 | cas->initOperand(2, newv); |
| 1005 | cas->initOperand(3, instance); |
| 1006 | if (memoryBase) { |
| 1007 | cas->initOperand(4, memoryBase); |
| 1008 | } |
| 1009 | return cas; |
| 1010 | } |
| 1011 | |
| 1012 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 1013 | wasm::BytecodeOffset bytecodeOffset() const { return bytecodeOffset_; } |
| 1014 | |
| 1015 | AliasSet getAliasSet() const override { |
| 1016 | return AliasSet::Store(AliasSet::WasmHeap); |
| 1017 | } |
| 1018 | |
| 1019 | bool hasMemoryBase() const { return numOperands() > 4; } |
| 1020 | }; |
| 1021 | |
| 1022 | class MWasmAtomicExchangeHeap : public MVariadicInstruction, |
| 1023 | public NoTypePolicy::Data { |
| 1024 | wasm::MemoryAccessDesc access_; |
| 1025 | wasm::BytecodeOffset bytecodeOffset_; |
| 1026 | |
| 1027 | explicit MWasmAtomicExchangeHeap(const wasm::MemoryAccessDesc& access, |
| 1028 | wasm::BytecodeOffset bytecodeOffset) |
| 1029 | : MVariadicInstruction(classOpcode), |
| 1030 | access_(access), |
| 1031 | bytecodeOffset_(bytecodeOffset) { |
| 1032 | setGuard(); // Not removable |
| 1033 | setResultType(ScalarTypeToMIRType(access.type())); |
| 1034 | } |
| 1035 | |
| 1036 | public: |
| 1037 | INSTRUCTION_HEADER(WasmAtomicExchangeHeap) |
| 1038 | NAMED_OPERANDS((0, base), (1, value), (2, instance), (3, memoryBase))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t valueOperand = 1; MDefinition* value() const { return getOperand(1); } static constexpr size_t instanceOperand = 2; MDefinition* instance( ) const { return getOperand(2); } static constexpr size_t memoryBaseOperand = 3; MDefinition* memoryBase() const { return getOperand(3); } |
| 1039 | |
| 1040 | static MWasmAtomicExchangeHeap* New(TempAllocator& alloc, |
| 1041 | wasm::BytecodeOffset bytecodeOffset, |
| 1042 | MDefinition* memoryBase, |
| 1043 | MDefinition* base, |
| 1044 | const wasm::MemoryAccessDesc& access, |
| 1045 | MDefinition* value, |
| 1046 | MDefinition* instance) { |
| 1047 | MWasmAtomicExchangeHeap* xchg = |
| 1048 | new (alloc) MWasmAtomicExchangeHeap(access, bytecodeOffset); |
| 1049 | if (!xchg->init(alloc, 3 + !!memoryBase)) { |
| 1050 | return nullptr; |
| 1051 | } |
| 1052 | |
| 1053 | xchg->initOperand(0, base); |
| 1054 | xchg->initOperand(1, value); |
| 1055 | xchg->initOperand(2, instance); |
| 1056 | if (memoryBase) { |
| 1057 | xchg->initOperand(3, memoryBase); |
| 1058 | } |
| 1059 | |
| 1060 | return xchg; |
| 1061 | } |
| 1062 | |
| 1063 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 1064 | wasm::BytecodeOffset bytecodeOffset() const { return bytecodeOffset_; } |
| 1065 | |
| 1066 | AliasSet getAliasSet() const override { |
| 1067 | return AliasSet::Store(AliasSet::WasmHeap); |
| 1068 | } |
| 1069 | |
| 1070 | bool hasMemoryBase() const { return numOperands() > 3; } |
| 1071 | }; |
| 1072 | |
| 1073 | class MWasmAtomicBinopHeap : public MVariadicInstruction, |
| 1074 | public NoTypePolicy::Data { |
| 1075 | AtomicOp op_; |
| 1076 | wasm::MemoryAccessDesc access_; |
| 1077 | wasm::BytecodeOffset bytecodeOffset_; |
| 1078 | |
| 1079 | explicit MWasmAtomicBinopHeap(AtomicOp op, |
| 1080 | const wasm::MemoryAccessDesc& access, |
| 1081 | wasm::BytecodeOffset bytecodeOffset) |
| 1082 | : MVariadicInstruction(classOpcode), |
| 1083 | op_(op), |
| 1084 | access_(access), |
| 1085 | bytecodeOffset_(bytecodeOffset) { |
| 1086 | setGuard(); // Not removable |
| 1087 | setResultType(ScalarTypeToMIRType(access.type())); |
| 1088 | } |
| 1089 | |
| 1090 | public: |
| 1091 | INSTRUCTION_HEADER(WasmAtomicBinopHeap) |
| 1092 | NAMED_OPERANDS((0, base), (1, value), (2, instance), (3, memoryBase))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t valueOperand = 1; MDefinition* value() const { return getOperand(1); } static constexpr size_t instanceOperand = 2; MDefinition* instance( ) const { return getOperand(2); } static constexpr size_t memoryBaseOperand = 3; MDefinition* memoryBase() const { return getOperand(3); } |
| 1093 | |
| 1094 | static MWasmAtomicBinopHeap* New(TempAllocator& alloc, |
| 1095 | wasm::BytecodeOffset bytecodeOffset, |
| 1096 | AtomicOp op, MDefinition* memoryBase, |
| 1097 | MDefinition* base, |
| 1098 | const wasm::MemoryAccessDesc& access, |
| 1099 | MDefinition* v, MDefinition* instance) { |
| 1100 | MWasmAtomicBinopHeap* binop = |
| 1101 | new (alloc) MWasmAtomicBinopHeap(op, access, bytecodeOffset); |
| 1102 | if (!binop->init(alloc, 3 + !!memoryBase)) { |
| 1103 | return nullptr; |
| 1104 | } |
| 1105 | |
| 1106 | binop->initOperand(0, base); |
| 1107 | binop->initOperand(1, v); |
| 1108 | binop->initOperand(2, instance); |
| 1109 | if (memoryBase) { |
| 1110 | binop->initOperand(3, memoryBase); |
| 1111 | } |
| 1112 | |
| 1113 | return binop; |
| 1114 | } |
| 1115 | |
| 1116 | AtomicOp operation() const { return op_; } |
| 1117 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 1118 | wasm::BytecodeOffset bytecodeOffset() const { return bytecodeOffset_; } |
| 1119 | |
| 1120 | AliasSet getAliasSet() const override { |
| 1121 | return AliasSet::Store(AliasSet::WasmHeap); |
| 1122 | } |
| 1123 | |
| 1124 | bool hasMemoryBase() const { return numOperands() > 3; } |
| 1125 | }; |
| 1126 | |
| 1127 | class MWasmLoadInstanceDataField : public MUnaryInstruction, |
| 1128 | public NoTypePolicy::Data { |
| 1129 | unsigned instanceDataOffset_; |
| 1130 | bool isConstant_; |
| 1131 | |
| 1132 | MWasmLoadInstanceDataField( |
| 1133 | MIRType type, unsigned instanceDataOffset, bool isConstant, |
| 1134 | MDefinition* instance, |
| 1135 | wasm::MaybeRefType maybeRefType = wasm::MaybeRefType()) |
| 1136 | : MUnaryInstruction(classOpcode, instance), |
| 1137 | instanceDataOffset_(instanceDataOffset), |
| 1138 | isConstant_(isConstant) { |
| 1139 | MOZ_ASSERT(IsNumberType(type) || type == MIRType::Simd128 ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsNumberType(type) || type == MIRType::Simd128 || type == MIRType::Pointer || type == MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsNumberType(type) || type == MIRType::Simd128 || type == MIRType ::Pointer || type == MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsNumberType(type) || type == MIRType::Simd128 || type == MIRType::Pointer || type == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1140); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "IsNumberType(type) || type == MIRType::Simd128 || type == MIRType::Pointer || type == MIRType::WasmAnyRef" ")"); do { MOZ_CrashSequence(__null, 1140); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 1140 | type == MIRType::Pointer || type == MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsNumberType(type) || type == MIRType::Simd128 || type == MIRType::Pointer || type == MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsNumberType(type) || type == MIRType::Simd128 || type == MIRType ::Pointer || type == MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsNumberType(type) || type == MIRType::Simd128 || type == MIRType::Pointer || type == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1140); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "IsNumberType(type) || type == MIRType::Simd128 || type == MIRType::Pointer || type == MIRType::WasmAnyRef" ")"); do { MOZ_CrashSequence(__null, 1140); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1141 | setResultType(type); |
| 1142 | setMovable(); |
| 1143 | setWasmRefType(maybeRefType); |
| 1144 | } |
| 1145 | |
| 1146 | public: |
| 1147 | INSTRUCTION_HEADER(WasmLoadInstanceDataField) |
| 1148 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1149 | NAMED_OPERANDS((0, instance))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } |
| 1150 | |
| 1151 | unsigned instanceDataOffset() const { return instanceDataOffset_; } |
| 1152 | |
| 1153 | HashNumber valueHash() const override; |
| 1154 | bool congruentTo(const MDefinition* ins) const override; |
| 1155 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 1156 | |
| 1157 | AliasSet getAliasSet() const override { |
| 1158 | return isConstant_ ? AliasSet::None() |
| 1159 | : AliasSet::Load(AliasSet::WasmInstanceData); |
| 1160 | } |
| 1161 | |
| 1162 | AliasType mightAlias(const MDefinition* def) const override; |
| 1163 | |
| 1164 | #ifdef JS_JITSPEW1 |
| 1165 | void getExtras(ExtrasCollector* extras) const override { |
| 1166 | char buf[96]; |
| 1167 | SprintfLiteral(buf, "(offs=%lld, isConst=%s)", |
| 1168 | (long long int)instanceDataOffset_, |
| 1169 | isConstant_ ? "true" : "false"); |
| 1170 | extras->add(buf); |
| 1171 | } |
| 1172 | #endif |
| 1173 | |
| 1174 | ALLOW_CLONE(MWasmLoadInstanceDataField)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1174); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1174); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmLoadInstanceDataField(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i ++) { res->replaceOperand(i, inputs[i]); } return res; } |
| 1175 | }; |
| 1176 | |
| 1177 | // Fetch 64 bits of data from a specified byte offset inside |
| 1178 | // Instance::baselineScratchWords_. The low 32 bits are read from |
| 1179 | // [offset .. offset+3] and the upper 32 bits from [offset+4 .. offset+7], |
| 1180 | // regardless of the endianness of the host. However, each 32-bit unit is |
| 1181 | // loaded using the host's own endianness. See also |
| 1182 | // MWasmStoreInstanceScratch2xI32, and comments on Instance::addSubI128. |
| 1183 | class MWasmLoadInstanceScratch2xI32 : public MUnaryInstruction, |
| 1184 | public NoTypePolicy::Data { |
| 1185 | uint32_t byteOffset_; |
| 1186 | |
| 1187 | MWasmLoadInstanceScratch2xI32(uint32_t byteOffset, MDefinition* instance) |
| 1188 | : MUnaryInstruction(classOpcode, instance), byteOffset_(byteOffset) { |
| 1189 | MOZ_ASSERT(byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords())do { static_assert( mozilla::detail::AssertionConditionType< decltype(byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords ())>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1189); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords()" ")"); do { MOZ_CrashSequence(__null, 1189); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1190 | MOZ_ASSERT(instance->type() == MIRType::Pointer)do { static_assert( mozilla::detail::AssertionConditionType< decltype(instance->type() == MIRType::Pointer)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(instance->type() == MIRType::Pointer))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("instance->type() == MIRType::Pointer" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1190); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "instance->type() == MIRType::Pointer" ")" ); do { MOZ_CrashSequence(__null, 1190); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1191 | setResultType(MIRType::Int64); |
| 1192 | setMovable(); |
| 1193 | } |
| 1194 | |
| 1195 | public: |
| 1196 | INSTRUCTION_HEADER(WasmLoadInstanceScratch2xI32) |
| 1197 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1198 | NAMED_OPERANDS((0, instance))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } |
| 1199 | |
| 1200 | uint32_t byteOffset() const { return byteOffset_; } |
| 1201 | |
| 1202 | AliasSet getAliasSet() const override { |
| 1203 | return AliasSet::Load(AliasSet::WasmInstanceScratchWords); |
| 1204 | } |
| 1205 | |
| 1206 | bool congruentTo(const MDefinition* ins) const override { |
| 1207 | return ins->isWasmLoadInstanceScratch2xI32() && |
| 1208 | congruentIfOperandsEqual(ins) && |
| 1209 | ins->toWasmLoadInstanceScratch2xI32()->byteOffset() == byteOffset(); |
| 1210 | } |
| 1211 | |
| 1212 | #ifdef JS_JITSPEW1 |
| 1213 | void getExtras(ExtrasCollector* extras) const override { |
| 1214 | char buf[96]; |
| 1215 | SprintfLiteral(buf, "(byteOffset=%u)", byteOffset_); |
| 1216 | extras->add(buf); |
| 1217 | } |
| 1218 | #endif |
| 1219 | |
| 1220 | ALLOW_CLONE(MWasmLoadInstanceScratch2xI32)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1220); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1220); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmLoadInstanceScratch2xI32(*this); if (!res ) { return nullptr; } for (size_t i = 0; i < numOperands() ; i++) { res->replaceOperand(i, inputs[i]); } return res; } |
| 1221 | }; |
| 1222 | |
| 1223 | class MWasmLoadGlobalCell : public MUnaryInstruction, |
| 1224 | public NoTypePolicy::Data { |
| 1225 | MWasmLoadGlobalCell(MIRType type, MDefinition* cellPtr, |
| 1226 | wasm::ValType globalType) |
| 1227 | : MUnaryInstruction(classOpcode, cellPtr) { |
| 1228 | setResultType(type); |
| 1229 | setMovable(); |
| 1230 | setWasmRefType(globalType.toMaybeRefType()); |
| 1231 | } |
| 1232 | |
| 1233 | public: |
| 1234 | INSTRUCTION_HEADER(WasmLoadGlobalCell) |
| 1235 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1236 | NAMED_OPERANDS((0, cellPtr))static constexpr size_t cellPtrOperand = 0; MDefinition* cellPtr () const { return getOperand(0); } |
| 1237 | |
| 1238 | // The default valueHash is good enough, because there are no non-operand |
| 1239 | // fields. |
| 1240 | bool congruentTo(const MDefinition* ins) const override; |
| 1241 | |
| 1242 | AliasSet getAliasSet() const override { |
| 1243 | return AliasSet::Load(AliasSet::WasmGlobalCell); |
| 1244 | } |
| 1245 | |
| 1246 | AliasType mightAlias(const MDefinition* def) const override; |
| 1247 | |
| 1248 | ALLOW_CLONE(MWasmLoadGlobalCell)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1248); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1248); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmLoadGlobalCell(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 1249 | }; |
| 1250 | |
| 1251 | class MWasmLoadTableElement : public MBinaryInstruction, |
| 1252 | public NoTypePolicy::Data { |
| 1253 | MWasmLoadTableElement(MDefinition* elements, MDefinition* index, |
| 1254 | wasm::RefType refType) |
| 1255 | : MBinaryInstruction(classOpcode, elements, index) { |
| 1256 | setResultType(MIRType::WasmAnyRef); |
| 1257 | setWasmRefType(wasm::MaybeRefType(refType)); |
| 1258 | } |
| 1259 | |
| 1260 | public: |
| 1261 | INSTRUCTION_HEADER(WasmLoadTableElement) |
| 1262 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1263 | NAMED_OPERANDS((0, elements))static constexpr size_t elementsOperand = 0; MDefinition* elements () const { return getOperand(0); } |
| 1264 | NAMED_OPERANDS((1, index))static constexpr size_t indexOperand = 1; MDefinition* index( ) const { return getOperand(1); } |
| 1265 | |
| 1266 | AliasSet getAliasSet() const override { |
| 1267 | return AliasSet::Load(AliasSet::WasmTableElement); |
| 1268 | } |
| 1269 | }; |
| 1270 | |
| 1271 | class MWasmStoreInstanceDataField : public MBinaryInstruction, |
| 1272 | public NoTypePolicy::Data { |
| 1273 | MWasmStoreInstanceDataField(unsigned instanceDataOffset, MDefinition* value, |
| 1274 | MDefinition* instance) |
| 1275 | : MBinaryInstruction(classOpcode, value, instance), |
| 1276 | instanceDataOffset_(instanceDataOffset) {} |
| 1277 | |
| 1278 | unsigned instanceDataOffset_; |
| 1279 | |
| 1280 | public: |
| 1281 | INSTRUCTION_HEADER(WasmStoreInstanceDataField) |
| 1282 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1283 | NAMED_OPERANDS((0, value), (1, instance))static constexpr size_t valueOperand = 0; MDefinition* value( ) const { return getOperand(0); } static constexpr size_t instanceOperand = 1; MDefinition* instance() const { return getOperand(1); } |
| 1284 | |
| 1285 | unsigned instanceDataOffset() const { return instanceDataOffset_; } |
| 1286 | |
| 1287 | AliasSet getAliasSet() const override { |
| 1288 | return AliasSet::Store(AliasSet::WasmInstanceData); |
| 1289 | } |
| 1290 | }; |
| 1291 | |
| 1292 | // Store 64 bits of data at a specified byte offset inside |
| 1293 | // Instance::baselineScratchWords_. See comments on |
| 1294 | // MWasmLoadInstanceScratch2xI32 for important details. |
| 1295 | class MWasmStoreInstanceScratch2xI32 : public MBinaryInstruction, |
| 1296 | public NoTypePolicy::Data { |
| 1297 | unsigned byteOffset_; |
| 1298 | |
| 1299 | MWasmStoreInstanceScratch2xI32(uint32_t byteOffset, MDefinition* value, |
| 1300 | MDefinition* instance) |
| 1301 | : MBinaryInstruction(classOpcode, value, instance), |
| 1302 | byteOffset_(byteOffset) { |
| 1303 | MOZ_ASSERT(byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords())do { static_assert( mozilla::detail::AssertionConditionType< decltype(byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords ())>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1303); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords()" ")"); do { MOZ_CrashSequence(__null, 1303); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1304 | MOZ_ASSERT(value->type() == MIRType::Int64)do { static_assert( mozilla::detail::AssertionConditionType< decltype(value->type() == MIRType::Int64)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(value->type() == MIRType:: Int64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("value->type() == MIRType::Int64", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 1304); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 1304); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1305 | MOZ_ASSERT(instance->type() == MIRType::Pointer)do { static_assert( mozilla::detail::AssertionConditionType< decltype(instance->type() == MIRType::Pointer)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(instance->type() == MIRType::Pointer))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("instance->type() == MIRType::Pointer" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1305); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "instance->type() == MIRType::Pointer" ")" ); do { MOZ_CrashSequence(__null, 1305); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1306 | } |
| 1307 | |
| 1308 | public: |
| 1309 | INSTRUCTION_HEADER(WasmStoreInstanceScratch2xI32) |
| 1310 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1311 | NAMED_OPERANDS((0, value), (1, instance))static constexpr size_t valueOperand = 0; MDefinition* value( ) const { return getOperand(0); } static constexpr size_t instanceOperand = 1; MDefinition* instance() const { return getOperand(1); } |
| 1312 | |
| 1313 | unsigned byteOffset() const { return byteOffset_; } |
| 1314 | |
| 1315 | AliasSet getAliasSet() const override { |
| 1316 | return AliasSet::Store(AliasSet::WasmInstanceScratchWords); |
| 1317 | } |
| 1318 | |
| 1319 | bool congruentTo(const MDefinition* ins) const override { return false; } |
| 1320 | |
| 1321 | #ifdef JS_JITSPEW1 |
| 1322 | void getExtras(ExtrasCollector* extras) const override { |
| 1323 | char buf[96]; |
| 1324 | SprintfLiteral(buf, "(byteOffset=%u)", byteOffset_); |
| 1325 | extras->add(buf); |
| 1326 | } |
| 1327 | #endif |
| 1328 | |
| 1329 | ALLOW_CLONE(MWasmStoreInstanceScratch2xI32)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1329); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1329); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmStoreInstanceScratch2xI32(*this); if (!res ) { return nullptr; } for (size_t i = 0; i < numOperands() ; i++) { res->replaceOperand(i, inputs[i]); } return res; } |
| 1330 | }; |
| 1331 | |
| 1332 | class MWasmStoreGlobalCell : public MBinaryInstruction, |
| 1333 | public NoTypePolicy::Data { |
| 1334 | MWasmStoreGlobalCell(MDefinition* value, MDefinition* cellPtr) |
| 1335 | : MBinaryInstruction(classOpcode, value, cellPtr) {} |
| 1336 | |
| 1337 | public: |
| 1338 | INSTRUCTION_HEADER(WasmStoreGlobalCell) |
| 1339 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1340 | NAMED_OPERANDS((0, value), (1, cellPtr))static constexpr size_t valueOperand = 0; MDefinition* value( ) const { return getOperand(0); } static constexpr size_t cellPtrOperand = 1; MDefinition* cellPtr() const { return getOperand(1); } |
| 1341 | |
| 1342 | AliasSet getAliasSet() const override { |
| 1343 | return AliasSet::Store(AliasSet::WasmGlobalCell); |
| 1344 | } |
| 1345 | |
| 1346 | ALLOW_CLONE(MWasmStoreGlobalCell)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1346); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1346); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmStoreGlobalCell(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 1347 | }; |
| 1348 | |
| 1349 | class MWasmStoreStackResult : public MBinaryInstruction, |
| 1350 | public NoTypePolicy::Data { |
| 1351 | MWasmStoreStackResult(MDefinition* stackResultArea, uint32_t offset, |
| 1352 | MDefinition* value) |
| 1353 | : MBinaryInstruction(classOpcode, stackResultArea, value), |
| 1354 | offset_(offset) {} |
| 1355 | |
| 1356 | uint32_t offset_; |
| 1357 | |
| 1358 | public: |
| 1359 | INSTRUCTION_HEADER(WasmStoreStackResult) |
| 1360 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1361 | NAMED_OPERANDS((0, stackResultArea), (1, value))static constexpr size_t stackResultAreaOperand = 0; MDefinition * stackResultArea() const { return getOperand(0); } static constexpr size_t valueOperand = 1; MDefinition* value() const { return getOperand(1); } |
| 1362 | |
| 1363 | uint32_t offset() const { return offset_; } |
| 1364 | |
| 1365 | AliasSet getAliasSet() const override { |
| 1366 | return AliasSet::Store(AliasSet::WasmStackResult); |
| 1367 | } |
| 1368 | }; |
| 1369 | |
| 1370 | // Represents a known-good derived pointer into an object or memory region (in |
| 1371 | // the most general sense) that will not move while the derived pointer is live. |
| 1372 | // The `offset` *must* be a valid offset into the object represented by `base`; |
| 1373 | // hence overflow in the address calculation will never be an issue. `offset` |
| 1374 | // must be representable as a 31-bit unsigned integer. |
| 1375 | // |
| 1376 | // DO NOT use this with a base value of any JS-heap-resident object type. |
| 1377 | // Such a value would need to be adjusted during GC, yet we have no mechanism |
| 1378 | // to do that. See bug 1810090. |
| 1379 | |
| 1380 | class MWasmDerivedPointer : public MUnaryInstruction, |
| 1381 | public NoTypePolicy::Data { |
| 1382 | MWasmDerivedPointer(MDefinition* base, size_t offset) |
| 1383 | : MUnaryInstruction(classOpcode, base), offset_(uint32_t(offset)) { |
| 1384 | MOZ_ASSERT(offset <= INT32_MAX)do { static_assert( mozilla::detail::AssertionConditionType< decltype(offset <= (2147483647))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(offset <= (2147483647)))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("offset <= (2147483647)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1384); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "offset <= (2147483647)" ")"); do { MOZ_CrashSequence (__null, 1384); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1385 | // Do not change this to allow `base` to be a GC-heap allocated type. |
| 1386 | MOZ_ASSERT(base->type() == MIRType::Pointer ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == MIRType::Pointer || base->type () == TargetWordMIRType())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == MIRType:: Pointer || base->type() == TargetWordMIRType()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == MIRType::Pointer || base->type() == TargetWordMIRType()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1387); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::Pointer || base->type() == TargetWordMIRType()" ")"); do { MOZ_CrashSequence(__null, 1387); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 1387 | base->type() == TargetWordMIRType())do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == MIRType::Pointer || base->type () == TargetWordMIRType())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == MIRType:: Pointer || base->type() == TargetWordMIRType()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == MIRType::Pointer || base->type() == TargetWordMIRType()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1387); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::Pointer || base->type() == TargetWordMIRType()" ")"); do { MOZ_CrashSequence(__null, 1387); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1388 | setResultType(MIRType::Pointer); |
| 1389 | setMovable(); |
| 1390 | } |
| 1391 | |
| 1392 | uint32_t offset_; |
| 1393 | |
| 1394 | public: |
| 1395 | INSTRUCTION_HEADER(WasmDerivedPointer) |
| 1396 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1397 | NAMED_OPERANDS((0, base))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } |
| 1398 | |
| 1399 | uint32_t offset() const { return offset_; } |
| 1400 | |
| 1401 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1402 | |
| 1403 | HashNumber valueHash() const override { |
| 1404 | HashNumber hash = MUnaryInstruction::valueHash(); |
| 1405 | hash = addU32ToHash(hash, offset()); |
| 1406 | return hash; |
| 1407 | } |
| 1408 | bool congruentTo(const MDefinition* ins) const override { |
| 1409 | return congruentIfOperandsEqual(ins) && |
| 1410 | ins->toWasmDerivedPointer()->offset() == offset(); |
| 1411 | } |
| 1412 | |
| 1413 | #ifdef JS_JITSPEW1 |
| 1414 | void getExtras(ExtrasCollector* extras) const override { |
| 1415 | char buf[64]; |
| 1416 | SprintfLiteral(buf, "(offs=%lld)", (long long int)offset_); |
| 1417 | extras->add(buf); |
| 1418 | } |
| 1419 | #endif |
| 1420 | |
| 1421 | ALLOW_CLONE(MWasmDerivedPointer)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1421); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1421); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmDerivedPointer(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 1422 | }; |
| 1423 | |
| 1424 | // As with MWasmDerivedPointer, DO NOT use this with a base value of any |
| 1425 | // JS-heap-resident object type. |
| 1426 | class MWasmDerivedIndexPointer : public MBinaryInstruction, |
| 1427 | public NoTypePolicy::Data { |
| 1428 | MWasmDerivedIndexPointer(MDefinition* base, MDefinition* index, Scale scale) |
| 1429 | : MBinaryInstruction(classOpcode, base, index), scale_(scale) { |
| 1430 | // Do not change this to allow `base` to be a GC-heap allocated type. |
| 1431 | MOZ_ASSERT(base->type() == MIRType::Pointer)do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == MIRType::Pointer)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == MIRType:: Pointer))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("base->type() == MIRType::Pointer", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 1431); AnnotateMozCrashReason("MOZ_ASSERT" "(" "base->type() == MIRType::Pointer" ")"); do { MOZ_CrashSequence(__null, 1431); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1432 | setResultType(MIRType::Pointer); |
| 1433 | setMovable(); |
| 1434 | } |
| 1435 | |
| 1436 | Scale scale_; |
| 1437 | |
| 1438 | public: |
| 1439 | INSTRUCTION_HEADER(WasmDerivedIndexPointer) |
| 1440 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1441 | NAMED_OPERANDS((0, base))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } |
| 1442 | NAMED_OPERANDS((1, index))static constexpr size_t indexOperand = 1; MDefinition* index( ) const { return getOperand(1); } |
| 1443 | |
| 1444 | Scale scale() const { return scale_; } |
| 1445 | |
| 1446 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1447 | |
| 1448 | bool congruentTo(const MDefinition* ins) const override { |
| 1449 | return congruentIfOperandsEqual(ins) && |
| 1450 | ins->toWasmDerivedIndexPointer()->scale() == scale(); |
| 1451 | } |
| 1452 | |
| 1453 | ALLOW_CLONE(MWasmDerivedIndexPointer)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1453); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1453); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmDerivedIndexPointer(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 1454 | }; |
| 1455 | |
| 1456 | // Whether to perform a pre-write barrier for a wasm store reference. |
| 1457 | enum class WasmPreBarrierKind : uint8_t { None, Normal }; |
| 1458 | |
| 1459 | // Whether to perform a post-write barrier for a wasm store reference. |
| 1460 | enum class WasmPostBarrierKind : uint8_t { None, Edge, WholeCell }; |
| 1461 | |
| 1462 | // Stores a reference to an address. This performs a pre-barrier on the address, |
| 1463 | // but not a post-barrier. A post-barrier must be performed separately, if it's |
| 1464 | // required. The accessed location is `valueBase + valueOffset`. The latter |
| 1465 | // must be be representable as a 31-bit unsigned integer. |
| 1466 | |
| 1467 | class MWasmStoreRef : public MAryInstruction<3>, public NoTypePolicy::Data { |
| 1468 | uint32_t offset_; |
| 1469 | AliasSet::Flag aliasSet_; |
| 1470 | WasmPreBarrierKind preBarrierKind_; |
| 1471 | |
| 1472 | MWasmStoreRef(MDefinition* instance, MDefinition* valueBase, |
| 1473 | size_t valueOffset, MDefinition* value, AliasSet::Flag aliasSet, |
| 1474 | WasmPreBarrierKind preBarrierKind) |
| 1475 | : MAryInstruction<3>(classOpcode), |
| 1476 | offset_(uint32_t(valueOffset)), |
| 1477 | aliasSet_(aliasSet), |
| 1478 | preBarrierKind_(preBarrierKind) { |
| 1479 | MOZ_ASSERT(valueOffset <= INT32_MAX)do { static_assert( mozilla::detail::AssertionConditionType< decltype(valueOffset <= (2147483647))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(valueOffset <= (2147483647 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("valueOffset <= (2147483647)", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 1479); AnnotateMozCrashReason("MOZ_ASSERT" "(" "valueOffset <= (2147483647)" ")"); do { MOZ_CrashSequence(__null, 1479); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1480 | MOZ_ASSERT(valueBase->type() == MIRType::Pointer ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(valueBase->type() == MIRType::Pointer || valueBase ->type() == MIRType::StackResults)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(valueBase->type() == MIRType ::Pointer || valueBase->type() == MIRType::StackResults))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("valueBase->type() == MIRType::Pointer || valueBase->type() == MIRType::StackResults" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1481); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "valueBase->type() == MIRType::Pointer || valueBase->type() == MIRType::StackResults" ")"); do { MOZ_CrashSequence(__null, 1481); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 1481 | valueBase->type() == MIRType::StackResults)do { static_assert( mozilla::detail::AssertionConditionType< decltype(valueBase->type() == MIRType::Pointer || valueBase ->type() == MIRType::StackResults)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(valueBase->type() == MIRType ::Pointer || valueBase->type() == MIRType::StackResults))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("valueBase->type() == MIRType::Pointer || valueBase->type() == MIRType::StackResults" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1481); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "valueBase->type() == MIRType::Pointer || valueBase->type() == MIRType::StackResults" ")"); do { MOZ_CrashSequence(__null, 1481); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1482 | MOZ_ASSERT(value->type() == MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(value->type() == MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(value->type() == MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("value->type() == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1482); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1482); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1483 | initOperand(0, instance); |
| 1484 | initOperand(1, valueBase); |
| 1485 | initOperand(2, value); |
| 1486 | } |
| 1487 | |
| 1488 | public: |
| 1489 | INSTRUCTION_HEADER(WasmStoreRef) |
| 1490 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1491 | NAMED_OPERANDS((0, instance), (1, valueBase), (2, value))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } static constexpr size_t valueBaseOperand = 1; MDefinition* valueBase() const { return getOperand(1); } static constexpr size_t valueOperand = 2; MDefinition* value () const { return getOperand(2); } |
| 1492 | |
| 1493 | uint32_t offset() const { return offset_; } |
| 1494 | AliasSet getAliasSet() const override { return AliasSet::Store(aliasSet_); } |
| 1495 | WasmPreBarrierKind preBarrierKind() const { return preBarrierKind_; } |
| 1496 | |
| 1497 | #ifdef JS_JITSPEW1 |
| 1498 | void getExtras(ExtrasCollector* extras) const override { |
| 1499 | char buf[64]; |
| 1500 | SprintfLiteral(buf, "(offs=%lld)", (long long int)offset_); |
| 1501 | extras->add(buf); |
| 1502 | } |
| 1503 | #endif |
| 1504 | }; |
| 1505 | |
| 1506 | // Given a value being written to another object, update the generational store |
| 1507 | // buffer if the value is in the nursery and object is in the tenured heap. |
| 1508 | class MWasmPostWriteBarrierWholeCell : public MTernaryInstruction, |
| 1509 | public NoTypePolicy::Data { |
| 1510 | MWasmPostWriteBarrierWholeCell(MDefinition* instance, MDefinition* object, |
| 1511 | MDefinition* value) |
| 1512 | : MTernaryInstruction(classOpcode, instance, object, value) { |
| 1513 | MOZ_ASSERT(object->type() == MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(object->type() == MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(object->type() == MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("object->type() == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1513); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "object->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1513); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1514 | MOZ_ASSERT(value->type() == MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(value->type() == MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(value->type() == MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("value->type() == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1514); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1514); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1515 | setGuard(); |
| 1516 | } |
| 1517 | |
| 1518 | public: |
| 1519 | INSTRUCTION_HEADER(WasmPostWriteBarrierWholeCell) |
| 1520 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1521 | NAMED_OPERANDS((0, instance), (1, object), (2, value))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } static constexpr size_t objectOperand = 1; MDefinition* object() const { return getOperand(1); } static constexpr size_t valueOperand = 2; MDefinition* value() const { return getOperand(2); } |
| 1522 | |
| 1523 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1524 | |
| 1525 | ALLOW_CLONE(MWasmPostWriteBarrierWholeCell)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1525); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1525); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmPostWriteBarrierWholeCell(*this); if (!res ) { return nullptr; } for (size_t i = 0; i < numOperands() ; i++) { res->replaceOperand(i, inputs[i]); } return res; } |
| 1526 | }; |
| 1527 | |
| 1528 | // Given a value being written to another object, update the generational store |
| 1529 | // buffer if the value is in the nursery and object is in the tenured heap. |
| 1530 | class MWasmPostWriteBarrierEdgeAtIndex : public MAryInstruction<5>, |
| 1531 | public NoTypePolicy::Data { |
| 1532 | uint32_t elemSize_; |
| 1533 | |
| 1534 | MWasmPostWriteBarrierEdgeAtIndex(MDefinition* instance, MDefinition* object, |
| 1535 | MDefinition* valueBase, MDefinition* index, |
| 1536 | uint32_t scale, MDefinition* value) |
| 1537 | : MAryInstruction<5>(classOpcode), elemSize_(scale) { |
| 1538 | MOZ_ASSERT(object->type() == MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(object->type() == MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(object->type() == MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("object->type() == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1538); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "object->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1538); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1539 | MOZ_ASSERT(value->type() == MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(value->type() == MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(value->type() == MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("value->type() == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1539); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1539); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1540 | initOperand(0, instance); |
| 1541 | initOperand(1, object); |
| 1542 | initOperand(2, valueBase); |
| 1543 | initOperand(3, index); |
| 1544 | initOperand(4, value); |
| 1545 | setGuard(); |
| 1546 | } |
| 1547 | |
| 1548 | public: |
| 1549 | INSTRUCTION_HEADER(WasmPostWriteBarrierEdgeAtIndex) |
| 1550 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1551 | NAMED_OPERANDS((0, instance), (1, object), (2, valueBase), (3, index),static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } static constexpr size_t objectOperand = 1; MDefinition* object() const { return getOperand(1); } static constexpr size_t valueBaseOperand = 2; MDefinition* valueBase () const { return getOperand(2); } static constexpr size_t indexOperand = 3; MDefinition* index() const { return getOperand(3); } static constexpr size_t valueOperand = 4; MDefinition* value() const { return getOperand(4); } |
| 1552 | (4, value))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } static constexpr size_t objectOperand = 1; MDefinition* object() const { return getOperand(1); } static constexpr size_t valueBaseOperand = 2; MDefinition* valueBase () const { return getOperand(2); } static constexpr size_t indexOperand = 3; MDefinition* index() const { return getOperand(3); } static constexpr size_t valueOperand = 4; MDefinition* value() const { return getOperand(4); } |
| 1553 | |
| 1554 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1555 | uint32_t elemSize() const { return elemSize_; } |
| 1556 | |
| 1557 | ALLOW_CLONE(MWasmPostWriteBarrierEdgeAtIndex)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1557); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1557); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmPostWriteBarrierEdgeAtIndex(*this); if (! res) { return nullptr; } for (size_t i = 0; i < numOperands (); i++) { res->replaceOperand(i, inputs[i]); } return res ; } |
| 1558 | }; |
| 1559 | |
| 1560 | class MWasmParameter : public MNullaryInstruction { |
| 1561 | ABIArg abi_; |
| 1562 | |
| 1563 | MWasmParameter(ABIArg abi, MIRType mirType, |
| 1564 | wasm::MaybeRefType refType = wasm::MaybeRefType()) |
| 1565 | : MNullaryInstruction(classOpcode), abi_(abi) { |
| 1566 | setResultType(mirType); |
| 1567 | setWasmRefType(refType); |
| 1568 | } |
| 1569 | |
| 1570 | public: |
| 1571 | INSTRUCTION_HEADER(WasmParameter) |
| 1572 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1573 | // MWasmParameter has no getAliasSet routine. Hence it acquires the default |
| 1574 | // aliases-everything setting. This doesn't matter in practice because these |
| 1575 | // nodes only appear at the start of the function's entry block, and in any |
| 1576 | // case they are not marked as movable. |
| 1577 | |
| 1578 | ABIArg abi() const { return abi_; } |
| 1579 | }; |
| 1580 | |
| 1581 | class MWasmReturn : public MAryControlInstruction<2, 0>, |
| 1582 | public NoTypePolicy::Data { |
| 1583 | MWasmReturn(MDefinition* ins, MDefinition* instance) |
| 1584 | : MAryControlInstruction(classOpcode) { |
| 1585 | initOperand(0, ins); |
| 1586 | initOperand(1, instance); |
| 1587 | } |
| 1588 | |
| 1589 | public: |
| 1590 | INSTRUCTION_HEADER(WasmReturn) |
| 1591 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1592 | |
| 1593 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1594 | }; |
| 1595 | |
| 1596 | class MWasmReturnVoid : public MAryControlInstruction<1, 0>, |
| 1597 | public NoTypePolicy::Data { |
| 1598 | explicit MWasmReturnVoid(MDefinition* instance) |
| 1599 | : MAryControlInstruction(classOpcode) { |
| 1600 | initOperand(0, instance); |
| 1601 | } |
| 1602 | |
| 1603 | public: |
| 1604 | INSTRUCTION_HEADER(WasmReturnVoid) |
| 1605 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1606 | |
| 1607 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1608 | }; |
| 1609 | |
| 1610 | class MWasmStackArg : public MUnaryInstruction, public NoTypePolicy::Data { |
| 1611 | MWasmStackArg(uint32_t spOffset, MDefinition* ins) |
| 1612 | : MUnaryInstruction(classOpcode, ins), spOffset_(spOffset) {} |
| 1613 | |
| 1614 | uint32_t spOffset_; |
| 1615 | |
| 1616 | public: |
| 1617 | INSTRUCTION_HEADER(WasmStackArg) |
| 1618 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1619 | NAMED_OPERANDS((0, arg))static constexpr size_t argOperand = 0; MDefinition* arg() const { return getOperand(0); } |
| 1620 | |
| 1621 | uint32_t spOffset() const { return spOffset_; } |
| 1622 | void incrementOffset(uint32_t inc) { spOffset_ += inc; } |
| 1623 | AliasSet getAliasSet() const override { |
| 1624 | return AliasSet::Store(AliasSet::Flag::Any); |
| 1625 | } |
| 1626 | |
| 1627 | ALLOW_CLONE(MWasmStackArg)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1627); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1627); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmStackArg(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 1628 | }; |
| 1629 | |
| 1630 | template <typename Location> |
| 1631 | class MWasmResultBase : public MNullaryInstruction { |
| 1632 | Location loc_; |
| 1633 | |
| 1634 | protected: |
| 1635 | MWasmResultBase(Opcode op, MIRType type, Location loc) |
| 1636 | : MNullaryInstruction(op), loc_(loc) { |
| 1637 | setResultType(type); |
| 1638 | setCallResultCapture(); |
| 1639 | } |
| 1640 | |
| 1641 | public: |
| 1642 | Location loc() { return loc_; } |
| 1643 | }; |
| 1644 | |
| 1645 | class MWasmRegisterResult : public MWasmResultBase<Register> { |
| 1646 | MWasmRegisterResult(MIRType type, Register reg, |
| 1647 | wasm::MaybeRefType maybeRefType = wasm::MaybeRefType()) |
| 1648 | : MWasmResultBase(classOpcode, type, reg) { |
| 1649 | setWasmRefType(maybeRefType); |
| 1650 | } |
| 1651 | |
| 1652 | public: |
| 1653 | INSTRUCTION_HEADER(WasmRegisterResult) |
| 1654 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1655 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1656 | }; |
| 1657 | |
| 1658 | class MWasmFloatRegisterResult : public MWasmResultBase<FloatRegister> { |
| 1659 | MWasmFloatRegisterResult(MIRType type, FloatRegister reg) |
| 1660 | : MWasmResultBase(classOpcode, type, reg) {} |
| 1661 | |
| 1662 | public: |
| 1663 | INSTRUCTION_HEADER(WasmFloatRegisterResult) |
| 1664 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1665 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1666 | }; |
| 1667 | |
| 1668 | class MWasmSystemFloatRegisterResult : public MWasmResultBase<FloatRegister> { |
| 1669 | MWasmSystemFloatRegisterResult(MIRType type, FloatRegister reg, bool hardFP) |
| 1670 | : MWasmResultBase(classOpcode, type, reg), hardFP_(hardFP) {} |
| 1671 | |
| 1672 | bool hardFP_; |
| 1673 | |
| 1674 | public: |
| 1675 | INSTRUCTION_HEADER(WasmSystemFloatRegisterResult) |
| 1676 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1677 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1678 | |
| 1679 | bool hardFP() const { return hardFP_; } |
| 1680 | }; |
| 1681 | |
| 1682 | class MWasmRegister64Result : public MWasmResultBase<Register64> { |
| 1683 | explicit MWasmRegister64Result(Register64 reg) |
| 1684 | : MWasmResultBase(classOpcode, MIRType::Int64, reg) {} |
| 1685 | |
| 1686 | public: |
| 1687 | INSTRUCTION_HEADER(WasmRegister64Result) |
| 1688 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1689 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1690 | }; |
| 1691 | |
| 1692 | class MWasmStackResultArea : public MNullaryInstruction { |
| 1693 | public: |
| 1694 | class StackResult { |
| 1695 | // Offset in bytes from lowest address of stack result area. |
| 1696 | uint32_t offset_ = 0; |
| 1697 | MIRType type_; |
| 1698 | |
| 1699 | public: |
| 1700 | StackResult() : type_(MIRType::Undefined) {} |
| 1701 | StackResult(uint32_t offset, MIRType type) : offset_(offset), type_(type) {} |
| 1702 | |
| 1703 | bool initialized() const { return type_ != MIRType::Undefined; } |
| 1704 | uint32_t offset() const { |
| 1705 | MOZ_ASSERT(initialized())do { static_assert( mozilla::detail::AssertionConditionType< decltype(initialized())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(initialized()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("initialized()", "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1705); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "initialized()" ")"); do { MOZ_CrashSequence (__null, 1705); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1706 | return offset_; |
| 1707 | } |
| 1708 | MIRType type() const { |
| 1709 | MOZ_ASSERT(initialized())do { static_assert( mozilla::detail::AssertionConditionType< decltype(initialized())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(initialized()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("initialized()", "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1709); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "initialized()" ")"); do { MOZ_CrashSequence (__null, 1709); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1710 | return type_; |
| 1711 | } |
| 1712 | uint32_t endOffset() const { |
| 1713 | return offset() + wasm::MIRTypeToABIResultSize(type()); |
| 1714 | } |
| 1715 | }; |
| 1716 | |
| 1717 | private: |
| 1718 | FixedList<StackResult> results_; |
| 1719 | uint32_t base_; |
| 1720 | |
| 1721 | explicit MWasmStackResultArea() |
| 1722 | : MNullaryInstruction(classOpcode), base_(UINT32_MAX(4294967295U)) { |
| 1723 | setResultType(MIRType::StackResults); |
| 1724 | } |
| 1725 | |
| 1726 | void assertInitialized() const { |
| 1727 | #ifdef DEBUG1 |
| 1728 | for (size_t i = 0; i < results_.length(); i++) { |
| 1729 | MOZ_ASSERT(results_[i].initialized())do { static_assert( mozilla::detail::AssertionConditionType< decltype(results_[i].initialized())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(results_[i].initialized()))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("results_[i].initialized()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1729); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "results_[i].initialized()" ")"); do { MOZ_CrashSequence (__null, 1729); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1730 | } |
| 1731 | #endif |
| 1732 | } |
| 1733 | |
| 1734 | bool baseInitialized() const { return base_ != UINT32_MAX(4294967295U); } |
| 1735 | |
| 1736 | public: |
| 1737 | INSTRUCTION_HEADER(WasmStackResultArea) |
| 1738 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1739 | |
| 1740 | [[nodiscard]] bool init(TempAllocator& alloc, size_t stackResultCount) { |
| 1741 | MOZ_ASSERT(results_.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(results_.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(results_.length() == 0))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("results_.length() == 0" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1741); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "results_.length() == 0" ")"); do { MOZ_CrashSequence (__null, 1741); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1742 | if (!results_.init(alloc, stackResultCount)) { |
| 1743 | return false; |
| 1744 | } |
| 1745 | for (size_t n = 0; n < stackResultCount; n++) { |
| 1746 | results_[n] = StackResult(); |
| 1747 | } |
| 1748 | return true; |
| 1749 | } |
| 1750 | |
| 1751 | size_t resultCount() const { return results_.length(); } |
| 1752 | const StackResult& result(size_t n) const { |
| 1753 | MOZ_ASSERT(results_[n].initialized())do { static_assert( mozilla::detail::AssertionConditionType< decltype(results_[n].initialized())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(results_[n].initialized()))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("results_[n].initialized()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1753); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "results_[n].initialized()" ")"); do { MOZ_CrashSequence (__null, 1753); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1754 | return results_[n]; |
| 1755 | } |
| 1756 | void initResult(size_t n, const StackResult& loc) { |
| 1757 | MOZ_ASSERT(!results_[n].initialized())do { static_assert( mozilla::detail::AssertionConditionType< decltype(!results_[n].initialized())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!results_[n].initialized())) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!results_[n].initialized()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1757); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!results_[n].initialized()" ")"); do { MOZ_CrashSequence (__null, 1757); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1758 | MOZ_ASSERT((n == 0) == (loc.offset() == 0))do { static_assert( mozilla::detail::AssertionConditionType< decltype((n == 0) == (loc.offset() == 0))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!((n == 0) == (loc.offset() == 0)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("(n == 0) == (loc.offset() == 0)", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 1758); AnnotateMozCrashReason("MOZ_ASSERT" "(" "(n == 0) == (loc.offset() == 0)" ")"); do { MOZ_CrashSequence(__null, 1758); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1759 | MOZ_ASSERT_IF(n > 0, loc.offset() >= result(n - 1).endOffset())do { if (n > 0) { do { static_assert( mozilla::detail::AssertionConditionType <decltype(loc.offset() >= result(n - 1).endOffset())> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(loc.offset() >= result(n - 1).endOffset()))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("loc.offset() >= result(n - 1).endOffset()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1759); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "loc.offset() >= result(n - 1).endOffset()" ")"); do { MOZ_CrashSequence(__null, 1759); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
| 1760 | results_[n] = loc; |
| 1761 | } |
| 1762 | |
| 1763 | uint32_t byteSize() const { |
| 1764 | assertInitialized(); |
| 1765 | if (resultCount() == 0) { |
| 1766 | return 0; |
| 1767 | } |
| 1768 | return result(resultCount() - 1).endOffset(); |
| 1769 | } |
| 1770 | |
| 1771 | // Stack index indicating base of stack area. |
| 1772 | uint32_t base() const { |
| 1773 | MOZ_ASSERT(baseInitialized())do { static_assert( mozilla::detail::AssertionConditionType< decltype(baseInitialized())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(baseInitialized()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("baseInitialized()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1773); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "baseInitialized()" ")"); do { MOZ_CrashSequence (__null, 1773); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1774 | return base_; |
| 1775 | } |
| 1776 | void setBase(uint32_t base) { |
| 1777 | MOZ_ASSERT(!baseInitialized())do { static_assert( mozilla::detail::AssertionConditionType< decltype(!baseInitialized())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!baseInitialized()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!baseInitialized()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1777); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!baseInitialized()" ")"); do { MOZ_CrashSequence (__null, 1777); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1778 | base_ = base; |
| 1779 | MOZ_ASSERT(baseInitialized())do { static_assert( mozilla::detail::AssertionConditionType< decltype(baseInitialized())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(baseInitialized()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("baseInitialized()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1779); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "baseInitialized()" ")"); do { MOZ_CrashSequence (__null, 1779); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1780 | } |
| 1781 | }; |
| 1782 | |
| 1783 | class MWasmStackResult : public MUnaryInstruction, public NoTypePolicy::Data { |
| 1784 | uint32_t resultIdx_; |
| 1785 | |
| 1786 | MWasmStackResult(MWasmStackResultArea* resultArea, size_t idx) |
| 1787 | : MUnaryInstruction(classOpcode, resultArea), resultIdx_(idx) { |
| 1788 | setResultType(result().type()); |
| 1789 | setCallResultCapture(); |
| 1790 | } |
| 1791 | |
| 1792 | public: |
| 1793 | INSTRUCTION_HEADER(WasmStackResult) |
| 1794 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 1795 | NAMED_OPERANDS((0, resultArea))static constexpr size_t resultAreaOperand = 0; MDefinition* resultArea () const { return getOperand(0); } |
| 1796 | |
| 1797 | const MWasmStackResultArea::StackResult& result() const { |
| 1798 | return resultArea()->toWasmStackResultArea()->result(resultIdx_); |
| 1799 | } |
| 1800 | }; |
| 1801 | |
| 1802 | // Mixin class for wasm calls that may or may not be catchable. |
| 1803 | class MWasmCallBase { |
| 1804 | public: |
| 1805 | struct Arg { |
| 1806 | AnyRegister reg; |
| 1807 | MDefinition* def; |
| 1808 | Arg(AnyRegister reg, MDefinition* def) : reg(reg), def(def) {} |
| 1809 | }; |
| 1810 | using Args = Vector<Arg, 8, SystemAllocPolicy>; |
| 1811 | |
| 1812 | protected: |
| 1813 | wasm::CallSiteDesc desc_; |
| 1814 | wasm::CalleeDesc callee_; |
| 1815 | wasm::FailureMode builtinMethodFailureMode_; |
| 1816 | wasm::Trap builtinMethodFailureTrap_; |
| 1817 | FixedList<AnyRegister> argRegs_; |
| 1818 | uint32_t stackArgAreaSizeUnaligned_; |
| 1819 | ABIArg instanceArg_; |
| 1820 | bool inTry_; |
| 1821 | size_t tryNoteIndex_; |
| 1822 | |
| 1823 | MWasmCallBase(const wasm::CallSiteDesc& desc, const wasm::CalleeDesc& callee, |
| 1824 | uint32_t stackArgAreaSizeUnaligned, bool inTry, |
| 1825 | size_t tryNoteIndex) |
| 1826 | : desc_(desc), |
| 1827 | callee_(callee), |
| 1828 | builtinMethodFailureMode_(wasm::FailureMode::Infallible), |
| 1829 | stackArgAreaSizeUnaligned_(stackArgAreaSizeUnaligned), |
| 1830 | inTry_(inTry), |
| 1831 | tryNoteIndex_(tryNoteIndex) {} |
| 1832 | |
| 1833 | template <class MVariadicT> |
| 1834 | [[nodiscard]] bool initWithArgs(TempAllocator& alloc, MVariadicT* ins, |
| 1835 | const Args& args, |
| 1836 | MDefinition* tableAddressOrRef) { |
| 1837 | if (!argRegs_.init(alloc, args.length())) { |
| 1838 | return false; |
| 1839 | } |
| 1840 | for (size_t i = 0; i < argRegs_.length(); i++) { |
| 1841 | argRegs_[i] = args[i].reg; |
| 1842 | } |
| 1843 | |
| 1844 | if (!ins->init(alloc, argRegs_.length() + (tableAddressOrRef ? 1 : 0))) { |
| 1845 | return false; |
| 1846 | } |
| 1847 | // FixedList doesn't initialize its elements, so do an unchecked init. |
| 1848 | for (size_t i = 0; i < argRegs_.length(); i++) { |
| 1849 | ins->initOperand(i, args[i].def); |
| 1850 | } |
| 1851 | if (tableAddressOrRef) { |
| 1852 | ins->initOperand(argRegs_.length(), tableAddressOrRef); |
| 1853 | } |
| 1854 | return true; |
| 1855 | } |
| 1856 | |
| 1857 | public: |
| 1858 | static bool IsWasmCall(MDefinition* def) { |
| 1859 | return def->isWasmCallCatchable() || def->isWasmCallUncatchable() || |
| 1860 | def->isWasmReturnCall(); |
| 1861 | } |
| 1862 | |
| 1863 | size_t numArgs() const { return argRegs_.length(); } |
| 1864 | AnyRegister registerForArg(size_t index) const { |
| 1865 | MOZ_ASSERT(index < numArgs())do { static_assert( mozilla::detail::AssertionConditionType< decltype(index < numArgs())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(index < numArgs()))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("index < numArgs()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1865); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "index < numArgs()" ")"); do { MOZ_CrashSequence (__null, 1865); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1866 | return argRegs_[index]; |
| 1867 | } |
| 1868 | const wasm::CallSiteDesc& desc() const { return desc_; } |
| 1869 | const wasm::CalleeDesc& callee() const { return callee_; } |
| 1870 | wasm::FailureMode builtinMethodFailureMode() const { |
| 1871 | MOZ_ASSERT(callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod)do { static_assert( mozilla::detail::AssertionConditionType< decltype(callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod )>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod", "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1871); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod" ")"); do { MOZ_CrashSequence(__null, 1871); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1872 | return builtinMethodFailureMode_; |
| 1873 | } |
| 1874 | wasm::Trap builtinMethodFailureTrap() const { |
| 1875 | MOZ_ASSERT(callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod)do { static_assert( mozilla::detail::AssertionConditionType< decltype(callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod )>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod", "/root/firefox-clang/js/src/jit/MIR-wasm.h", 1875); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod" ")"); do { MOZ_CrashSequence(__null, 1875); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1876 | return builtinMethodFailureTrap_; |
| 1877 | } |
| 1878 | uint32_t stackArgAreaSizeUnaligned() const { |
| 1879 | return stackArgAreaSizeUnaligned_; |
| 1880 | } |
| 1881 | |
| 1882 | const ABIArg& instanceArg() const { return instanceArg_; } |
| 1883 | |
| 1884 | bool inTry() const { return inTry_; } |
| 1885 | size_t tryNoteIndex() const { return tryNoteIndex_; } |
| 1886 | |
| 1887 | static AliasSet wasmCallAliasSet() { |
| 1888 | // This is ok because: |
| 1889 | // - numElements is immutable |
| 1890 | // - the GC will rewrite any array or struct data pointers on move |
| 1891 | AliasSet exclude = AliasSet(AliasSet::WasmArrayNumElements) | |
| 1892 | AliasSet(AliasSet::WasmArrayDataPointer) | |
| 1893 | AliasSet(AliasSet::WasmStructOutlineDataPointer); |
| 1894 | return AliasSet::Store(AliasSet::Any) & ~exclude; |
| 1895 | } |
| 1896 | }; |
| 1897 | |
| 1898 | // A wasm call that is catchable. This instruction is a control instruction, |
| 1899 | // and terminates the block it is on. A normal return will proceed in a the |
| 1900 | // fallthrough block. An exceptional return will unwind into the landing pad |
| 1901 | // block for this call. The landing pad block must begin with an |
| 1902 | // MWasmCallLandingPrePad. |
| 1903 | class MWasmCallCatchable final : public MVariadicControlInstruction<2>, |
| 1904 | public MWasmCallBase, |
| 1905 | public NoTypePolicy::Data { |
| 1906 | MWasmCallCatchable(const wasm::CallSiteDesc& desc, |
| 1907 | const wasm::CalleeDesc& callee, |
| 1908 | uint32_t stackArgAreaSizeUnaligned, size_t tryNoteIndex) |
| 1909 | : MVariadicControlInstruction(classOpcode), |
| 1910 | MWasmCallBase(desc, callee, stackArgAreaSizeUnaligned, true, |
| 1911 | tryNoteIndex) {} |
| 1912 | |
| 1913 | public: |
| 1914 | INSTRUCTION_HEADER(WasmCallCatchable) |
| 1915 | |
| 1916 | static MWasmCallCatchable* New( |
| 1917 | TempAllocator& alloc, const wasm::CallSiteDesc& desc, |
| 1918 | const wasm::CalleeDesc& callee, const Args& args, |
| 1919 | uint32_t stackArgAreaSizeUnaligned, uint32_t tryNoteIndex, |
| 1920 | MBasicBlock* fallthroughBlock, MBasicBlock* prePadBlock, |
| 1921 | MDefinition* tableAddressOrRef = nullptr); |
| 1922 | |
| 1923 | static MWasmCallCatchable* NewBuiltinInstanceMethodCall( |
| 1924 | TempAllocator& alloc, const wasm::CallSiteDesc& desc, |
| 1925 | const wasm::SymbolicAddress builtin, wasm::FailureMode failureMode, |
| 1926 | wasm::Trap failureTrap, const ABIArg& instanceArg, const Args& args, |
| 1927 | uint32_t stackArgAreaSizeUnaligned, uint32_t tryNoteIndex, |
| 1928 | MBasicBlock* fallthroughBlock, MBasicBlock* prePadBlock); |
| 1929 | |
| 1930 | bool possiblyCalls() const override { return true; } |
| 1931 | AliasSet getAliasSet() const override { return wasmCallAliasSet(); } |
| 1932 | |
| 1933 | static const size_t FallthroughBranchIndex = 0; |
| 1934 | static const size_t PrePadBranchIndex = 1; |
| 1935 | }; |
| 1936 | |
| 1937 | // A wasm call that is not catchable. This instruction is not a control |
| 1938 | // instruction, and therefore is not a block terminator. |
| 1939 | class MWasmCallUncatchable final : public MVariadicInstruction, |
| 1940 | public MWasmCallBase, |
| 1941 | public NoTypePolicy::Data { |
| 1942 | MWasmCallUncatchable(const wasm::CallSiteDesc& desc, |
| 1943 | const wasm::CalleeDesc& callee, |
| 1944 | uint32_t stackArgAreaSizeUnaligned) |
| 1945 | : MVariadicInstruction(classOpcode), |
| 1946 | MWasmCallBase(desc, callee, stackArgAreaSizeUnaligned, false, 0) {} |
| 1947 | |
| 1948 | public: |
| 1949 | INSTRUCTION_HEADER(WasmCallUncatchable) |
| 1950 | |
| 1951 | static MWasmCallUncatchable* New(TempAllocator& alloc, |
| 1952 | const wasm::CallSiteDesc& desc, |
| 1953 | const wasm::CalleeDesc& callee, |
| 1954 | const Args& args, |
| 1955 | uint32_t stackArgAreaSizeUnaligned, |
| 1956 | MDefinition* tableAddressOrRef = nullptr); |
| 1957 | |
| 1958 | static MWasmCallUncatchable* NewBuiltinInstanceMethodCall( |
| 1959 | TempAllocator& alloc, const wasm::CallSiteDesc& desc, |
| 1960 | const wasm::SymbolicAddress builtin, wasm::FailureMode failureMode, |
| 1961 | wasm::Trap failureTrap, const ABIArg& instanceArg, const Args& args, |
| 1962 | uint32_t stackArgAreaSizeUnaligned); |
| 1963 | |
| 1964 | bool possiblyCalls() const override { return true; } |
| 1965 | AliasSet getAliasSet() const override { return wasmCallAliasSet(); } |
| 1966 | }; |
| 1967 | |
| 1968 | class MWasmReturnCall final : public MVariadicControlInstruction<0>, |
| 1969 | public MWasmCallBase, |
| 1970 | public NoTypePolicy::Data { |
| 1971 | MWasmReturnCall(const wasm::CallSiteDesc& desc, |
| 1972 | const wasm::CalleeDesc& callee, |
| 1973 | uint32_t stackArgAreaSizeUnaligned) |
| 1974 | : MVariadicControlInstruction(classOpcode), |
| 1975 | MWasmCallBase(desc, callee, stackArgAreaSizeUnaligned, false, 0) {} |
| 1976 | |
| 1977 | public: |
| 1978 | INSTRUCTION_HEADER(WasmReturnCall) |
| 1979 | |
| 1980 | static MWasmReturnCall* New(TempAllocator& alloc, |
| 1981 | const wasm::CallSiteDesc& desc, |
| 1982 | const wasm::CalleeDesc& callee, const Args& args, |
| 1983 | uint32_t stackArgAreaSizeUnaligned, |
| 1984 | MDefinition* tableAddressOrRef = nullptr); |
| 1985 | |
| 1986 | bool possiblyCalls() const override { return true; } |
| 1987 | }; |
| 1988 | |
| 1989 | // A marker instruction for a block which is the landing pad for a catchable |
| 1990 | // wasm call. This instruction does not emit any code, only filling in |
| 1991 | // metadata. This instruction must be the first instruction added to the |
| 1992 | // landing pad block. |
| 1993 | class MWasmCallLandingPrePad : public MNullaryInstruction { |
| 1994 | // The block of the call that may unwind to this landing pad. |
| 1995 | MBasicBlock* callBlock_; |
| 1996 | // The index of the try note to initialize a landing pad for. |
| 1997 | size_t tryNoteIndex_; |
| 1998 | |
| 1999 | explicit MWasmCallLandingPrePad(MBasicBlock* callBlock, size_t tryNoteIndex) |
| 2000 | : MNullaryInstruction(classOpcode), |
| 2001 | callBlock_(callBlock), |
| 2002 | tryNoteIndex_(tryNoteIndex) { |
| 2003 | setGuard(); |
| 2004 | } |
| 2005 | |
| 2006 | public: |
| 2007 | INSTRUCTION_HEADER(WasmCallLandingPrePad) |
| 2008 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2009 | |
| 2010 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2011 | |
| 2012 | size_t tryNoteIndex() { return tryNoteIndex_; } |
| 2013 | MBasicBlock* callBlock() { return callBlock_; } |
| 2014 | }; |
| 2015 | |
| 2016 | #ifdef ENABLE_WASM_JSPI1 |
| 2017 | |
| 2018 | class MWasmResume final : public MControlInstruction, |
| 2019 | public NoTypePolicy::Data { |
| 2020 | private: |
| 2021 | static constexpr size_t InstanceIndex = 0; |
| 2022 | static constexpr size_t ContIndex = 1; |
| 2023 | static constexpr size_t HandlersParamsAreaIndex = 2; |
| 2024 | static constexpr size_t ContResultsAreaIndex = 3; |
| 2025 | static constexpr size_t MaxArity = 4; |
| 2026 | |
| 2027 | static constexpr size_t FallthroughBranchIndex = 0; |
| 2028 | |
| 2029 | mozilla::Vector<MBasicBlock*, 3, JitAllocPolicy> successors_; |
| 2030 | mozilla::Array<MUse, MaxArity> operands_; |
| 2031 | mozilla::Vector<wasm::HandlerJitOffsets, 1, JitAllocPolicy> handlers_; |
| 2032 | wasm::CallSiteDesc callSiteDesc_; |
| 2033 | mozilla::Maybe<uint32_t> tryNoteIndex_; |
| 2034 | |
| 2035 | // handlersParamsArea and contResultsArea are always present (empty areas when |
| 2036 | // the resume has no handlers / the cont has no results) so the operand set is |
| 2037 | // fixed. |
| 2038 | MWasmResume(TempAllocator& alloc, const wasm::CallSiteDesc& callSiteDesc, |
| 2039 | mozilla::Maybe<uint32_t> tryNoteIndex, MDefinition* instance, |
| 2040 | MDefinition* cont, MWasmStackResultArea* handlersParamsArea, |
| 2041 | MWasmStackResultArea* contResultsArea) |
| 2042 | : MControlInstruction(classOpcode), |
| 2043 | successors_(alloc), |
| 2044 | handlers_(alloc), |
| 2045 | callSiteDesc_(callSiteDesc), |
| 2046 | tryNoteIndex_(tryNoteIndex) { |
| 2047 | MOZ_ASSERT(instance && cont && handlersParamsArea && contResultsArea)do { static_assert( mozilla::detail::AssertionConditionType< decltype(instance && cont && handlersParamsArea && contResultsArea)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(instance && cont && handlersParamsArea && contResultsArea))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("instance && cont && handlersParamsArea && contResultsArea" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2047); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "instance && cont && handlersParamsArea && contResultsArea" ")"); do { MOZ_CrashSequence(__null, 2047); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2048 | initOperand(InstanceIndex, instance); |
| 2049 | initOperand(ContIndex, cont); |
| 2050 | initOperand(HandlersParamsAreaIndex, handlersParamsArea); |
| 2051 | initOperand(ContResultsAreaIndex, contResultsArea); |
| 2052 | } |
| 2053 | |
| 2054 | size_t prePadBranchIndex() const { |
| 2055 | MOZ_ASSERT(hasTryNote())do { static_assert( mozilla::detail::AssertionConditionType< decltype(hasTryNote())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(hasTryNote()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("hasTryNote()", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 2055); AnnotateMozCrashReason("MOZ_ASSERT" "(" "hasTryNote()" ")"); do { MOZ_CrashSequence(__null, 2055); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2056 | return FallthroughBranchIndex + 1; |
| 2057 | } |
| 2058 | size_t handlerBranchIndex(size_t handlerIndex) const { |
| 2059 | size_t previousIndex = |
| 2060 | hasTryNote() ? prePadBranchIndex() : FallthroughBranchIndex; |
| 2061 | size_t baseIndex = previousIndex + 1; |
| 2062 | return baseIndex + handlerIndex; |
| 2063 | } |
| 2064 | |
| 2065 | protected: |
| 2066 | MUse* getUseFor(size_t index) final { return &operands_[index]; } |
| 2067 | const MUse* getUseFor(size_t index) const final { return &operands_[index]; } |
| 2068 | void initOperand(size_t index, MDefinition* operand) { |
| 2069 | operands_[index].init(operand, this); |
| 2070 | } |
| 2071 | |
| 2072 | public: |
| 2073 | INSTRUCTION_HEADER(WasmResume) |
| 2074 | |
| 2075 | static MWasmResume* New(TempAllocator& alloc, |
| 2076 | const wasm::CallSiteDesc& callSiteDesc, |
| 2077 | mozilla::Maybe<uint32_t> tryNoteIndex, |
| 2078 | MDefinition* instance, MDefinition* cont, |
| 2079 | MWasmStackResultArea* handlersParamsArea, |
| 2080 | MWasmStackResultArea* contResultsArea) { |
| 2081 | return new (alloc) MWasmResume(alloc, callSiteDesc, tryNoteIndex, instance, |
| 2082 | cont, handlersParamsArea, contResultsArea); |
| 2083 | } |
| 2084 | |
| 2085 | [[nodiscard]] bool init(MBasicBlock* fallthroughBlock, |
| 2086 | MBasicBlock* prePadBlock, size_t numHandlers); |
| 2087 | [[nodiscard]] bool initHandler(size_t index, uint32_t tagInstanceDataOffset, |
| 2088 | uint32_t resultsAreaOffset, |
| 2089 | MBasicBlock* target); |
| 2090 | |
| 2091 | size_t numHandlers() const { return handlers_.length(); } |
| 2092 | mozilla::Span<wasm::HandlerJitOffsets> handlers() { return handlers_; } |
| 2093 | const wasm::HandlerJitOffsets& handler(size_t index) const { |
| 2094 | return handlers_[index]; |
| 2095 | } |
| 2096 | const wasm::CallSiteDesc& callSiteDesc() const { return callSiteDesc_; } |
| 2097 | bool hasTryNote() const { return tryNoteIndex_.isSome(); } |
| 2098 | mozilla::Maybe<uint32_t> tryNoteIndex() const { return tryNoteIndex_; } |
| 2099 | MBasicBlock* handlerBlock(size_t index) const { |
| 2100 | return getSuccessor(handlerBranchIndex(index)); |
| 2101 | } |
| 2102 | MBasicBlock* prePadBlock() const { return getSuccessor(prePadBranchIndex()); } |
| 2103 | MBasicBlock* fallthroughBlock() const { |
| 2104 | return getSuccessor(FallthroughBranchIndex); |
| 2105 | } |
| 2106 | |
| 2107 | MDefinition* instance() const { return getOperand(InstanceIndex); } |
| 2108 | MDefinition* cont() const { return getOperand(ContIndex); } |
| 2109 | MWasmStackResultArea* handlersParamsArea() const { |
| 2110 | return getOperand(HandlersParamsAreaIndex)->toWasmStackResultArea(); |
| 2111 | } |
| 2112 | MWasmStackResultArea* contResultsArea() const { |
| 2113 | return getOperand(ContResultsAreaIndex)->toWasmStackResultArea(); |
| 2114 | } |
| 2115 | |
| 2116 | bool possiblyCalls() const final { return true; } |
| 2117 | AliasSet getAliasSet() const final { |
| 2118 | return MWasmCallBase::wasmCallAliasSet(); |
| 2119 | } |
| 2120 | |
| 2121 | size_t numSuccessors() const final { return successors_.length(); } |
| 2122 | MBasicBlock* getSuccessor(size_t i) const final { return successors_[i]; } |
| 2123 | void replaceSuccessor(size_t i, MBasicBlock* successor) final { |
| 2124 | successors_[i] = successor; |
| 2125 | } |
| 2126 | |
| 2127 | MDefinition* getOperand(size_t index) const final { |
| 2128 | return operands_[index].producer(); |
| 2129 | } |
| 2130 | size_t numOperands() const final { return MaxArity; } |
| 2131 | size_t indexOf(const MUse* u) const final { |
| 2132 | MOZ_ASSERT(u >= &operands_[0])do { static_assert( mozilla::detail::AssertionConditionType< decltype(u >= &operands_[0])>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(u >= &operands_[0]))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("u >= &operands_[0]" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2132); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "u >= &operands_[0]" ")"); do { MOZ_CrashSequence (__null, 2132); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2133 | MOZ_ASSERT(u <= &operands_[numOperands() - 1])do { static_assert( mozilla::detail::AssertionConditionType< decltype(u <= &operands_[numOperands() - 1])>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(u <= &operands_[numOperands() - 1]))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("u <= &operands_[numOperands() - 1]" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2133); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "u <= &operands_[numOperands() - 1]" ")"); do { MOZ_CrashSequence(__null, 2133); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2134 | return u - &operands_[0]; |
| 2135 | } |
| 2136 | void replaceOperand(size_t index, MDefinition* operand) final { |
| 2137 | operands_[index].replaceProducer(operand); |
| 2138 | } |
| 2139 | }; |
| 2140 | |
| 2141 | #endif // ENABLE_WASM_JSPI |
| 2142 | |
| 2143 | class MWasmSelect : public MTernaryInstruction, public NoTypePolicy::Data { |
| 2144 | MWasmSelect(MDefinition* trueExpr, MDefinition* falseExpr, |
| 2145 | MDefinition* condExpr) |
| 2146 | : MTernaryInstruction(classOpcode, trueExpr, falseExpr, condExpr) { |
| 2147 | MOZ_ASSERT(condExpr->type() == MIRType::Int32)do { static_assert( mozilla::detail::AssertionConditionType< decltype(condExpr->type() == MIRType::Int32)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(! !(condExpr->type() == MIRType::Int32))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("condExpr->type() == MIRType::Int32" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2147); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "condExpr->type() == MIRType::Int32" ")" ); do { MOZ_CrashSequence(__null, 2147); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2148 | MOZ_ASSERT(trueExpr->type() == falseExpr->type())do { static_assert( mozilla::detail::AssertionConditionType< decltype(trueExpr->type() == falseExpr->type())>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(trueExpr->type() == falseExpr->type()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("trueExpr->type() == falseExpr->type()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2148); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "trueExpr->type() == falseExpr->type()" ")"); do { MOZ_CrashSequence(__null, 2148); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2149 | setResultType(trueExpr->type()); |
| 2150 | setMovable(); |
| 2151 | } |
| 2152 | |
| 2153 | public: |
| 2154 | INSTRUCTION_HEADER(WasmSelect) |
| 2155 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2156 | NAMED_OPERANDS((0, trueExpr), (1, falseExpr), (2, condExpr))static constexpr size_t trueExprOperand = 0; MDefinition* trueExpr () const { return getOperand(0); } static constexpr size_t falseExprOperand = 1; MDefinition* falseExpr() const { return getOperand(1); } static constexpr size_t condExprOperand = 2; MDefinition* condExpr () const { return getOperand(2); } |
| 2157 | |
| 2158 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2159 | |
| 2160 | bool congruentTo(const MDefinition* ins) const override { |
| 2161 | return congruentIfOperandsEqual(ins); |
| 2162 | } |
| 2163 | |
| 2164 | wasm::MaybeRefType computeWasmRefType() const override { |
| 2165 | return wasm::MaybeRefType::leastUpperBound(trueExpr()->wasmRefType(), |
| 2166 | falseExpr()->wasmRefType()); |
| 2167 | } |
| 2168 | |
| 2169 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2170 | |
| 2171 | ALLOW_CLONE(MWasmSelect)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2171); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2171); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmSelect(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 2172 | }; |
| 2173 | |
| 2174 | // Wasm SIMD. |
| 2175 | // |
| 2176 | // See comment in WasmIonCompile.cpp for a justification for these nodes. |
| 2177 | |
| 2178 | // (v128, v128, v128) -> v128 effect-free operation. |
| 2179 | class MWasmTernarySimd128 : public MTernaryInstruction, |
| 2180 | public NoTypePolicy::Data { |
| 2181 | wasm::SimdOp simdOp_; |
| 2182 | |
| 2183 | MWasmTernarySimd128(MDefinition* v0, MDefinition* v1, MDefinition* v2, |
| 2184 | wasm::SimdOp simdOp) |
| 2185 | : MTernaryInstruction(classOpcode, v0, v1, v2), simdOp_(simdOp) { |
| 2186 | setMovable(); |
| 2187 | setResultType(MIRType::Simd128); |
| 2188 | } |
| 2189 | |
| 2190 | public: |
| 2191 | INSTRUCTION_HEADER(WasmTernarySimd128) |
| 2192 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2193 | NAMED_OPERANDS((0, v0), (1, v1), (2, v2))static constexpr size_t v0Operand = 0; MDefinition* v0() const { return getOperand(0); } static constexpr size_t v1Operand = 1; MDefinition* v1() const { return getOperand(1); } static constexpr size_t v2Operand = 2; MDefinition* v2() const { return getOperand (2); } |
| 2194 | |
| 2195 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2196 | bool congruentTo(const MDefinition* ins) const override { |
| 2197 | return congruentIfOperandsEqual(ins) && |
| 2198 | simdOp() == ins->toWasmTernarySimd128()->simdOp(); |
| 2199 | } |
| 2200 | #ifdef ENABLE_WASM_SIMD1 |
| 2201 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2202 | |
| 2203 | // If the control mask of a bitselect allows the operation to be specialized |
| 2204 | // as a shuffle and it is profitable to specialize it on this platform, return |
| 2205 | // true and the appropriate shuffle mask. |
| 2206 | bool specializeBitselectConstantMaskAsShuffle(int8_t shuffle[16]); |
| 2207 | // Checks if more relaxed version of lane select can be used. It returns true |
| 2208 | // if a bit mask input expected to be all 0s or 1s for entire 8-bit lanes, |
| 2209 | // false otherwise. |
| 2210 | bool canRelaxBitselect(); |
| 2211 | #endif |
| 2212 | |
| 2213 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2214 | |
| 2215 | ALLOW_CLONE(MWasmTernarySimd128)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2215); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2215); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmTernarySimd128(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 2216 | }; |
| 2217 | |
| 2218 | // (v128, v128) -> v128 effect-free operations. |
| 2219 | class MWasmBinarySimd128 : public MBinaryInstruction, |
| 2220 | public NoTypePolicy::Data { |
| 2221 | wasm::SimdOp simdOp_; |
| 2222 | |
| 2223 | MWasmBinarySimd128(MDefinition* lhs, MDefinition* rhs, bool commutative, |
| 2224 | wasm::SimdOp simdOp) |
| 2225 | : MBinaryInstruction(classOpcode, lhs, rhs), simdOp_(simdOp) { |
| 2226 | setMovable(); |
| 2227 | setResultType(MIRType::Simd128); |
| 2228 | if (commutative) { |
| 2229 | setCommutative(); |
| 2230 | } |
| 2231 | } |
| 2232 | |
| 2233 | public: |
| 2234 | INSTRUCTION_HEADER(WasmBinarySimd128) |
| 2235 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2236 | |
| 2237 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2238 | bool congruentTo(const MDefinition* ins) const override { |
| 2239 | return congruentIfOperandsEqual(ins) && |
| 2240 | ins->toWasmBinarySimd128()->simdOp() == simdOp_; |
| 2241 | } |
| 2242 | #ifdef ENABLE_WASM_SIMD1 |
| 2243 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2244 | |
| 2245 | // Checks if pmaddubsw operation is supported. |
| 2246 | bool canPmaddubsw(); |
| 2247 | #endif |
| 2248 | |
| 2249 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2250 | |
| 2251 | // Platform-dependent specialization. |
| 2252 | bool specializeForConstantRhs(); |
| 2253 | |
| 2254 | ALLOW_CLONE(MWasmBinarySimd128)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2254); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2254); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmBinarySimd128(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 2255 | }; |
| 2256 | |
| 2257 | // (v128, const) -> v128 effect-free operations. |
| 2258 | class MWasmBinarySimd128WithConstant : public MUnaryInstruction, |
| 2259 | public NoTypePolicy::Data { |
| 2260 | SimdConstant rhs_; |
| 2261 | wasm::SimdOp simdOp_; |
| 2262 | |
| 2263 | MWasmBinarySimd128WithConstant(MDefinition* lhs, const SimdConstant& rhs, |
| 2264 | wasm::SimdOp simdOp) |
| 2265 | : MUnaryInstruction(classOpcode, lhs), rhs_(rhs), simdOp_(simdOp) { |
| 2266 | setMovable(); |
| 2267 | setResultType(MIRType::Simd128); |
| 2268 | } |
| 2269 | |
| 2270 | public: |
| 2271 | INSTRUCTION_HEADER(WasmBinarySimd128WithConstant) |
| 2272 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2273 | |
| 2274 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2275 | bool congruentTo(const MDefinition* ins) const override { |
| 2276 | return congruentIfOperandsEqual(ins) && |
| 2277 | ins->toWasmBinarySimd128WithConstant()->simdOp() == simdOp_ && |
| 2278 | rhs_.bitwiseEqual(ins->toWasmBinarySimd128WithConstant()->rhs()); |
| 2279 | } |
| 2280 | |
| 2281 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2282 | MDefinition* lhs() const { return input(); } |
| 2283 | const SimdConstant& rhs() const { return rhs_; } |
| 2284 | |
| 2285 | ALLOW_CLONE(MWasmBinarySimd128WithConstant)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2285); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2285); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmBinarySimd128WithConstant(*this); if (!res ) { return nullptr; } for (size_t i = 0; i < numOperands() ; i++) { res->replaceOperand(i, inputs[i]); } return res; } |
| 2286 | }; |
| 2287 | |
| 2288 | // (v128, scalar, imm) -> v128 effect-free operations. |
| 2289 | class MWasmReplaceLaneSimd128 : public MBinaryInstruction, |
| 2290 | public NoTypePolicy::Data { |
| 2291 | uint32_t laneIndex_; |
| 2292 | wasm::SimdOp simdOp_; |
| 2293 | |
| 2294 | MWasmReplaceLaneSimd128(MDefinition* lhs, MDefinition* rhs, |
| 2295 | uint32_t laneIndex, wasm::SimdOp simdOp) |
| 2296 | : MBinaryInstruction(classOpcode, lhs, rhs), |
| 2297 | laneIndex_(laneIndex), |
| 2298 | simdOp_(simdOp) { |
| 2299 | setMovable(); |
| 2300 | setResultType(MIRType::Simd128); |
| 2301 | } |
| 2302 | |
| 2303 | public: |
| 2304 | INSTRUCTION_HEADER(WasmReplaceLaneSimd128) |
| 2305 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2306 | |
| 2307 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2308 | bool congruentTo(const MDefinition* ins) const override { |
| 2309 | return congruentIfOperandsEqual(ins) && |
| 2310 | ins->toWasmReplaceLaneSimd128()->simdOp() == simdOp_ && |
| 2311 | ins->toWasmReplaceLaneSimd128()->laneIndex() == laneIndex_; |
| 2312 | } |
| 2313 | |
| 2314 | uint32_t laneIndex() const { return laneIndex_; } |
| 2315 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2316 | |
| 2317 | ALLOW_CLONE(MWasmReplaceLaneSimd128)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2317); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2317); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmReplaceLaneSimd128(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 2318 | }; |
| 2319 | |
| 2320 | // (scalar) -> v128 effect-free operations. |
| 2321 | class MWasmScalarToSimd128 : public MUnaryInstruction, |
| 2322 | public NoTypePolicy::Data { |
| 2323 | wasm::SimdOp simdOp_; |
| 2324 | |
| 2325 | MWasmScalarToSimd128(MDefinition* src, wasm::SimdOp simdOp) |
| 2326 | : MUnaryInstruction(classOpcode, src), simdOp_(simdOp) { |
| 2327 | setMovable(); |
| 2328 | setResultType(MIRType::Simd128); |
| 2329 | } |
| 2330 | |
| 2331 | public: |
| 2332 | INSTRUCTION_HEADER(WasmScalarToSimd128) |
| 2333 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2334 | |
| 2335 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2336 | bool congruentTo(const MDefinition* ins) const override { |
| 2337 | return congruentIfOperandsEqual(ins) && |
| 2338 | ins->toWasmScalarToSimd128()->simdOp() == simdOp_; |
| 2339 | } |
| 2340 | #ifdef ENABLE_WASM_SIMD1 |
| 2341 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2342 | #endif |
| 2343 | |
| 2344 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2345 | |
| 2346 | ALLOW_CLONE(MWasmScalarToSimd128)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2346); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2346); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmScalarToSimd128(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 2347 | }; |
| 2348 | |
| 2349 | // (v128, imm) -> scalar effect-free operations. |
| 2350 | class MWasmReduceSimd128 : public MUnaryInstruction, public NoTypePolicy::Data { |
| 2351 | wasm::SimdOp simdOp_; |
| 2352 | uint32_t imm_; |
| 2353 | |
| 2354 | MWasmReduceSimd128(MDefinition* src, wasm::SimdOp simdOp, MIRType outType, |
| 2355 | uint32_t imm) |
| 2356 | : MUnaryInstruction(classOpcode, src), simdOp_(simdOp), imm_(imm) { |
| 2357 | setMovable(); |
| 2358 | setResultType(outType); |
| 2359 | } |
| 2360 | |
| 2361 | public: |
| 2362 | INSTRUCTION_HEADER(WasmReduceSimd128) |
| 2363 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2364 | |
| 2365 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2366 | bool congruentTo(const MDefinition* ins) const override { |
| 2367 | return congruentIfOperandsEqual(ins) && |
| 2368 | ins->toWasmReduceSimd128()->simdOp() == simdOp_ && |
| 2369 | ins->toWasmReduceSimd128()->imm() == imm_; |
| 2370 | } |
| 2371 | #ifdef ENABLE_WASM_SIMD1 |
| 2372 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2373 | #endif |
| 2374 | |
| 2375 | uint32_t imm() const { return imm_; } |
| 2376 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2377 | |
| 2378 | ALLOW_CLONE(MWasmReduceSimd128)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2378); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2378); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmReduceSimd128(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 2379 | }; |
| 2380 | |
| 2381 | class MWasmLoadLaneSimd128 |
| 2382 | : public MVariadicInstruction, // memoryBase is nullptr on some platforms |
| 2383 | public NoTypePolicy::Data { |
| 2384 | wasm::MemoryAccessDesc access_; |
| 2385 | uint32_t laneSize_; |
| 2386 | uint32_t laneIndex_; |
| 2387 | uint32_t memoryBaseIndex_; |
| 2388 | |
| 2389 | MWasmLoadLaneSimd128(const wasm::MemoryAccessDesc& access, uint32_t laneSize, |
| 2390 | uint32_t laneIndex, uint32_t memoryBaseIndex) |
| 2391 | : MVariadicInstruction(classOpcode), |
| 2392 | access_(access), |
| 2393 | laneSize_(laneSize), |
| 2394 | laneIndex_(laneIndex), |
| 2395 | memoryBaseIndex_(memoryBaseIndex) { |
| 2396 | MOZ_ASSERT(!access_.isAtomic())do { static_assert( mozilla::detail::AssertionConditionType< decltype(!access_.isAtomic())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!access_.isAtomic()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!access_.isAtomic()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2396); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!access_.isAtomic()" ")"); do { MOZ_CrashSequence (__null, 2396); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2397 | setGuard(); |
| 2398 | setResultType(MIRType::Simd128); |
| 2399 | } |
| 2400 | |
| 2401 | public: |
| 2402 | INSTRUCTION_HEADER(WasmLoadLaneSimd128) |
| 2403 | NAMED_OPERANDS((0, base), (1, value))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t valueOperand = 1; MDefinition* value() const { return getOperand(1); }; |
| 2404 | |
| 2405 | static MWasmLoadLaneSimd128* New(TempAllocator& alloc, |
| 2406 | MDefinition* memoryBase, MDefinition* base, |
| 2407 | const wasm::MemoryAccessDesc& access, |
| 2408 | uint32_t laneSize, uint32_t laneIndex, |
| 2409 | MDefinition* value) { |
| 2410 | uint32_t nextIndex = 2; |
| 2411 | uint32_t memoryBaseIndex = memoryBase ? nextIndex++ : UINT32_MAX(4294967295U); |
| 2412 | |
| 2413 | MWasmLoadLaneSimd128* load = new (alloc) |
| 2414 | MWasmLoadLaneSimd128(access, laneSize, laneIndex, memoryBaseIndex); |
| 2415 | if (!load->init(alloc, nextIndex)) { |
| 2416 | return nullptr; |
| 2417 | } |
| 2418 | |
| 2419 | load->initOperand(0, base); |
| 2420 | load->initOperand(1, value); |
| 2421 | if (memoryBase) { |
| 2422 | load->initOperand(memoryBaseIndex, memoryBase); |
| 2423 | } |
| 2424 | |
| 2425 | return load; |
| 2426 | } |
| 2427 | |
| 2428 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 2429 | uint32_t laneSize() const { return laneSize_; } |
| 2430 | uint32_t laneIndex() const { return laneIndex_; } |
| 2431 | bool hasMemoryBase() const { return memoryBaseIndex_ != UINT32_MAX(4294967295U); } |
| 2432 | MDefinition* memoryBase() const { |
| 2433 | MOZ_ASSERT(hasMemoryBase())do { static_assert( mozilla::detail::AssertionConditionType< decltype(hasMemoryBase())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(hasMemoryBase()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("hasMemoryBase()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2433); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "hasMemoryBase()" ")"); do { MOZ_CrashSequence (__null, 2433); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2434 | return getOperand(memoryBaseIndex_); |
| 2435 | } |
| 2436 | |
| 2437 | AliasSet getAliasSet() const override { |
| 2438 | return AliasSet::Load(AliasSet::WasmHeap); |
| 2439 | } |
| 2440 | }; |
| 2441 | |
| 2442 | class MWasmStoreLaneSimd128 : public MVariadicInstruction, |
| 2443 | public NoTypePolicy::Data { |
| 2444 | wasm::MemoryAccessDesc access_; |
| 2445 | uint32_t laneSize_; |
| 2446 | uint32_t laneIndex_; |
| 2447 | uint32_t memoryBaseIndex_; |
| 2448 | |
| 2449 | explicit MWasmStoreLaneSimd128(const wasm::MemoryAccessDesc& access, |
| 2450 | uint32_t laneSize, uint32_t laneIndex, |
| 2451 | uint32_t memoryBaseIndex) |
| 2452 | : MVariadicInstruction(classOpcode), |
| 2453 | access_(access), |
| 2454 | laneSize_(laneSize), |
| 2455 | laneIndex_(laneIndex), |
| 2456 | memoryBaseIndex_(memoryBaseIndex) { |
| 2457 | MOZ_ASSERT(!access_.isAtomic())do { static_assert( mozilla::detail::AssertionConditionType< decltype(!access_.isAtomic())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!access_.isAtomic()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!access_.isAtomic()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2457); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!access_.isAtomic()" ")"); do { MOZ_CrashSequence (__null, 2457); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2458 | setGuard(); |
| 2459 | setResultType(MIRType::Simd128); |
| 2460 | } |
| 2461 | |
| 2462 | public: |
| 2463 | INSTRUCTION_HEADER(WasmStoreLaneSimd128) |
| 2464 | NAMED_OPERANDS((0, base), (1, value))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t valueOperand = 1; MDefinition* value() const { return getOperand(1); } |
| 2465 | |
| 2466 | static MWasmStoreLaneSimd128* New(TempAllocator& alloc, |
| 2467 | MDefinition* memoryBase, MDefinition* base, |
| 2468 | const wasm::MemoryAccessDesc& access, |
| 2469 | uint32_t laneSize, uint32_t laneIndex, |
| 2470 | MDefinition* value) { |
| 2471 | uint32_t nextIndex = 2; |
| 2472 | uint32_t memoryBaseIndex = memoryBase ? nextIndex++ : UINT32_MAX(4294967295U); |
| 2473 | |
| 2474 | MWasmStoreLaneSimd128* store = new (alloc) |
| 2475 | MWasmStoreLaneSimd128(access, laneSize, laneIndex, memoryBaseIndex); |
| 2476 | if (!store->init(alloc, nextIndex)) { |
| 2477 | return nullptr; |
| 2478 | } |
| 2479 | |
| 2480 | store->initOperand(0, base); |
| 2481 | store->initOperand(1, value); |
| 2482 | if (memoryBase) { |
| 2483 | store->initOperand(memoryBaseIndex, memoryBase); |
| 2484 | } |
| 2485 | |
| 2486 | return store; |
| 2487 | } |
| 2488 | |
| 2489 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 2490 | uint32_t laneSize() const { return laneSize_; } |
| 2491 | uint32_t laneIndex() const { return laneIndex_; } |
| 2492 | bool hasMemoryBase() const { return memoryBaseIndex_ != UINT32_MAX(4294967295U); } |
| 2493 | MDefinition* memoryBase() const { |
| 2494 | MOZ_ASSERT(hasMemoryBase())do { static_assert( mozilla::detail::AssertionConditionType< decltype(hasMemoryBase())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(hasMemoryBase()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("hasMemoryBase()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2494); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "hasMemoryBase()" ")"); do { MOZ_CrashSequence (__null, 2494); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2495 | return getOperand(memoryBaseIndex_); |
| 2496 | } |
| 2497 | |
| 2498 | AliasSet getAliasSet() const override { |
| 2499 | return AliasSet::Store(AliasSet::WasmHeap); |
| 2500 | } |
| 2501 | }; |
| 2502 | |
| 2503 | // End Wasm SIMD |
| 2504 | |
| 2505 | class MIonToWasmCall final : public MVariadicInstruction, |
| 2506 | public NoTypePolicy::Data { |
| 2507 | CompilerGCPointer<WasmInstanceObject*> instanceObj_; |
| 2508 | const wasm::FuncExport& funcExport_; |
| 2509 | |
| 2510 | MIonToWasmCall(WasmInstanceObject* instanceObj, MIRType resultType, |
| 2511 | const wasm::FuncExport& funcExport) |
| 2512 | : MVariadicInstruction(classOpcode), |
| 2513 | instanceObj_(instanceObj), |
| 2514 | funcExport_(funcExport) { |
| 2515 | setResultType(resultType); |
| 2516 | } |
| 2517 | |
| 2518 | public: |
| 2519 | INSTRUCTION_HEADER(IonToWasmCall); |
| 2520 | |
| 2521 | static MIonToWasmCall* New(TempAllocator& alloc, |
| 2522 | WasmInstanceObject* instanceObj, |
| 2523 | const wasm::FuncExport& funcExport); |
| 2524 | |
| 2525 | void initArg(size_t i, MDefinition* arg) { initOperand(i, arg); } |
| 2526 | |
| 2527 | WasmInstanceObject* instanceObject() const { return instanceObj_; } |
| 2528 | wasm::Instance* instance() const { return &instanceObj_->instance(); } |
| 2529 | const wasm::FuncExport& funcExport() const { return funcExport_; } |
| 2530 | bool possiblyCalls() const override { return true; } |
| 2531 | #ifdef DEBUG1 |
| 2532 | bool isConsistentFloat32Use(MUse* use) const override; |
| 2533 | #endif |
| 2534 | }; |
| 2535 | |
| 2536 | // For accesses to wasm object fields, we need to be able to describe 8- and |
| 2537 | // 16-bit accesses. But MIRType can't represent those. Hence these two |
| 2538 | // supplemental enums, used for reading and writing fields respectively. |
| 2539 | |
| 2540 | // Indicates how to widen an 8- or 16-bit value (when it is read from memory). |
| 2541 | enum class MWideningOp : uint8_t { None, FromU16, FromS16, FromU8, FromS8 }; |
| 2542 | |
| 2543 | #ifdef JS_JITSPEW1 |
| 2544 | static inline const char* StringFromMWideningOp(MWideningOp op) { |
| 2545 | switch (op) { |
| 2546 | case MWideningOp::None: |
| 2547 | return "None"; |
| 2548 | case MWideningOp::FromU16: |
| 2549 | return "FromU16"; |
| 2550 | case MWideningOp::FromS16: |
| 2551 | return "FromS16"; |
| 2552 | case MWideningOp::FromU8: |
| 2553 | return "FromU8"; |
| 2554 | case MWideningOp::FromS8: |
| 2555 | return "FromS8"; |
| 2556 | default: |
| 2557 | break; |
| 2558 | } |
| 2559 | MOZ_CRASH("Unknown MWideningOp")do { do { } while (false); MOZ_ReportCrash("" "Unknown MWideningOp" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2559); AnnotateMozCrashReason ("MOZ_CRASH(" "Unknown MWideningOp" ")"); do { MOZ_CrashSequence (__null, 2559); __attribute__((nomerge)) ::abort(); } while ( false); } while (false); |
| 2560 | } |
| 2561 | #endif |
| 2562 | |
| 2563 | // Indicates how to narrow a 32-bit value (when it is written to memory). The |
| 2564 | // operation is a simple truncate. |
| 2565 | enum class MNarrowingOp : uint8_t { None, To16, To8 }; |
| 2566 | |
| 2567 | #ifdef JS_JITSPEW1 |
| 2568 | static inline const char* StringFromMNarrowingOp(MNarrowingOp op) { |
| 2569 | switch (op) { |
| 2570 | case MNarrowingOp::None: |
| 2571 | return "None"; |
| 2572 | case MNarrowingOp::To16: |
| 2573 | return "To16"; |
| 2574 | case MNarrowingOp::To8: |
| 2575 | return "To8"; |
| 2576 | default: |
| 2577 | break; |
| 2578 | } |
| 2579 | MOZ_CRASH("Unknown MNarrowingOp")do { do { } while (false); MOZ_ReportCrash("" "Unknown MNarrowingOp" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2579); AnnotateMozCrashReason ("MOZ_CRASH(" "Unknown MNarrowingOp" ")"); do { MOZ_CrashSequence (__null, 2579); __attribute__((nomerge)) ::abort(); } while ( false); } while (false); |
| 2580 | } |
| 2581 | #endif |
| 2582 | |
| 2583 | // Loads a value from a location, denoted as a fixed offset from a base |
| 2584 | // pointer. This field may be any value type, including references. No |
| 2585 | // barriers are performed. |
| 2586 | // |
| 2587 | // This instruction can extend the lifetime of an optional `keepAlive` |
| 2588 | // parameter to match the lifetime of this instruction. This is necessary if |
| 2589 | // the base pointer is owned by some GC'ed object, which means that the GC |
| 2590 | // object must have the same lifetime as all uses of it's owned pointers. |
| 2591 | // No code to access the keepAlive value is generated. |
| 2592 | // |
| 2593 | // `offset` must be representable as a 31-bit unsigned integer. |
| 2594 | // |
| 2595 | // An optional structFieldIndex can be given for struct accesses and used in |
| 2596 | // scalar replacement. |
| 2597 | class MWasmLoadField : public MBinaryInstruction, public NoTypePolicy::Data { |
| 2598 | uint32_t offset_; |
| 2599 | mozilla::Maybe<uint32_t> structFieldIndex_; |
| 2600 | MWideningOp wideningOp_; |
| 2601 | AliasSet aliases_; |
| 2602 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2603 | wasm::MaybeRefType maybeRefType_; |
| 2604 | |
| 2605 | MWasmLoadField(MDefinition* base, MDefinition* keepAlive, size_t offset, |
| 2606 | mozilla::Maybe<uint32_t> structFieldIndex, MIRType type, |
| 2607 | MWideningOp wideningOp, AliasSet aliases, |
| 2608 | wasm::MaybeTrapSiteDesc maybeTrap = mozilla::Nothing(), |
| 2609 | wasm::MaybeRefType maybeRefType = wasm::MaybeRefType()) |
| 2610 | : MBinaryInstruction(classOpcode, base, keepAlive ? keepAlive : base), |
| 2611 | offset_(uint32_t(offset)), |
| 2612 | structFieldIndex_(structFieldIndex), |
| 2613 | wideningOp_(wideningOp), |
| 2614 | aliases_(aliases), |
| 2615 | maybeTrap_(std::move(maybeTrap)), |
| 2616 | maybeRefType_(maybeRefType) { |
| 2617 | MOZ_ASSERT(offset <= INT32_MAX)do { static_assert( mozilla::detail::AssertionConditionType< decltype(offset <= (2147483647))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(offset <= (2147483647)))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("offset <= (2147483647)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2617); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "offset <= (2147483647)" ")"); do { MOZ_CrashSequence (__null, 2617); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2618 | // "if you want to widen the value when it is loaded, the destination type |
| 2619 | // must be Int32". |
| 2620 | MOZ_ASSERT_IF(wideningOp != MWideningOp::None, type == MIRType::Int32)do { if (wideningOp != MWideningOp::None) { do { static_assert ( mozilla::detail::AssertionConditionType<decltype(type == MIRType::Int32)>::isValid, "invalid assertion condition") ; if ((__builtin_expect(!!(!(!!(type == MIRType::Int32))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("type == MIRType::Int32" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2620); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type == MIRType::Int32" ")"); do { MOZ_CrashSequence (__null, 2620); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); } } while (false); |
| 2621 | // Check the alias set is one of the expected kinds. |
| 2622 | MOZ_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2623 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2624 | AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2625 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2626 | AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2627 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2628 | AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2629 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2630 | AliasSet::Load(AliasSet::WasmArrayNumElements).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2631 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2632 | AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2633 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2634 | AliasSet::Load(AliasSet::WasmArrayDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2635 | aliases.flags() == AliasSet::Load(AliasSet::Any).flags())do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2635); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayNumElements).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags() || aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2635); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2636 | // Check the alias set is consistent with the result type. |
| 2637 | MOZ_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype((aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags()) == (type == MIRType::WasmStructData))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!((aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags()) == (type == MIRType::WasmStructData)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2640); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" ")"); do { MOZ_CrashSequence(__null, 2640); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2638 | (aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype((aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags()) == (type == MIRType::WasmStructData))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!((aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags()) == (type == MIRType::WasmStructData)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2640); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" ")"); do { MOZ_CrashSequence(__null, 2640); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2639 | AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) ==do { static_assert( mozilla::detail::AssertionConditionType< decltype((aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags()) == (type == MIRType::WasmStructData))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!((aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags()) == (type == MIRType::WasmStructData)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2640); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" ")"); do { MOZ_CrashSequence(__null, 2640); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2640 | (type == MIRType::WasmStructData))do { static_assert( mozilla::detail::AssertionConditionType< decltype((aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags()) == (type == MIRType::WasmStructData))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!((aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer ).flags()) == (type == MIRType::WasmStructData)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2640); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" ")"); do { MOZ_CrashSequence(__null, 2640); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2641 | MOZ_ASSERT((aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype((aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags()) == (type == MIRType::WasmArrayData))>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(! !((aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags()) == (type == MIRType::WasmArrayData)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) == (type == MIRType::WasmArrayData)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2643); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) == (type == MIRType::WasmArrayData)" ")"); do { MOZ_CrashSequence(__null, 2643); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2642 | AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) ==do { static_assert( mozilla::detail::AssertionConditionType< decltype((aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags()) == (type == MIRType::WasmArrayData))>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(! !((aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags()) == (type == MIRType::WasmArrayData)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) == (type == MIRType::WasmArrayData)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2643); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) == (type == MIRType::WasmArrayData)" ")"); do { MOZ_CrashSequence(__null, 2643); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2643 | (type == MIRType::WasmArrayData))do { static_assert( mozilla::detail::AssertionConditionType< decltype((aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags()) == (type == MIRType::WasmArrayData))>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(! !((aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer ).flags()) == (type == MIRType::WasmArrayData)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) == (type == MIRType::WasmArrayData)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2643); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) == (type == MIRType::WasmArrayData)" ")"); do { MOZ_CrashSequence(__null, 2643); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2644 | setResultType(type); |
| 2645 | if (maybeTrap_) { |
| 2646 | // This is safe, but see bug 1992059 for associated details. |
| 2647 | setGuard(); |
| 2648 | } else { |
| 2649 | setMovable(); |
| 2650 | } |
| 2651 | setWasmRefType(maybeRefType); |
| 2652 | } |
| 2653 | |
| 2654 | public: |
| 2655 | INSTRUCTION_HEADER(WasmLoadField) |
| 2656 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2657 | NAMED_OPERANDS((0, base), (1, keepAlive))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t keepAliveOperand = 1; MDefinition* keepAlive() const { return getOperand(1); } |
| 2658 | |
| 2659 | uint32_t offset() const { return offset_; } |
| 2660 | mozilla::Maybe<uint32_t> structFieldIndex() const { |
| 2661 | return structFieldIndex_; |
| 2662 | } |
| 2663 | MWideningOp wideningOp() const { return wideningOp_; } |
| 2664 | AliasSet getAliasSet() const override { return aliases_; } |
| 2665 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2666 | wasm::MaybeRefType maybeRefType() const { return maybeRefType_; } |
| 2667 | |
| 2668 | bool congruentTo(const MDefinition* ins) const override { |
| 2669 | if (!ins->isWasmLoadField()) { |
| 2670 | return false; |
| 2671 | } |
| 2672 | const MWasmLoadField* other = ins->toWasmLoadField(); |
| 2673 | return congruentIfOperandsEqual(other) && offset() == other->offset() && |
| 2674 | structFieldIndex() == other->structFieldIndex() && |
| 2675 | wideningOp() == other->wideningOp() && |
| 2676 | getAliasSet().flags() == other->getAliasSet().flags() && |
| 2677 | maybeRefType() == other->maybeRefType(); |
| 2678 | } |
| 2679 | |
| 2680 | virtual AliasType mightAlias(const MDefinition* ins) const override; |
| 2681 | |
| 2682 | #ifdef JS_JITSPEW1 |
| 2683 | void getExtras(ExtrasCollector* extras) const override { |
| 2684 | char buf[96]; |
| 2685 | SprintfLiteral(buf, "(offs=%lld, wideningOp=%s)", (long long int)offset_, |
| 2686 | StringFromMWideningOp(wideningOp_)); |
| 2687 | extras->add(buf); |
| 2688 | } |
| 2689 | #endif |
| 2690 | |
| 2691 | ALLOW_CLONE(MWasmLoadField)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2691); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2691); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmLoadField(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 2692 | }; |
| 2693 | |
| 2694 | // Loads a value from base pointer, given an index and element size. This field |
| 2695 | // may be any value type, including references. No barriers are performed. |
| 2696 | // |
| 2697 | // The element size is implicitly defined by MIRType and MWideningOp. For |
| 2698 | // example, MIRType::Float32 indicates an element size of 32 bits, and |
| 2699 | // MIRType::Int32 and MWideningOp::FromU16 together indicate an element size of |
| 2700 | // 16 bits. |
| 2701 | // |
| 2702 | // This instruction takes an optional second object `keepAlive` that must be |
| 2703 | // kept alive, as described for MWasmLoadField above. |
| 2704 | class MWasmLoadElement : public MTernaryInstruction, public NoTypePolicy::Data { |
| 2705 | MWideningOp wideningOp_; |
| 2706 | Scale scale_; |
| 2707 | AliasSet aliases_; |
| 2708 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2709 | |
| 2710 | MWasmLoadElement(MDefinition* base, MDefinition* keepAlive, |
| 2711 | MDefinition* index, MIRType type, MWideningOp wideningOp, |
| 2712 | Scale scale, AliasSet aliases, |
| 2713 | wasm::MaybeTrapSiteDesc maybeTrap = mozilla::Nothing(), |
| 2714 | wasm::MaybeRefType maybeRefType = wasm::MaybeRefType()) |
| 2715 | : MTernaryInstruction(classOpcode, base, index, |
| 2716 | keepAlive ? keepAlive : base), |
| 2717 | wideningOp_(wideningOp), |
| 2718 | scale_(scale), |
| 2719 | aliases_(aliases), |
| 2720 | maybeTrap_(std::move(maybeTrap)) { |
| 2721 | MOZ_ASSERT(base->type() == MIRType::WasmArrayData)do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == MIRType::WasmArrayData)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(base->type() == MIRType::WasmArrayData))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == MIRType::WasmArrayData" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2721); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2721); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2722 | MOZ_ASSERT(aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmArrayDataArea).flags() || aliases.flags() == AliasSet:: Load(AliasSet::Any).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2724); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2724); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2723 | AliasSet::Load(AliasSet::WasmArrayDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmArrayDataArea).flags() || aliases.flags() == AliasSet:: Load(AliasSet::Any).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2724); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2724); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2724 | aliases.flags() == AliasSet::Load(AliasSet::Any).flags())do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any) .flags())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Load(AliasSet ::WasmArrayDataArea).flags() || aliases.flags() == AliasSet:: Load(AliasSet::Any).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2724); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2724); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2725 | setResultType(type); |
| 2726 | if (maybeTrap_) { |
| 2727 | setGuard(); |
| 2728 | } |
| 2729 | setWasmRefType(maybeRefType); |
| 2730 | } |
| 2731 | |
| 2732 | public: |
| 2733 | INSTRUCTION_HEADER(WasmLoadElement) |
| 2734 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2735 | NAMED_OPERANDS((0, base), (1, index), (2, keepAlive))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t indexOperand = 1; MDefinition* index() const { return getOperand(1); } static constexpr size_t keepAliveOperand = 2; MDefinition* keepAlive () const { return getOperand(2); } |
| 2736 | |
| 2737 | MWideningOp wideningOp() const { return wideningOp_; } |
| 2738 | Scale scale() const { return scale_; } |
| 2739 | AliasSet getAliasSet() const override { return aliases_; } |
| 2740 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2741 | |
| 2742 | #ifdef JS_JITSPEW1 |
| 2743 | void getExtras(ExtrasCollector* extras) const override { |
| 2744 | char buf[96]; |
| 2745 | SprintfLiteral(buf, "(wideningOp=%s, scale=%s)", |
| 2746 | StringFromMWideningOp(wideningOp_), StringFromScale(scale_)); |
| 2747 | extras->add(buf); |
| 2748 | } |
| 2749 | #endif |
| 2750 | |
| 2751 | ALLOW_CLONE(MWasmLoadElement)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2751); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2751); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmLoadElement(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 2752 | }; |
| 2753 | |
| 2754 | // Stores a non-reference value to anlocation, denoted as a fixed offset from |
| 2755 | // a base pointer, which (it is assumed) is within a wasm object. This field |
| 2756 | // may be any value type, _excluding_ references. References _must_ use the |
| 2757 | // 'Ref' variant of this instruction. The offset must be representable as a |
| 2758 | // 31-bit unsigned integer. |
| 2759 | // |
| 2760 | // This instruction takes a second object `keepAlive` that must be kept alive, |
| 2761 | // as described for MWasmLoadField above. |
| 2762 | class MWasmStoreField : public MTernaryInstruction, public NoTypePolicy::Data { |
| 2763 | uint32_t offset_; |
| 2764 | mozilla::Maybe<uint32_t> structFieldIndex_; |
| 2765 | MNarrowingOp narrowingOp_; |
| 2766 | AliasSet aliases_; |
| 2767 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2768 | |
| 2769 | MWasmStoreField(MDefinition* base, MDefinition* keepAlive, size_t offset, |
| 2770 | mozilla::Maybe<uint32_t> structFieldIndex, MDefinition* value, |
| 2771 | MNarrowingOp narrowingOp, AliasSet aliases, |
| 2772 | wasm::MaybeTrapSiteDesc maybeTrap = mozilla::Nothing()) |
| 2773 | : MTernaryInstruction(classOpcode, base, value, |
| 2774 | keepAlive ? keepAlive : base), |
| 2775 | offset_(uint32_t(offset)), |
| 2776 | structFieldIndex_(structFieldIndex), |
| 2777 | narrowingOp_(narrowingOp), |
| 2778 | aliases_(aliases), |
| 2779 | maybeTrap_(std::move(maybeTrap)) { |
| 2780 | MOZ_ASSERT(offset <= INT32_MAX)do { static_assert( mozilla::detail::AssertionConditionType< decltype(offset <= (2147483647))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(offset <= (2147483647)))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("offset <= (2147483647)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2780); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "offset <= (2147483647)" ")"); do { MOZ_CrashSequence (__null, 2780); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2781 | MOZ_ASSERT(value->type() != MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(value->type() != MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(value->type() != MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("value->type() != MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2781); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() != MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 2781); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2782 | // "if you want to narrow the value when it is stored, the source type |
| 2783 | // must be Int32". |
| 2784 | MOZ_ASSERT_IF(narrowingOp != MNarrowingOp::None,do { if (narrowingOp != MNarrowingOp::None) { do { static_assert ( mozilla::detail::AssertionConditionType<decltype(value-> type() == MIRType::Int32)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(value->type() == MIRType:: Int32))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("value->type() == MIRType::Int32", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 2785); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 2785); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
| 2785 | value->type() == MIRType::Int32)do { if (narrowingOp != MNarrowingOp::None) { do { static_assert ( mozilla::detail::AssertionConditionType<decltype(value-> type() == MIRType::Int32)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(value->type() == MIRType:: Int32))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("value->type() == MIRType::Int32", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 2785); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 2785); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
| 2786 | MOZ_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2793); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2793); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2787 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2793); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2793); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2788 | AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2793); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2793); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2789 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2793); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2793); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2790 | AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2793); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2793); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2791 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2793); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2793); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2792 | AliasSet::Store(AliasSet::WasmArrayDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2793); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2793); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2793 | aliases.flags() == AliasSet::Store(AliasSet::Any).flags())do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2793); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2793); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2794 | if (maybeTrap_) { |
| 2795 | setGuard(); |
| 2796 | } |
| 2797 | } |
| 2798 | |
| 2799 | public: |
| 2800 | INSTRUCTION_HEADER(WasmStoreField) |
| 2801 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2802 | NAMED_OPERANDS((0, base), (1, value), (2, keepAlive))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t valueOperand = 1; MDefinition* value() const { return getOperand(1); } static constexpr size_t keepAliveOperand = 2; MDefinition* keepAlive () const { return getOperand(2); } |
| 2803 | |
| 2804 | uint32_t offset() const { return offset_; } |
| 2805 | mozilla::Maybe<uint32_t> structFieldIndex() const { |
| 2806 | return structFieldIndex_; |
| 2807 | } |
| 2808 | MNarrowingOp narrowingOp() const { return narrowingOp_; } |
| 2809 | AliasSet getAliasSet() const override { return aliases_; } |
| 2810 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2811 | |
| 2812 | #ifdef JS_JITSPEW1 |
| 2813 | void getExtras(ExtrasCollector* extras) const override { |
| 2814 | char buf[96]; |
| 2815 | SprintfLiteral(buf, "(offs=%lld, narrowingOp=%s)", (long long int)offset_, |
| 2816 | StringFromMNarrowingOp(narrowingOp_)); |
| 2817 | extras->add(buf); |
| 2818 | } |
| 2819 | #endif |
| 2820 | |
| 2821 | ALLOW_CLONE(MWasmStoreField)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2821); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2821); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmStoreField(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 2822 | }; |
| 2823 | |
| 2824 | // Stores a reference value to a location, denoted as a fixed offset from a |
| 2825 | // base pointer, which (it is assumed) is within a wasm object. This |
| 2826 | // instruction emits a pre-barrier. A post barrier _must_ be performed |
| 2827 | // separately. The offset must be representable as a 31-bit unsigned integer. |
| 2828 | // |
| 2829 | // This instruction takes a second object `keepAlive` that must be kept alive, |
| 2830 | // as described for MWasmLoadField above. |
| 2831 | class MWasmStoreFieldRef : public MAryInstruction<4>, |
| 2832 | public NoTypePolicy::Data { |
| 2833 | uint32_t offset_; |
| 2834 | mozilla::Maybe<uint32_t> structFieldIndex_; |
| 2835 | AliasSet aliases_; |
| 2836 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2837 | WasmPreBarrierKind preBarrierKind_; |
| 2838 | |
| 2839 | MWasmStoreFieldRef(MDefinition* instance, MDefinition* base, |
| 2840 | MDefinition* keepAlive, size_t offset, |
| 2841 | mozilla::Maybe<uint32_t> structFieldIndex, |
| 2842 | MDefinition* value, AliasSet aliases, |
| 2843 | wasm::MaybeTrapSiteDesc maybeTrap, |
| 2844 | WasmPreBarrierKind preBarrierKind) |
| 2845 | : MAryInstruction<4>(classOpcode), |
| 2846 | offset_(uint32_t(offset)), |
| 2847 | structFieldIndex_(structFieldIndex), |
| 2848 | aliases_(aliases), |
| 2849 | maybeTrap_(std::move(maybeTrap)), |
| 2850 | preBarrierKind_(preBarrierKind) { |
| 2851 | MOZ_ASSERT(base->type() == TargetWordMIRType() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == TargetWordMIRType() || base->type () == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type () == MIRType::WasmArrayData)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == TargetWordMIRType () || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2855); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2852 | base->type() == MIRType::Pointer ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == TargetWordMIRType() || base->type () == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type () == MIRType::WasmArrayData)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == TargetWordMIRType () || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2855); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2853 | base->type() == MIRType::WasmAnyRef ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == TargetWordMIRType() || base->type () == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type () == MIRType::WasmArrayData)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == TargetWordMIRType () || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2855); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2854 | base->type() == MIRType::WasmStructData ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == TargetWordMIRType() || base->type () == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type () == MIRType::WasmArrayData)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == TargetWordMIRType () || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2855); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2855 | base->type() == MIRType::WasmArrayData)do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == TargetWordMIRType() || base->type () == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type () == MIRType::WasmArrayData)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(base->type() == TargetWordMIRType () || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2855); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == TargetWordMIRType() || base->type() == MIRType::Pointer || base->type() == MIRType::WasmAnyRef || base->type() == MIRType::WasmStructData || base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2856 | MOZ_ASSERT(offset <= INT32_MAX)do { static_assert( mozilla::detail::AssertionConditionType< decltype(offset <= (2147483647))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(offset <= (2147483647)))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("offset <= (2147483647)" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2856); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "offset <= (2147483647)" ")"); do { MOZ_CrashSequence (__null, 2856); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2857 | MOZ_ASSERT(value->type() == MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(value->type() == MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(value->type() == MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("value->type() == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2857); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 2857); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2858 | MOZ_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2865); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2865); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2859 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2865); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2865); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2860 | AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2865); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2865); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2861 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2865); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2865); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2862 | AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2865); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2865); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2863 | aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2865); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2865); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2864 | AliasSet::Store(AliasSet::WasmArrayDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2865); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2865); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2865 | aliases.flags() == AliasSet::Store(AliasSet::Any).flags())do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmStructInlineDataArea).flags() || aliases.flags( ) == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags () || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2865); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmStructInlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmStructOutlineDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2865); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2866 | initOperand(0, instance); |
| 2867 | initOperand(1, base); |
| 2868 | initOperand(2, value); |
| 2869 | initOperand(3, keepAlive ? keepAlive : base); |
| 2870 | if (maybeTrap_) { |
| 2871 | setGuard(); |
| 2872 | } |
| 2873 | } |
| 2874 | |
| 2875 | public: |
| 2876 | INSTRUCTION_HEADER(WasmStoreFieldRef) |
| 2877 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2878 | NAMED_OPERANDS((0, instance), (1, base), (2, value), (3, keepAlive))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } static constexpr size_t baseOperand = 1; MDefinition* base() const { return getOperand(1); } static constexpr size_t valueOperand = 2; MDefinition* value() const { return getOperand(2); } static constexpr size_t keepAliveOperand = 3; MDefinition* keepAlive() const { return getOperand(3); } |
| 2879 | |
| 2880 | uint32_t offset() const { return offset_; } |
| 2881 | mozilla::Maybe<uint32_t> structFieldIndex() const { |
| 2882 | return structFieldIndex_; |
| 2883 | } |
| 2884 | AliasSet getAliasSet() const override { return aliases_; } |
| 2885 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2886 | WasmPreBarrierKind preBarrierKind() const { return preBarrierKind_; } |
| 2887 | |
| 2888 | #ifdef JS_JITSPEW1 |
| 2889 | void getExtras(ExtrasCollector* extras) const override { |
| 2890 | char buf[64]; |
| 2891 | SprintfLiteral(buf, "(offs=%lld)", (long long int)offset_); |
| 2892 | extras->add(buf); |
| 2893 | } |
| 2894 | #endif |
| 2895 | |
| 2896 | ALLOW_CLONE(MWasmStoreFieldRef)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2896); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2896); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmStoreFieldRef(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 2897 | }; |
| 2898 | |
| 2899 | // Stores a non-reference value to a base pointer, given an index and element |
| 2900 | // size. This field may be any value type, excluding references. References MUST |
| 2901 | // use the 'Ref' variant of this instruction. |
| 2902 | // |
| 2903 | // The element size is implicitly defined by MIRType and MNarrowingOp. For |
| 2904 | // example, MIRType::Float32 indicates an element size of 32 bits, and |
| 2905 | // MIRType::Int32 and MNarrowingOp::To16 together indicate an element size of 16 |
| 2906 | // bits. |
| 2907 | // |
| 2908 | // This instruction takes a second object `keepAlive` that must be kept alive, |
| 2909 | // as described for MWasmLoadField above. |
| 2910 | class MWasmStoreElement : public MQuaternaryInstruction, |
| 2911 | public NoTypePolicy::Data { |
| 2912 | MNarrowingOp narrowingOp_; |
| 2913 | Scale scale_; |
| 2914 | AliasSet aliases_; |
| 2915 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2916 | |
| 2917 | MWasmStoreElement(MDefinition* base, MDefinition* index, MDefinition* value, |
| 2918 | MDefinition* keepAlive, MNarrowingOp narrowingOp, |
| 2919 | Scale scale, AliasSet aliases, |
| 2920 | wasm::MaybeTrapSiteDesc maybeTrap = mozilla::Nothing()) |
| 2921 | : MQuaternaryInstruction(classOpcode, base, index, value, |
| 2922 | keepAlive ? keepAlive : base), |
| 2923 | narrowingOp_(narrowingOp), |
| 2924 | scale_(scale), |
| 2925 | aliases_(aliases), |
| 2926 | maybeTrap_(std::move(maybeTrap)) { |
| 2927 | MOZ_ASSERT(base->type() == MIRType::WasmArrayData)do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == MIRType::WasmArrayData)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(base->type() == MIRType::WasmArrayData))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == MIRType::WasmArrayData" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2927); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2927); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2928 | MOZ_ASSERT(value->type() != MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(value->type() != MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(value->type() != MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("value->type() != MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2928); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() != MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 2928); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2929 | // "if you want to narrow the value when it is stored, the source type |
| 2930 | // must be Int32". |
| 2931 | MOZ_ASSERT_IF(narrowingOp != MNarrowingOp::None,do { if (narrowingOp != MNarrowingOp::None) { do { static_assert ( mozilla::detail::AssertionConditionType<decltype(value-> type() == MIRType::Int32)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(value->type() == MIRType:: Int32))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("value->type() == MIRType::Int32", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 2932); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 2932); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
| 2932 | value->type() == MIRType::Int32)do { if (narrowingOp != MNarrowingOp::None) { do { static_assert ( mozilla::detail::AssertionConditionType<decltype(value-> type() == MIRType::Int32)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(value->type() == MIRType:: Int32))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("value->type() == MIRType::Int32", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 2932); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 2932); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
| 2933 | MOZ_ASSERT(aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet ::Store(AliasSet::Any).flags()))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2935); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2935); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2934 | AliasSet::Store(AliasSet::WasmArrayDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet ::Store(AliasSet::Any).flags()))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2935); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2935); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2935 | aliases.flags() == AliasSet::Store(AliasSet::Any).flags())do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet ::Store(AliasSet::Any).flags()))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2935); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2935); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2936 | if (maybeTrap_) { |
| 2937 | setGuard(); |
| 2938 | } |
| 2939 | } |
| 2940 | |
| 2941 | public: |
| 2942 | INSTRUCTION_HEADER(WasmStoreElement) |
| 2943 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 2944 | NAMED_OPERANDS((0, base), (1, index), (2, value), (3, keepAlive))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } static constexpr size_t indexOperand = 1; MDefinition* index() const { return getOperand(1); } static constexpr size_t valueOperand = 2; MDefinition* value() const { return getOperand(2); } static constexpr size_t keepAliveOperand = 3; MDefinition* keepAlive() const { return getOperand(3); } |
| 2945 | |
| 2946 | MNarrowingOp narrowingOp() const { return narrowingOp_; } |
| 2947 | Scale scale() const { return scale_; } |
| 2948 | AliasSet getAliasSet() const override { return aliases_; } |
| 2949 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2950 | |
| 2951 | #ifdef JS_JITSPEW1 |
| 2952 | void getExtras(ExtrasCollector* extras) const override { |
| 2953 | char buf[96]; |
| 2954 | SprintfLiteral(buf, "(narrowingOp=%s, scale=%s)", |
| 2955 | StringFromMNarrowingOp(narrowingOp_), |
| 2956 | StringFromScale(scale_)); |
| 2957 | extras->add(buf); |
| 2958 | } |
| 2959 | #endif |
| 2960 | |
| 2961 | ALLOW_CLONE(MWasmStoreElement)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2961); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2961); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmStoreElement(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 2962 | }; |
| 2963 | |
| 2964 | // Stores a reference value to a base pointer, given an index and element size. |
| 2965 | // This instruction emits a pre-barrier. A post barrier MUST be performed |
| 2966 | // separately. |
| 2967 | // |
| 2968 | // The element size is implicitly defined by MIRType and MNarrowingOp, as |
| 2969 | // described for MWasmStoreElement above. |
| 2970 | // |
| 2971 | // This instruction takes a second object `ka` that must be kept alive, as |
| 2972 | // described for MWasmLoadField above. |
| 2973 | class MWasmStoreElementRef : public MAryInstruction<5>, |
| 2974 | public NoTypePolicy::Data { |
| 2975 | AliasSet aliases_; |
| 2976 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2977 | WasmPreBarrierKind preBarrierKind_; |
| 2978 | |
| 2979 | MWasmStoreElementRef(MDefinition* instance, MDefinition* base, |
| 2980 | MDefinition* index, MDefinition* value, |
| 2981 | MDefinition* keepAlive, AliasSet aliases, |
| 2982 | wasm::MaybeTrapSiteDesc maybeTrap, |
| 2983 | WasmPreBarrierKind preBarrierKind) |
| 2984 | : MAryInstruction<5>(classOpcode), |
| 2985 | aliases_(aliases), |
| 2986 | maybeTrap_(std::move(maybeTrap)), |
| 2987 | preBarrierKind_(preBarrierKind) { |
| 2988 | MOZ_ASSERT(base->type() == MIRType::WasmArrayData)do { static_assert( mozilla::detail::AssertionConditionType< decltype(base->type() == MIRType::WasmArrayData)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(base->type() == MIRType::WasmArrayData))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("base->type() == MIRType::WasmArrayData" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2988); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2988); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2989 | MOZ_ASSERT(value->type() == MIRType::WasmAnyRef)do { static_assert( mozilla::detail::AssertionConditionType< decltype(value->type() == MIRType::WasmAnyRef)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(value->type() == MIRType::WasmAnyRef))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("value->type() == MIRType::WasmAnyRef" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2989); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 2989); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2990 | MOZ_ASSERT(aliases.flags() ==do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet ::Store(AliasSet::Any).flags()))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2992); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2992); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2991 | AliasSet::Store(AliasSet::WasmArrayDataArea).flags() ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet ::Store(AliasSet::Any).flags()))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2992); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2992); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2992 | aliases.flags() == AliasSet::Store(AliasSet::Any).flags())do { static_assert( mozilla::detail::AssertionConditionType< decltype(aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea ).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any ).flags())>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(aliases.flags() == AliasSet::Store( AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet ::Store(AliasSet::Any).flags()))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2992); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2992); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2993 | initOperand(0, instance); |
| 2994 | initOperand(1, base); |
| 2995 | initOperand(2, index); |
| 2996 | initOperand(3, value); |
| 2997 | initOperand(4, keepAlive ? keepAlive : base); |
| 2998 | if (maybeTrap_) { |
| 2999 | setGuard(); |
| 3000 | } |
| 3001 | } |
| 3002 | |
| 3003 | public: |
| 3004 | INSTRUCTION_HEADER(WasmStoreElementRef) |
| 3005 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3006 | NAMED_OPERANDS((0, instance), (1, base), (2, index), (3, value),static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } static constexpr size_t baseOperand = 1; MDefinition* base() const { return getOperand(1); } static constexpr size_t indexOperand = 2; MDefinition* index() const { return getOperand(2); } static constexpr size_t valueOperand = 3; MDefinition* value() const { return getOperand(3); } static constexpr size_t keepAliveOperand = 4; MDefinition* keepAlive () const { return getOperand(4); } |
| 3007 | (4, keepAlive))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } static constexpr size_t baseOperand = 1; MDefinition* base() const { return getOperand(1); } static constexpr size_t indexOperand = 2; MDefinition* index() const { return getOperand(2); } static constexpr size_t valueOperand = 3; MDefinition* value() const { return getOperand(3); } static constexpr size_t keepAliveOperand = 4; MDefinition* keepAlive () const { return getOperand(4); } |
| 3008 | |
| 3009 | AliasSet getAliasSet() const override { return aliases_; } |
| 3010 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 3011 | WasmPreBarrierKind preBarrierKind() const { return preBarrierKind_; } |
| 3012 | |
| 3013 | ALLOW_CLONE(MWasmStoreElementRef)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3013); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3013); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmStoreElementRef(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 3014 | }; |
| 3015 | |
| 3016 | class MWasmRefAsNonNull : public MUnaryInstruction, public NoTypePolicy::Data { |
| 3017 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3018 | |
| 3019 | MWasmRefAsNonNull(MDefinition* ref, const wasm::TrapSiteDesc& trapSiteDesc) |
| 3020 | : MUnaryInstruction(classOpcode, ref), trapSiteDesc_(trapSiteDesc) { |
| 3021 | setResultType(MIRType::WasmAnyRef); |
| 3022 | setGuard(); |
| 3023 | } |
| 3024 | |
| 3025 | public: |
| 3026 | INSTRUCTION_HEADER(WasmRefAsNonNull) |
| 3027 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3028 | NAMED_OPERANDS((0, ref))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } |
| 3029 | |
| 3030 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3031 | |
| 3032 | bool congruentTo(const MDefinition* ins) const override { |
| 3033 | return congruentIfOperandsEqual(ins); |
| 3034 | } |
| 3035 | |
| 3036 | wasm::MaybeRefType computeWasmRefType() const override { |
| 3037 | if (ref()->wasmRefType().isNothing()) { |
| 3038 | return wasm::MaybeRefType(); |
| 3039 | } |
| 3040 | return wasm::MaybeRefType(ref()->wasmRefType().value().asNonNullable()); |
| 3041 | } |
| 3042 | |
| 3043 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3044 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3045 | |
| 3046 | ALLOW_CLONE(MWasmRefAsNonNull)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3046); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3046); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmRefAsNonNull(*this); if (!res) { return nullptr ; } for (size_t i = 0; i < numOperands(); i++) { res->replaceOperand (i, inputs[i]); } return res; } |
| 3047 | }; |
| 3048 | |
| 3049 | // Tests if the wasm ref `ref` is a subtype of `destType` and returns the |
| 3050 | // boolean representing the result. |
| 3051 | class MWasmRefTestAbstract : public MUnaryInstruction, |
| 3052 | public NoTypePolicy::Data { |
| 3053 | wasm::RefType destType_; |
| 3054 | |
| 3055 | MWasmRefTestAbstract(MDefinition* ref, wasm::RefType destType) |
| 3056 | : MUnaryInstruction(classOpcode, ref), destType_(destType) { |
| 3057 | MOZ_ASSERT(!destType.isTypeRef())do { static_assert( mozilla::detail::AssertionConditionType< decltype(!destType.isTypeRef())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!destType.isTypeRef()))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("!destType.isTypeRef()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3057); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!destType.isTypeRef()" ")"); do { MOZ_CrashSequence (__null, 3057); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3058 | setResultType(MIRType::Int32); |
| 3059 | setMovable(); |
| 3060 | } |
| 3061 | |
| 3062 | public: |
| 3063 | INSTRUCTION_HEADER(WasmRefTestAbstract) |
| 3064 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3065 | NAMED_OPERANDS((0, ref))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } |
| 3066 | |
| 3067 | wasm::RefType destType() const { return destType_; }; |
| 3068 | |
| 3069 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3070 | |
| 3071 | bool congruentTo(const MDefinition* ins) const override { |
| 3072 | return congruentIfOperandsEqual(ins) && |
| 3073 | destType() == ins->toWasmRefTestAbstract()->destType(); |
| 3074 | } |
| 3075 | |
| 3076 | HashNumber valueHash() const override { |
| 3077 | HashNumber hn = MUnaryInstruction::valueHash(); |
| 3078 | hn = addU64ToHash(hn, destType().packed().bits()); |
| 3079 | return hn; |
| 3080 | } |
| 3081 | |
| 3082 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3083 | |
| 3084 | ALLOW_CLONE(MWasmRefTestAbstract)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3084); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3084); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmRefTestAbstract(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 3085 | }; |
| 3086 | |
| 3087 | // Tests if the wasm ref `ref` is a subtype of `superSTV` and returns the |
| 3088 | // boolean representing the result. |
| 3089 | // |
| 3090 | // The actual super type definition must be known at compile time, so that the |
| 3091 | // subtyping depth of super type depth can be used. |
| 3092 | class MWasmRefTestConcrete : public MBinaryInstruction, |
| 3093 | public NoTypePolicy::Data { |
| 3094 | wasm::RefType destType_; |
| 3095 | |
| 3096 | MWasmRefTestConcrete(MDefinition* ref, MDefinition* superSTV, |
| 3097 | wasm::RefType destType) |
| 3098 | : MBinaryInstruction(classOpcode, ref, superSTV), destType_(destType) { |
| 3099 | MOZ_ASSERT(destType.isTypeRef())do { static_assert( mozilla::detail::AssertionConditionType< decltype(destType.isTypeRef())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(destType.isTypeRef()))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("destType.isTypeRef()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3099); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "destType.isTypeRef()" ")"); do { MOZ_CrashSequence (__null, 3099); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3100 | setResultType(MIRType::Int32); |
| 3101 | setMovable(); |
| 3102 | } |
| 3103 | |
| 3104 | public: |
| 3105 | INSTRUCTION_HEADER(WasmRefTestConcrete) |
| 3106 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3107 | NAMED_OPERANDS((0, ref), (1, superSTV))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } static constexpr size_t superSTVOperand = 1; MDefinition* superSTV() const { return getOperand(1); } |
| 3108 | |
| 3109 | wasm::RefType destType() const { return destType_; }; |
| 3110 | |
| 3111 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3112 | |
| 3113 | bool congruentTo(const MDefinition* ins) const override { |
| 3114 | return congruentIfOperandsEqual(ins) && |
| 3115 | destType() == ins->toWasmRefTestConcrete()->destType(); |
| 3116 | } |
| 3117 | |
| 3118 | HashNumber valueHash() const override { |
| 3119 | HashNumber hn = MBinaryInstruction::valueHash(); |
| 3120 | hn = addU64ToHash(hn, destType().packed().bits()); |
| 3121 | return hn; |
| 3122 | } |
| 3123 | |
| 3124 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3125 | |
| 3126 | ALLOW_CLONE(MWasmRefTestConcrete)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3126); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3126); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmRefTestConcrete(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 3127 | }; |
| 3128 | |
| 3129 | // Tests if the wasm ref `ref` is a subtype of `destType` and if so returns the |
| 3130 | // ref, otherwise it does a wasm trap. |
| 3131 | class MWasmRefCastAbstract : public MUnaryInstruction, |
| 3132 | public NoTypePolicy::Data { |
| 3133 | wasm::RefType destType_; |
| 3134 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3135 | |
| 3136 | MWasmRefCastAbstract(MDefinition* ref, wasm::RefType destType, |
| 3137 | wasm::TrapSiteDesc&& trapSiteDesc) |
| 3138 | : MUnaryInstruction(classOpcode, ref), |
| 3139 | destType_(destType), |
| 3140 | trapSiteDesc_(std::move(trapSiteDesc)) { |
| 3141 | MOZ_ASSERT(!destType.isTypeRef())do { static_assert( mozilla::detail::AssertionConditionType< decltype(!destType.isTypeRef())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!destType.isTypeRef()))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("!destType.isTypeRef()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3141); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!destType.isTypeRef()" ")"); do { MOZ_CrashSequence (__null, 3141); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3142 | setResultType(MIRType::WasmAnyRef); |
| 3143 | // This may trap, which requires this to be a guard. |
| 3144 | setGuard(); |
| 3145 | setWasmRefType(wasm::MaybeRefType(destType)); |
| 3146 | } |
| 3147 | |
| 3148 | public: |
| 3149 | INSTRUCTION_HEADER(WasmRefCastAbstract) |
| 3150 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3151 | NAMED_OPERANDS((0, ref))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } |
| 3152 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3153 | |
| 3154 | wasm::RefType destType() const { return destType_; }; |
| 3155 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3156 | |
| 3157 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3158 | }; |
| 3159 | |
| 3160 | // Tests if the wasm ref `ref` is a subtype of `superSTV`, if so return the |
| 3161 | // ref, otherwise do a wasm trap. |
| 3162 | // |
| 3163 | // The actual super type definition must be known at compile time, so that the |
| 3164 | // subtyping depth of super type depth can be used. |
| 3165 | class MWasmRefCastConcrete : public MBinaryInstruction, |
| 3166 | public NoTypePolicy::Data { |
| 3167 | wasm::RefType destType_; |
| 3168 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3169 | |
| 3170 | MWasmRefCastConcrete(MDefinition* ref, MDefinition* superSTV, |
| 3171 | wasm::RefType destType, |
| 3172 | wasm::TrapSiteDesc&& trapSiteDesc) |
| 3173 | : MBinaryInstruction(classOpcode, ref, superSTV), |
| 3174 | destType_(destType), |
| 3175 | trapSiteDesc_(std::move(trapSiteDesc)) { |
| 3176 | MOZ_ASSERT(destType.isTypeRef())do { static_assert( mozilla::detail::AssertionConditionType< decltype(destType.isTypeRef())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(destType.isTypeRef()))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("destType.isTypeRef()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3176); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "destType.isTypeRef()" ")"); do { MOZ_CrashSequence (__null, 3176); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3177 | setResultType(MIRType::WasmAnyRef); |
| 3178 | // This may trap, which requires this to be a guard. |
| 3179 | setGuard(); |
| 3180 | setWasmRefType(wasm::MaybeRefType(destType)); |
| 3181 | } |
| 3182 | |
| 3183 | public: |
| 3184 | INSTRUCTION_HEADER(WasmRefCastConcrete) |
| 3185 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3186 | NAMED_OPERANDS((0, ref), (1, superSTV))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } static constexpr size_t superSTVOperand = 1; MDefinition* superSTV() const { return getOperand(1); } |
| 3187 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3188 | |
| 3189 | wasm::RefType destType() const { return destType_; }; |
| 3190 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3191 | |
| 3192 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3193 | }; |
| 3194 | |
| 3195 | class MWasmRefConvertAnyExtern : public MUnaryInstruction, |
| 3196 | public NoTypePolicy::Data { |
| 3197 | wasm::RefType::Kind destTypeKind_; |
| 3198 | |
| 3199 | MWasmRefConvertAnyExtern(MDefinition* ref, wasm::RefType::Kind destTypeKind) |
| 3200 | : MUnaryInstruction(classOpcode, ref), destTypeKind_(destTypeKind) { |
| 3201 | MOZ_ASSERT(destTypeKind_ == wasm::RefType::Kind::Any ||do { static_assert( mozilla::detail::AssertionConditionType< decltype(destTypeKind_ == wasm::RefType::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(destTypeKind_ == wasm::RefType ::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern)) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("destTypeKind_ == wasm::RefType::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3202); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "destTypeKind_ == wasm::RefType::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern" ")"); do { MOZ_CrashSequence(__null, 3202); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 3202 | destTypeKind_ == wasm::RefType::Kind::Extern)do { static_assert( mozilla::detail::AssertionConditionType< decltype(destTypeKind_ == wasm::RefType::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(destTypeKind_ == wasm::RefType ::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern)) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("destTypeKind_ == wasm::RefType::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3202); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "destTypeKind_ == wasm::RefType::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern" ")"); do { MOZ_CrashSequence(__null, 3202); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3203 | setResultType(MIRType::WasmAnyRef); |
| 3204 | setMovable(); |
| 3205 | } |
| 3206 | |
| 3207 | public: |
| 3208 | INSTRUCTION_HEADER(WasmRefConvertAnyExtern) |
| 3209 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3210 | NAMED_OPERANDS((0, ref))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } |
| 3211 | |
| 3212 | wasm::RefType::Kind destTypeKind() const { return destTypeKind_; } |
| 3213 | |
| 3214 | wasm::MaybeRefType computeWasmRefType() const override { |
| 3215 | bool nullable = true; |
| 3216 | if (ref()->wasmRefType().isSome()) { |
| 3217 | nullable = ref()->wasmRefType().value().isNullable(); |
| 3218 | }; |
| 3219 | return wasm::MaybeRefType(wasm::RefType::fromKind(destTypeKind_, nullable)); |
| 3220 | } |
| 3221 | |
| 3222 | bool congruentTo(const MDefinition* ins) const override { |
| 3223 | return congruentIfOperandsEqual(ins) && |
| 3224 | destTypeKind() == ins->toWasmRefConvertAnyExtern()->destTypeKind(); |
| 3225 | } |
| 3226 | |
| 3227 | HashNumber valueHash() const override { |
| 3228 | HashNumber hn = MUnaryInstruction::valueHash(); |
| 3229 | hn = addU32ToHash(hn, destTypeKind()); |
| 3230 | return hn; |
| 3231 | } |
| 3232 | |
| 3233 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3234 | }; |
| 3235 | |
| 3236 | class MWasmNewStructObject : public MBinaryInstruction, |
| 3237 | public NoTypePolicy::Data { |
| 3238 | private: |
| 3239 | const wasm::TypeDef* typeDef_; |
| 3240 | bool zeroFields_; |
| 3241 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3242 | |
| 3243 | MWasmNewStructObject(MDefinition* instance, MDefinition* allocSite, |
| 3244 | const wasm::TypeDef* typeDef, bool zeroFields, |
| 3245 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 3246 | : MBinaryInstruction(classOpcode, instance, allocSite), |
| 3247 | typeDef_(typeDef), |
| 3248 | zeroFields_(zeroFields), |
| 3249 | trapSiteDesc_(trapSiteDesc) { |
| 3250 | MOZ_ASSERT(typeDef->isStructType())do { static_assert( mozilla::detail::AssertionConditionType< decltype(typeDef->isStructType())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(typeDef->isStructType())) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("typeDef->isStructType()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3250); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "typeDef->isStructType()" ")"); do { MOZ_CrashSequence (__null, 3250); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3251 | setResultType(MIRType::WasmAnyRef); |
| 3252 | setWasmRefType( |
| 3253 | wasm::MaybeRefType(wasm::RefType::fromTypeDef(typeDef_, false))); |
| 3254 | } |
| 3255 | |
| 3256 | public: |
| 3257 | INSTRUCTION_HEADER(WasmNewStructObject) |
| 3258 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3259 | NAMED_OPERANDS((0, instance), (1, allocSite))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } static constexpr size_t allocSiteOperand = 1; MDefinition* allocSite() const { return getOperand(1); } |
| 3260 | |
| 3261 | AliasSet getAliasSet() const override { |
| 3262 | if (js::SupportDifferentialTesting()) { |
| 3263 | // Consider allocations effectful for differential testing. |
| 3264 | return MDefinition::getAliasSet(); |
| 3265 | } |
| 3266 | return AliasSet::None(); |
| 3267 | } |
| 3268 | const wasm::TypeDef& typeDef() { return *typeDef_; } |
| 3269 | const wasm::StructType& structType() const { return typeDef_->structType(); } |
| 3270 | bool isOutline() const { return typeDef_->structType().hasOOL(); } |
| 3271 | bool zeroFields() const { return zeroFields_; } |
| 3272 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3273 | gc::AllocKind allocKind() const { return typeDef_->structType().allocKind_; } |
| 3274 | }; |
| 3275 | |
| 3276 | // Represents the contents of all fields of a wasm struct. |
| 3277 | // This class will be used for scalar replacement of wasm structs. |
| 3278 | class MWasmStructState : public TempObject { |
| 3279 | private: |
| 3280 | MWasmNewStructObject* wasmStruct_; |
| 3281 | // Represents the fields of this struct. |
| 3282 | Vector<MDefinition*, 0, JitAllocPolicy> fields_; |
| 3283 | |
| 3284 | explicit MWasmStructState(TempAllocator& alloc, |
| 3285 | MWasmNewStructObject* structObject) |
| 3286 | : wasmStruct_(structObject), fields_(alloc) {} |
| 3287 | |
| 3288 | // Init the fields_ vector. |
| 3289 | [[nodiscard]] bool init(TempAllocator& alloc); |
| 3290 | |
| 3291 | public: |
| 3292 | static MWasmStructState* New(TempAllocator& alloc, |
| 3293 | MWasmNewStructObject* structObject); |
| 3294 | static MWasmStructState* Copy(TempAllocator& alloc, MWasmStructState* state); |
| 3295 | |
| 3296 | size_t numFields() const { return fields_.length(); } |
| 3297 | MWasmNewStructObject* wasmStruct() const { return wasmStruct_; } |
| 3298 | |
| 3299 | // Get the field value based on the position of the field in the struct. |
| 3300 | MDefinition* getField(uint32_t index) const { return fields_[index]; } |
| 3301 | // Set the field offset based on the position of the field in the struct. |
| 3302 | void setField(uint32_t index, MDefinition* def) { fields_[index] = def; } |
| 3303 | }; |
| 3304 | |
| 3305 | class MWasmNewArrayObject : public MTernaryInstruction, |
| 3306 | public NoTypePolicy::Data { |
| 3307 | private: |
| 3308 | const wasm::TypeDef* typeDef_; |
| 3309 | bool zeroFields_; |
| 3310 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3311 | |
| 3312 | MWasmNewArrayObject(MDefinition* instance, MDefinition* numElements, |
| 3313 | MDefinition* allocSite, const wasm::TypeDef* typeDef, |
| 3314 | bool zeroFields, const wasm::TrapSiteDesc& trapSiteDesc) |
| 3315 | : MTernaryInstruction(classOpcode, instance, numElements, allocSite), |
| 3316 | typeDef_(typeDef), |
| 3317 | zeroFields_(zeroFields), |
| 3318 | trapSiteDesc_(trapSiteDesc) { |
| 3319 | MOZ_ASSERT(typeDef->isArrayType())do { static_assert( mozilla::detail::AssertionConditionType< decltype(typeDef->isArrayType())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(typeDef->isArrayType()))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("typeDef->isArrayType()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3319); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "typeDef->isArrayType()" ")"); do { MOZ_CrashSequence (__null, 3319); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3320 | setResultType(MIRType::WasmAnyRef); |
| 3321 | setWasmRefType( |
| 3322 | wasm::MaybeRefType(wasm::RefType::fromTypeDef(typeDef_, false))); |
| 3323 | } |
| 3324 | |
| 3325 | public: |
| 3326 | INSTRUCTION_HEADER(WasmNewArrayObject) |
| 3327 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3328 | NAMED_OPERANDS((0, instance), (1, numElements), (2, allocSite))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } static constexpr size_t numElementsOperand = 1; MDefinition* numElements() const { return getOperand(1) ; } static constexpr size_t allocSiteOperand = 2; MDefinition * allocSite() const { return getOperand(2); } |
| 3329 | |
| 3330 | AliasSet getAliasSet() const override { |
| 3331 | if (js::SupportDifferentialTesting()) { |
| 3332 | // Consider allocations effectful for differential testing. |
| 3333 | return MDefinition::getAliasSet(); |
| 3334 | } |
| 3335 | return AliasSet::None(); |
| 3336 | } |
| 3337 | const wasm::TypeDef& typeDef() { return *typeDef_; } |
| 3338 | const wasm::ArrayType& arrayType() const { return typeDef_->arrayType(); } |
| 3339 | uint32_t elemSize() const { |
| 3340 | return typeDef_->arrayType().elementType().size(); |
| 3341 | } |
| 3342 | bool zeroFields() const { return zeroFields_; } |
| 3343 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3344 | }; |
| 3345 | |
| 3346 | // High 64 bits of I128 add/sub |
| 3347 | class MWasmAddSubI128HI64 : public MQuaternaryInstruction, |
| 3348 | public NoTypePolicy::Data { |
| 3349 | bool isAdd_; |
| 3350 | |
| 3351 | MWasmAddSubI128HI64(MDefinition* lhsLo, MDefinition* lhsHi, |
| 3352 | MDefinition* rhsLo, MDefinition* rhsHi, bool isAdd) |
| 3353 | : MQuaternaryInstruction(classOpcode, lhsLo, lhsHi, rhsLo, rhsHi), |
| 3354 | isAdd_(isAdd) { |
| 3355 | MOZ_ASSERT(lhsLo->type() == MIRType::Int64)do { static_assert( mozilla::detail::AssertionConditionType< decltype(lhsLo->type() == MIRType::Int64)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(lhsLo->type() == MIRType:: Int64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("lhsLo->type() == MIRType::Int64", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 3355); AnnotateMozCrashReason("MOZ_ASSERT" "(" "lhsLo->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3355); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3356 | MOZ_ASSERT(lhsHi->type() == MIRType::Int64)do { static_assert( mozilla::detail::AssertionConditionType< decltype(lhsHi->type() == MIRType::Int64)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(lhsHi->type() == MIRType:: Int64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("lhsHi->type() == MIRType::Int64", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 3356); AnnotateMozCrashReason("MOZ_ASSERT" "(" "lhsHi->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3356); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3357 | MOZ_ASSERT(rhsLo->type() == MIRType::Int64)do { static_assert( mozilla::detail::AssertionConditionType< decltype(rhsLo->type() == MIRType::Int64)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(rhsLo->type() == MIRType:: Int64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("rhsLo->type() == MIRType::Int64", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 3357); AnnotateMozCrashReason("MOZ_ASSERT" "(" "rhsLo->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3357); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3358 | MOZ_ASSERT(rhsHi->type() == MIRType::Int64)do { static_assert( mozilla::detail::AssertionConditionType< decltype(rhsHi->type() == MIRType::Int64)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(rhsHi->type() == MIRType:: Int64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("rhsHi->type() == MIRType::Int64", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 3358); AnnotateMozCrashReason("MOZ_ASSERT" "(" "rhsHi->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3358); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3359 | setMovable(); |
| 3360 | setResultType(MIRType::Int64); |
| 3361 | } |
| 3362 | |
| 3363 | public: |
| 3364 | INSTRUCTION_HEADER(WasmAddSubI128HI64) |
| 3365 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3366 | NAMED_OPERANDS((0, lhsLo), (1, lhsHi), (2, rhsLo), (3, rhsHi))static constexpr size_t lhsLoOperand = 0; MDefinition* lhsLo( ) const { return getOperand(0); } static constexpr size_t lhsHiOperand = 1; MDefinition* lhsHi() const { return getOperand(1); } static constexpr size_t rhsLoOperand = 2; MDefinition* rhsLo() const { return getOperand(2); } static constexpr size_t rhsHiOperand = 3; MDefinition* rhsHi() const { return getOperand(3); } |
| 3367 | |
| 3368 | bool isAdd() const { return isAdd_; } |
| 3369 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3370 | bool congruentTo(const MDefinition* ins) const override { |
| 3371 | return ins->isWasmAddSubI128HI64() && congruentIfOperandsEqual(ins) && |
| 3372 | ins->toWasmAddSubI128HI64()->isAdd() == isAdd(); |
| 3373 | } |
| 3374 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3375 | |
| 3376 | #ifdef JS_JITSPEW1 |
| 3377 | void getExtras(ExtrasCollector* extras) const override { |
| 3378 | char buf[96]; |
| 3379 | SprintfLiteral(buf, "(operation=%s)", isAdd_ ? "ADD" : "SUB"); |
| 3380 | extras->add(buf); |
| 3381 | } |
| 3382 | #endif |
| 3383 | |
| 3384 | ALLOW_CLONE(MWasmAddSubI128HI64)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3384); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3384); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmAddSubI128HI64(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 3385 | }; |
| 3386 | |
| 3387 | // High 64 bits of widening I64 x I64 -> I128 multiply |
| 3388 | class MWasmMulI64WideHI64 : public MBinaryInstruction, |
| 3389 | public NoTypePolicy::Data { |
| 3390 | bool isSigned_; |
| 3391 | |
| 3392 | MWasmMulI64WideHI64(MDefinition* lhs, MDefinition* rhs, bool isSigned) |
| 3393 | : MBinaryInstruction(classOpcode, lhs, rhs), isSigned_(isSigned) { |
| 3394 | MOZ_ASSERT(lhs->type() == MIRType::Int64)do { static_assert( mozilla::detail::AssertionConditionType< decltype(lhs->type() == MIRType::Int64)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(lhs->type() == MIRType::Int64 ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "lhs->type() == MIRType::Int64", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 3394); AnnotateMozCrashReason("MOZ_ASSERT" "(" "lhs->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3394); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3395 | MOZ_ASSERT(rhs->type() == MIRType::Int64)do { static_assert( mozilla::detail::AssertionConditionType< decltype(rhs->type() == MIRType::Int64)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(rhs->type() == MIRType::Int64 ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "rhs->type() == MIRType::Int64", "/root/firefox-clang/js/src/jit/MIR-wasm.h" , 3395); AnnotateMozCrashReason("MOZ_ASSERT" "(" "rhs->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3395); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3396 | setMovable(); |
| 3397 | setCommutative(); |
| 3398 | setResultType(MIRType::Int64); |
| 3399 | } |
| 3400 | |
| 3401 | public: |
| 3402 | INSTRUCTION_HEADER(WasmMulI64WideHI64) |
| 3403 | TRIVIAL_NEW_WRAPPERStemplate <typename... Args> static MThisOpcode* New(TempAllocator & alloc, Args&&... args) { return new (alloc) MThisOpcode (std::forward<Args>(args)...); } template <typename... Args> static MThisOpcode* New(TempAllocator::Fallible alloc , Args&&... args) { return new (alloc) MThisOpcode(std ::forward<Args>(args)...); } |
| 3404 | NAMED_OPERANDS((0, lhs), (1, rhs))static constexpr size_t lhsOperand = 0; MDefinition* lhs() const { return getOperand(0); } static constexpr size_t rhsOperand = 1; MDefinition* rhs() const { return getOperand(1); } |
| 3405 | |
| 3406 | bool isSigned() const { return isSigned_; } |
| 3407 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3408 | bool congruentTo(const MDefinition* ins) const override { |
| 3409 | return ins->isWasmMulI64WideHI64() && congruentIfOperandsEqual(ins) && |
| 3410 | ins->toWasmMulI64WideHI64()->isSigned() == isSigned(); |
| 3411 | } |
| 3412 | |
| 3413 | #ifdef JS_JITSPEW1 |
| 3414 | void getExtras(ExtrasCollector* extras) const override { |
| 3415 | char buf[96]; |
| 3416 | SprintfLiteral(buf, "(mode=%s)", isSigned_ ? "SIGNED" : "UNSIGNED"); |
| 3417 | extras->add(buf); |
| 3418 | } |
| 3419 | #endif |
| 3420 | |
| 3421 | ALLOW_CLONE(MWasmMulI64WideHI64)bool canClone() const override { return true; } MInstruction* clone(TempAllocator& alloc, const MDefinitionVector& inputs) const override { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(numOperands() == inputs. length())>::isValid, "invalid assertion condition"); if (( __builtin_expect(!!(!(!!(numOperands() == inputs.length()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("numOperands() == inputs.length()" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 3421); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3421); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); MInstruction* res = new (alloc) MWasmMulI64WideHI64(*this); if (!res) { return nullptr; } for (size_t i = 0; i < numOperands(); i++) { res ->replaceOperand(i, inputs[i]); } return res; } |
| 3422 | }; |
| 3423 | |
| 3424 | #undef INSTRUCTION_HEADER |
| 3425 | |
| 3426 | #ifdef ENABLE_WASM_SIMD1 |
| 3427 | MWasmShuffleSimd128* BuildWasmShuffleSimd128(TempAllocator& alloc, |
| 3428 | const int8_t* control, |
| 3429 | MDefinition* lhs, |
| 3430 | MDefinition* rhs); |
| 3431 | #endif // ENABLE_WASM_SIMD |
| 3432 | |
| 3433 | } // namespace jit |
| 3434 | } // namespace js |
| 3435 | |
| 3436 | #endif /* jit_MIR_wasm_h */ |