| File: | root/firefox-clang/js/src/jit/MIR-wasm.h |
| Warning: | line 598, 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_JIT_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_JIT_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_JIT_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_JIT_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_JIT_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 | class MWasmNewI31Ref : public MUnaryInstruction, public NoTypePolicy::Data { |
| 167 | explicit MWasmNewI31Ref(MDefinition* input) |
| 168 | : MUnaryInstruction(classOpcode, input) { |
| 169 | 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" , 169); AnnotateMozCrashReason("MOZ_ASSERT" "(" "input->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 169); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 170 | setResultType(MIRType::WasmAnyRef); |
| 171 | setMovable(); |
| 172 | setWasmRefType(wasm::MaybeRefType(wasm::RefType::i31().asNonNullable())); |
| 173 | } |
| 174 | |
| 175 | public: |
| 176 | INSTRUCTION_HEADER(WasmNewI31Ref) |
| 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 | bool congruentTo(const MDefinition* ins) const override { |
| 180 | return congruentIfOperandsEqual(ins); |
| 181 | } |
| 182 | |
| 183 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 184 | }; |
| 185 | |
| 186 | // The same as MWasmTruncateToInt64 but with the Instance dependency. |
| 187 | // It used only for arm now because on arm we need to call builtin to truncate |
| 188 | // to i64. |
| 189 | class MWasmBuiltinTruncateToInt64 : public MAryInstruction<2>, |
| 190 | public NoTypePolicy::Data { |
| 191 | TruncFlags flags_; |
| 192 | wasm::TrapSiteDesc trapSiteDesc_; |
| 193 | |
| 194 | MWasmBuiltinTruncateToInt64(MDefinition* def, MDefinition* instance, |
| 195 | TruncFlags flags, |
| 196 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 197 | : MAryInstruction(classOpcode), |
| 198 | flags_(flags), |
| 199 | trapSiteDesc_(trapSiteDesc) { |
| 200 | initOperand(0, def); |
| 201 | initOperand(1, instance); |
| 202 | |
| 203 | setResultType(MIRType::Int64); |
| 204 | setGuard(); // neither removable nor movable because of possible |
| 205 | // side-effects. |
| 206 | } |
| 207 | |
| 208 | public: |
| 209 | INSTRUCTION_HEADER(WasmBuiltinTruncateToInt64) |
| 210 | 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); }; |
| 211 | 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)...); } |
| 212 | |
| 213 | bool isUnsigned() const { return flags_ & TRUNC_UNSIGNED; } |
| 214 | bool isSaturating() const { return flags_ & TRUNC_SATURATING; } |
| 215 | TruncFlags flags() const { return flags_; } |
| 216 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 217 | |
| 218 | bool congruentTo(const MDefinition* ins) const override { |
| 219 | return congruentIfOperandsEqual(ins) && |
| 220 | ins->toWasmBuiltinTruncateToInt64()->flags() == flags_; |
| 221 | } |
| 222 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 223 | }; |
| 224 | |
| 225 | class MWasmTruncateToInt64 : public MUnaryInstruction, |
| 226 | public NoTypePolicy::Data { |
| 227 | TruncFlags flags_; |
| 228 | wasm::TrapSiteDesc trapSiteDesc_; |
| 229 | |
| 230 | MWasmTruncateToInt64(MDefinition* def, TruncFlags flags, |
| 231 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 232 | : MUnaryInstruction(classOpcode, def), |
| 233 | flags_(flags), |
| 234 | trapSiteDesc_(trapSiteDesc) { |
| 235 | setResultType(MIRType::Int64); |
| 236 | setGuard(); // neither removable nor movable because of possible |
| 237 | // side-effects. |
| 238 | } |
| 239 | |
| 240 | public: |
| 241 | INSTRUCTION_HEADER(WasmTruncateToInt64) |
| 242 | 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)...); } |
| 243 | |
| 244 | bool isUnsigned() const { return flags_ & TRUNC_UNSIGNED; } |
| 245 | bool isSaturating() const { return flags_ & TRUNC_SATURATING; } |
| 246 | TruncFlags flags() const { return flags_; } |
| 247 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 248 | |
| 249 | bool congruentTo(const MDefinition* ins) const override { |
| 250 | return congruentIfOperandsEqual(ins) && |
| 251 | ins->toWasmTruncateToInt64()->flags() == flags_; |
| 252 | } |
| 253 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 254 | }; |
| 255 | |
| 256 | // Truncate a value to an int32, with wasm semantics: this will trap when the |
| 257 | // value is out of range. |
| 258 | class MWasmTruncateToInt32 : public MUnaryInstruction, |
| 259 | public NoTypePolicy::Data { |
| 260 | TruncFlags flags_; |
| 261 | wasm::TrapSiteDesc trapSiteDesc_; |
| 262 | |
| 263 | explicit MWasmTruncateToInt32(MDefinition* def, TruncFlags flags, |
| 264 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 265 | : MUnaryInstruction(classOpcode, def), |
| 266 | flags_(flags), |
| 267 | trapSiteDesc_(trapSiteDesc) { |
| 268 | setResultType(MIRType::Int32); |
| 269 | setGuard(); // neither removable nor movable because of possible |
| 270 | // side-effects. |
| 271 | } |
| 272 | |
| 273 | public: |
| 274 | INSTRUCTION_HEADER(WasmTruncateToInt32) |
| 275 | 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)...); } |
| 276 | |
| 277 | bool isUnsigned() const { return flags_ & TRUNC_UNSIGNED; } |
| 278 | bool isSaturating() const { return flags_ & TRUNC_SATURATING; } |
| 279 | TruncFlags flags() const { return flags_; } |
| 280 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 281 | |
| 282 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 283 | |
| 284 | bool congruentTo(const MDefinition* ins) const override { |
| 285 | return congruentIfOperandsEqual(ins) && |
| 286 | ins->toWasmTruncateToInt32()->flags() == flags_; |
| 287 | } |
| 288 | |
| 289 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 290 | }; |
| 291 | |
| 292 | // It is like MTruncateToInt32 but with instance dependency. |
| 293 | class MWasmBuiltinTruncateToInt32 : public MAryInstruction<2>, |
| 294 | public ToInt32Policy::Data { |
| 295 | wasm::TrapSiteDesc trapSiteDesc_; |
| 296 | |
| 297 | MWasmBuiltinTruncateToInt32( |
| 298 | MDefinition* def, MDefinition* instance, |
| 299 | wasm::TrapSiteDesc trapSiteDesc = wasm::TrapSiteDesc()) |
| 300 | : MAryInstruction(classOpcode), trapSiteDesc_(trapSiteDesc) { |
| 301 | initOperand(0, def); |
| 302 | initOperand(1, instance); |
| 303 | setResultType(MIRType::Int32); |
| 304 | setMovable(); |
| 305 | |
| 306 | // Guard unless the conversion is known to be non-effectful & non-throwing. |
| 307 | if (MTruncateToInt32::mightHaveSideEffects(def)) { |
| 308 | setGuard(); |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | public: |
| 313 | INSTRUCTION_HEADER(WasmBuiltinTruncateToInt32) |
| 314 | 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); } |
| 315 | 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)...); } |
| 316 | |
| 317 | bool congruentTo(const MDefinition* ins) const override { |
| 318 | return congruentIfOperandsEqual(ins); |
| 319 | } |
| 320 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 321 | |
| 322 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 323 | |
| 324 | 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", 324); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 324); __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; } |
| 325 | }; |
| 326 | |
| 327 | class MWasmBuiltinDivI64 : public MAryInstruction<3>, public ArithPolicy::Data { |
| 328 | bool canBeNegativeZero_; |
| 329 | bool canBeNegativeOverflow_; |
| 330 | bool canBeDivideByZero_; |
| 331 | bool canBeNegativeDividend_; |
| 332 | bool unsigned_; // If false, signedness will be derived from operands |
| 333 | bool trapOnError_; |
| 334 | wasm::TrapSiteDesc trapSiteDesc_; |
| 335 | |
| 336 | MWasmBuiltinDivI64(MDefinition* left, MDefinition* right, |
| 337 | MDefinition* instance) |
| 338 | : MAryInstruction(classOpcode), |
| 339 | canBeNegativeZero_(true), |
| 340 | canBeNegativeOverflow_(true), |
| 341 | canBeDivideByZero_(true), |
| 342 | canBeNegativeDividend_(true), |
| 343 | unsigned_(false), |
| 344 | trapOnError_(false) { |
| 345 | initOperand(0, left); |
| 346 | initOperand(1, right); |
| 347 | initOperand(2, instance); |
| 348 | |
| 349 | setResultType(MIRType::Int64); |
| 350 | setMovable(); |
| 351 | } |
| 352 | |
| 353 | public: |
| 354 | INSTRUCTION_HEADER(WasmBuiltinDivI64) |
| 355 | |
| 356 | 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); } |
| 357 | |
| 358 | static MWasmBuiltinDivI64* New( |
| 359 | TempAllocator& alloc, MDefinition* left, MDefinition* right, |
| 360 | MDefinition* instance, bool unsignd, bool trapOnError = false, |
| 361 | wasm::TrapSiteDesc trapSiteDesc = wasm::TrapSiteDesc()) { |
| 362 | auto* wasm64Div = new (alloc) MWasmBuiltinDivI64(left, right, instance); |
| 363 | wasm64Div->unsigned_ = unsignd; |
| 364 | wasm64Div->trapOnError_ = trapOnError; |
| 365 | wasm64Div->trapSiteDesc_ = trapSiteDesc; |
| 366 | if (trapOnError) { |
| 367 | wasm64Div->setGuard(); // not removable because of possible side-effects. |
| 368 | wasm64Div->setNotMovable(); |
| 369 | } |
| 370 | return wasm64Div; |
| 371 | } |
| 372 | |
| 373 | bool canBeNegativeZero() const { return canBeNegativeZero_; } |
| 374 | void setCanBeNegativeZero(bool negativeZero) { |
| 375 | canBeNegativeZero_ = negativeZero; |
| 376 | } |
| 377 | |
| 378 | bool canBeNegativeOverflow() const { return canBeNegativeOverflow_; } |
| 379 | |
| 380 | bool canBeDivideByZero() const { return canBeDivideByZero_; } |
| 381 | |
| 382 | bool canBeNegativeDividend() const { |
| 383 | // "Dividend" is an ambiguous concept for unsigned truncated |
| 384 | // division, because of the truncation procedure: |
| 385 | // ((x>>>0)/2)|0, for example, gets transformed in |
| 386 | // MWasmDiv::truncate into a node with lhs representing x (not |
| 387 | // x>>>0) and rhs representing the constant 2; in other words, |
| 388 | // the MIR node corresponds to "cast operands to unsigned and |
| 389 | // divide" operation. In this case, is the dividend x or is it |
| 390 | // x>>>0? In order to resolve such ambiguities, we disallow |
| 391 | // the usage of this method for unsigned division. |
| 392 | 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" , 392); AnnotateMozCrashReason("MOZ_ASSERT" "(" "!unsigned_" ")" ); do { MOZ_CrashSequence(__null, 392); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 393 | return canBeNegativeDividend_; |
| 394 | } |
| 395 | |
| 396 | bool isUnsigned() const { return unsigned_; } |
| 397 | |
| 398 | bool trapOnError() const { return trapOnError_; } |
| 399 | const wasm::TrapSiteDesc& trapSiteDesc() const { |
| 400 | 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", 400); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "trapSiteDesc_.isValid()" ")"); do { MOZ_CrashSequence (__null, 400); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); |
| 401 | return trapSiteDesc_; |
| 402 | } |
| 403 | |
| 404 | 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", 404); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 404); __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; } |
| 405 | }; |
| 406 | |
| 407 | class MWasmBuiltinModD : public MAryInstruction<3>, public ArithPolicy::Data { |
| 408 | wasm::BytecodeOffset bytecodeOffset_; |
| 409 | |
| 410 | MWasmBuiltinModD(MDefinition* left, MDefinition* right, MDefinition* instance, |
| 411 | MIRType type) |
| 412 | : MAryInstruction(classOpcode) { |
| 413 | initOperand(0, left); |
| 414 | initOperand(1, right); |
| 415 | initOperand(2, instance); |
| 416 | |
| 417 | setResultType(type); |
| 418 | setMovable(); |
| 419 | } |
| 420 | |
| 421 | public: |
| 422 | INSTRUCTION_HEADER(WasmBuiltinModD) |
| 423 | 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); } |
| 424 | |
| 425 | static MWasmBuiltinModD* New( |
| 426 | TempAllocator& alloc, MDefinition* left, MDefinition* right, |
| 427 | MDefinition* instance, MIRType type, |
| 428 | wasm::BytecodeOffset bytecodeOffset = wasm::BytecodeOffset()) { |
| 429 | auto* wasmBuiltinModD = |
| 430 | new (alloc) MWasmBuiltinModD(left, right, instance, type); |
| 431 | wasmBuiltinModD->bytecodeOffset_ = bytecodeOffset; |
| 432 | return wasmBuiltinModD; |
| 433 | } |
| 434 | |
| 435 | wasm::BytecodeOffset bytecodeOffset() const { |
| 436 | 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", 436); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "bytecodeOffset_.isValid()" ")"); do { MOZ_CrashSequence (__null, 436); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); |
| 437 | return bytecodeOffset_; |
| 438 | } |
| 439 | |
| 440 | 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", 440); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 440); __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; } |
| 441 | }; |
| 442 | |
| 443 | class MWasmBuiltinModI64 : public MAryInstruction<3>, public ArithPolicy::Data { |
| 444 | bool unsigned_; // If false, signedness will be derived from operands |
| 445 | bool canBeNegativeDividend_; |
| 446 | bool canBeDivideByZero_; |
| 447 | bool trapOnError_; |
| 448 | wasm::TrapSiteDesc trapSiteDesc_; |
| 449 | |
| 450 | MWasmBuiltinModI64(MDefinition* left, MDefinition* right, |
| 451 | MDefinition* instance) |
| 452 | : MAryInstruction(classOpcode), |
| 453 | unsigned_(false), |
| 454 | canBeNegativeDividend_(true), |
| 455 | canBeDivideByZero_(true), |
| 456 | trapOnError_(false) { |
| 457 | initOperand(0, left); |
| 458 | initOperand(1, right); |
| 459 | initOperand(2, instance); |
| 460 | |
| 461 | setResultType(MIRType::Int64); |
| 462 | setMovable(); |
| 463 | } |
| 464 | |
| 465 | public: |
| 466 | INSTRUCTION_HEADER(WasmBuiltinModI64) |
| 467 | |
| 468 | 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); } |
| 469 | |
| 470 | static MWasmBuiltinModI64* New( |
| 471 | TempAllocator& alloc, MDefinition* left, MDefinition* right, |
| 472 | MDefinition* instance, bool unsignd, bool trapOnError = false, |
| 473 | wasm::TrapSiteDesc trapSiteDesc = wasm::TrapSiteDesc()) { |
| 474 | auto* mod = new (alloc) MWasmBuiltinModI64(left, right, instance); |
| 475 | mod->unsigned_ = unsignd; |
| 476 | mod->trapOnError_ = trapOnError; |
| 477 | mod->trapSiteDesc_ = trapSiteDesc; |
| 478 | if (trapOnError) { |
| 479 | mod->setGuard(); // not removable because of possible side-effects. |
| 480 | mod->setNotMovable(); |
| 481 | } |
| 482 | return mod; |
| 483 | } |
| 484 | |
| 485 | bool canBeNegativeDividend() const { |
| 486 | 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" , 486); AnnotateMozCrashReason("MOZ_ASSERT" "(" "!unsigned_" ")" ); do { MOZ_CrashSequence(__null, 486); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 487 | return canBeNegativeDividend_; |
| 488 | } |
| 489 | |
| 490 | bool canBeDivideByZero() const { return canBeDivideByZero_; } |
| 491 | |
| 492 | bool isUnsigned() const { return unsigned_; } |
| 493 | |
| 494 | bool trapOnError() const { return trapOnError_; } |
| 495 | const wasm::TrapSiteDesc& trapSiteDesc() const { |
| 496 | 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", 496); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "trapSiteDesc_.isValid()" ")"); do { MOZ_CrashSequence (__null, 496); __attribute__((nomerge)) ::abort(); } while (false ); } } while (false); |
| 497 | return trapSiteDesc_; |
| 498 | } |
| 499 | |
| 500 | 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", 500); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 500); __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; } |
| 501 | }; |
| 502 | |
| 503 | // Check whether we need to fire the interrupt handler (in wasm code). |
| 504 | class MWasmInterruptCheck : public MUnaryInstruction, |
| 505 | public NoTypePolicy::Data { |
| 506 | wasm::TrapSiteDesc trapSiteDesc_; |
| 507 | |
| 508 | MWasmInterruptCheck(MDefinition* instance, |
| 509 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 510 | : MUnaryInstruction(classOpcode, instance), trapSiteDesc_(trapSiteDesc) { |
| 511 | setGuard(); |
| 512 | } |
| 513 | |
| 514 | public: |
| 515 | INSTRUCTION_HEADER(WasmInterruptCheck) |
| 516 | 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)...); } |
| 517 | NAMED_OPERANDS((0, instance))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } |
| 518 | |
| 519 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 520 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 521 | |
| 522 | 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", 522); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 522); __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; } |
| 523 | }; |
| 524 | |
| 525 | // Directly jumps to the indicated trap, leaving Wasm code and reporting a |
| 526 | // runtime error. |
| 527 | |
| 528 | class MWasmTrap : public MAryControlInstruction<0, 0>, |
| 529 | public NoTypePolicy::Data { |
| 530 | wasm::Trap trap_; |
| 531 | wasm::TrapSiteDesc trapSiteDesc_; |
| 532 | |
| 533 | explicit MWasmTrap(wasm::Trap trap, const wasm::TrapSiteDesc& trapSiteDesc) |
| 534 | : MAryControlInstruction(classOpcode), |
| 535 | trap_(trap), |
| 536 | trapSiteDesc_(trapSiteDesc) {} |
| 537 | |
| 538 | public: |
| 539 | INSTRUCTION_HEADER(WasmTrap) |
| 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 | |
| 542 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 543 | |
| 544 | wasm::Trap trap() const { return trap_; } |
| 545 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 546 | }; |
| 547 | |
| 548 | // Flips the input's sign bit, independently of the rest of the number's |
| 549 | // payload. Note this is different from multiplying by minus-one, which has |
| 550 | // side-effects for e.g. NaNs. |
| 551 | class MWasmNeg : public MUnaryInstruction, public NoTypePolicy::Data { |
| 552 | MWasmNeg(MDefinition* op, MIRType type) : MUnaryInstruction(classOpcode, op) { |
| 553 | setResultType(type); |
| 554 | setMovable(); |
| 555 | } |
| 556 | |
| 557 | public: |
| 558 | INSTRUCTION_HEADER(WasmNeg) |
| 559 | 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)...); } |
| 560 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 561 | 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", 561); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 561); __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; } |
| 562 | }; |
| 563 | |
| 564 | // Machine-level bitwise AND/OR/XOR, avoiding all JS-level complexity embodied |
| 565 | // in MBinaryBitwiseInstruction. |
| 566 | class MWasmBinaryBitwise : public MBinaryInstruction, |
| 567 | public NoTypePolicy::Data { |
| 568 | public: |
| 569 | enum class SubOpcode { And, Or, Xor }; |
| 570 | |
| 571 | protected: |
| 572 | MWasmBinaryBitwise(MDefinition* left, MDefinition* right, MIRType type, |
| 573 | SubOpcode subOpcode) |
| 574 | : MBinaryInstruction(classOpcode, left, right), subOpcode_(subOpcode) { |
| 575 | 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", 575); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type == MIRType::Int32 || type == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 575); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 576 | setResultType(type); |
| 577 | setMovable(); |
| 578 | setCommutative(); |
| 579 | } |
| 580 | |
| 581 | public: |
| 582 | INSTRUCTION_HEADER(WasmBinaryBitwise) |
| 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 | |
| 585 | SubOpcode subOpcode() const { return subOpcode_; } |
| 586 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 587 | |
| 588 | bool congruentTo(const MDefinition* ins) const override { |
| 589 | return ins->isWasmBinaryBitwise() && |
| 590 | ins->toWasmBinaryBitwise()->subOpcode() == subOpcode() && |
| 591 | binaryCongruentTo(ins); |
| 592 | } |
| 593 | |
| 594 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 595 | |
| 596 | #ifdef JS_JITSPEW1 |
| 597 | void getExtras(ExtrasCollector* extras) const override { |
| 598 | const char* what = "!!unknown!!"; |
Value stored to 'what' during its initialization is never read | |
| 599 | switch (subOpcode()) { |
| 600 | case SubOpcode::And: |
| 601 | what = "And"; |
| 602 | break; |
| 603 | case SubOpcode::Or: |
| 604 | what = "Or"; |
| 605 | break; |
| 606 | case SubOpcode::Xor: |
| 607 | what = "Xor"; |
| 608 | break; |
| 609 | } |
| 610 | extras->add(what); |
| 611 | } |
| 612 | #endif |
| 613 | |
| 614 | private: |
| 615 | SubOpcode subOpcode_; |
| 616 | |
| 617 | 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", 617); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 617); __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; } |
| 618 | }; |
| 619 | |
| 620 | class MWasmLoadInstance : public MUnaryInstruction, public NoTypePolicy::Data { |
| 621 | uint32_t offset_; |
| 622 | AliasSet aliases_; |
| 623 | |
| 624 | explicit MWasmLoadInstance(MDefinition* instance, uint32_t offset, |
| 625 | MIRType type, AliasSet aliases) |
| 626 | : MUnaryInstruction(classOpcode, instance), |
| 627 | offset_(offset), |
| 628 | aliases_(aliases) { |
| 629 | // Different instance data have different alias classes and only those |
| 630 | // classes are allowed. |
| 631 | 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", 636); 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, 636); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 632 | 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", 636); 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, 636); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 633 | 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", 636); 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, 636); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 634 | 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", 636); 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, 636); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 635 | 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", 636); 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, 636); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 636 | 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", 636); 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, 636); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 637 | |
| 638 | // The only types supported at the moment. |
| 639 | 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", 640); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef" ")"); do { MOZ_CrashSequence(__null, 640); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 640 | 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", 640); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type == MIRType::Pointer || type == MIRType::Int32 || type == MIRType::Int64 || type == MIRType::WasmAnyRef" ")"); do { MOZ_CrashSequence(__null, 640); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 641 | |
| 642 | setMovable(); |
| 643 | setResultType(type); |
| 644 | } |
| 645 | |
| 646 | public: |
| 647 | INSTRUCTION_HEADER(WasmLoadInstance) |
| 648 | 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)...); } |
| 649 | NAMED_OPERANDS((0, instance))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } |
| 650 | |
| 651 | uint32_t offset() const { return offset_; } |
| 652 | |
| 653 | bool congruentTo(const MDefinition* ins) const override { |
| 654 | return op() == ins->op() && |
| 655 | offset() == ins->toWasmLoadInstance()->offset() && |
| 656 | type() == ins->type(); |
| 657 | } |
| 658 | |
| 659 | HashNumber valueHash() const override { |
| 660 | HashNumber hash = MUnaryInstruction::valueHash(); |
| 661 | hash = addU32ToHash(hash, offset()); |
| 662 | return hash; |
| 663 | } |
| 664 | |
| 665 | AliasSet getAliasSet() const override { return aliases_; } |
| 666 | }; |
| 667 | |
| 668 | class MWasmHeapReg : public MNullaryInstruction { |
| 669 | AliasSet aliases_; |
| 670 | |
| 671 | explicit MWasmHeapReg(AliasSet aliases) |
| 672 | : MNullaryInstruction(classOpcode), aliases_(aliases) { |
| 673 | setMovable(); |
| 674 | setResultType(MIRType::Pointer); |
| 675 | } |
| 676 | |
| 677 | public: |
| 678 | INSTRUCTION_HEADER(WasmHeapReg) |
| 679 | 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)...); } |
| 680 | |
| 681 | bool congruentTo(const MDefinition* ins) const override { |
| 682 | return ins->isWasmHeapReg(); |
| 683 | } |
| 684 | |
| 685 | AliasSet getAliasSet() const override { return aliases_; } |
| 686 | }; |
| 687 | |
| 688 | // For memory32, bounds check nodes are of type Int32 on 32-bit systems and |
| 689 | // on 64-bit systems for wasm code that is known to have a bounds check limit |
| 690 | // that fits into 32 bits. |
| 691 | // They are of type Int64 only on 64-bit systems for wasm code with 4GB heaps. |
| 692 | // There is no way for nodes of both types to be present in the same function. |
| 693 | // Should this change, then BCE must be updated to take type into account. |
| 694 | // |
| 695 | // For memory64, bounds check nodes are always of type Int64. |
| 696 | |
| 697 | class MWasmBoundsCheck : public MBinaryInstruction, public NoTypePolicy::Data { |
| 698 | public: |
| 699 | enum Target { |
| 700 | // If using the following options, `targetIndex` must be specified. |
| 701 | Memory, |
| 702 | Table, |
| 703 | // Arrays in the GC proposal. `targetIndex` should not be used; the |
| 704 | // bounds check limit is a load of the array's numElements field. |
| 705 | Array, |
| 706 | // Everything else. If using this, targetIndex should not be used. |
| 707 | Other, |
| 708 | }; |
| 709 | |
| 710 | private: |
| 711 | wasm::TrapSiteDesc trapSiteDesc_; |
| 712 | Target target_; |
| 713 | uint32_t targetIndex_; |
| 714 | |
| 715 | explicit MWasmBoundsCheck(MDefinition* index, MDefinition* boundsCheckLimit, |
| 716 | const wasm::TrapSiteDesc& trapSiteDesc, |
| 717 | Target target, uint32_t targetIndex = UINT32_MAX(4294967295U)) |
| 718 | : MBinaryInstruction(classOpcode, index, boundsCheckLimit), |
| 719 | trapSiteDesc_(trapSiteDesc), |
| 720 | target_(target), |
| 721 | targetIndex_(targetIndex) { |
| 722 | 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", 722); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "index->type() == boundsCheckLimit->type()" ")"); do { MOZ_CrashSequence(__null, 722); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 723 | 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" , 724); AnnotateMozCrashReason("MOZ_ASSERT" "(" "targetIndex != (4294967295U)" ")"); do { MOZ_CrashSequence(__null, 724); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
| 724 | 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" , 724); AnnotateMozCrashReason("MOZ_ASSERT" "(" "targetIndex != (4294967295U)" ")"); do { MOZ_CrashSequence(__null, 724); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
| 725 | MOZ_ASSERT_IF(target == Array || target == Other,do { if (target == Array || 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" , 726); AnnotateMozCrashReason("MOZ_ASSERT" "(" "targetIndex == (4294967295U)" ")"); do { MOZ_CrashSequence(__null, 726); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
| 726 | targetIndex == UINT32_MAX)do { if (target == Array || 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" , 726); AnnotateMozCrashReason("MOZ_ASSERT" "(" "targetIndex == (4294967295U)" ")"); do { MOZ_CrashSequence(__null, 726); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
| 727 | |
| 728 | // Bounds check is effectful: it throws for OOB. |
| 729 | setGuard(); |
| 730 | |
| 731 | if (JitOptions.spectreIndexMasking) { |
| 732 | setResultType(index->type()); |
| 733 | } |
| 734 | } |
| 735 | |
| 736 | public: |
| 737 | INSTRUCTION_HEADER(WasmBoundsCheck) |
| 738 | 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)...); } |
| 739 | 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); } |
| 740 | |
| 741 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 742 | |
| 743 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 744 | Target target() const { return target_; } |
| 745 | uint32_t targetIndex() const { return targetIndex_; } |
| 746 | |
| 747 | bool isRedundant() const { return !isGuard(); } |
| 748 | void setRedundant() { setNotGuard(); } |
| 749 | |
| 750 | bool congruentTo(const MDefinition* ins) const override { |
| 751 | return congruentIfOperandsEqual(ins) && |
| 752 | ins->toWasmBoundsCheck()->target() == target() && |
| 753 | ins->toWasmBoundsCheck()->targetIndex() == targetIndex(); |
| 754 | } |
| 755 | |
| 756 | 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", 756); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 756); __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; } |
| 757 | }; |
| 758 | |
| 759 | class MWasmAddOffset : public MUnaryInstruction, public NoTypePolicy::Data { |
| 760 | uint64_t offset_; |
| 761 | wasm::TrapSiteDesc trapSiteDesc_; |
| 762 | |
| 763 | MWasmAddOffset(MDefinition* base, uint64_t offset, |
| 764 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 765 | : MUnaryInstruction(classOpcode, base), |
| 766 | offset_(offset), |
| 767 | trapSiteDesc_(trapSiteDesc) { |
| 768 | setGuard(); |
| 769 | 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", 770); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::Int32 || base->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 770); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 770 | 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", 770); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::Int32 || base->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 770); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 771 | setResultType(base->type()); |
| 772 | } |
| 773 | |
| 774 | public: |
| 775 | INSTRUCTION_HEADER(WasmAddOffset) |
| 776 | 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)...); } |
| 777 | NAMED_OPERANDS((0, base))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } |
| 778 | |
| 779 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 780 | |
| 781 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 782 | |
| 783 | uint64_t offset() const { return offset_; } |
| 784 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 785 | }; |
| 786 | |
| 787 | class MWasmAlignmentCheck : public MUnaryInstruction, |
| 788 | public NoTypePolicy::Data { |
| 789 | uint32_t byteSize_; |
| 790 | wasm::TrapSiteDesc trapSiteDesc_; |
| 791 | |
| 792 | explicit MWasmAlignmentCheck(MDefinition* index, uint32_t byteSize, |
| 793 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 794 | : MUnaryInstruction(classOpcode, index), |
| 795 | byteSize_(byteSize), |
| 796 | trapSiteDesc_(trapSiteDesc) { |
| 797 | 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" , 797); AnnotateMozCrashReason("MOZ_ASSERT" "(" "std::has_single_bit(byteSize)" ")"); do { MOZ_CrashSequence(__null, 797); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 798 | // Alignment check is effectful: it throws for unaligned. |
| 799 | setGuard(); |
| 800 | } |
| 801 | |
| 802 | public: |
| 803 | INSTRUCTION_HEADER(WasmAlignmentCheck) |
| 804 | 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)...); } |
| 805 | NAMED_OPERANDS((0, index))static constexpr size_t indexOperand = 0; MDefinition* index( ) const { return getOperand(0); } |
| 806 | |
| 807 | bool congruentTo(const MDefinition* ins) const override; |
| 808 | |
| 809 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 810 | |
| 811 | uint32_t byteSize() const { return byteSize_; } |
| 812 | |
| 813 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 814 | |
| 815 | 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", 815); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 815); __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; } |
| 816 | }; |
| 817 | |
| 818 | class MWasmLoad |
| 819 | : public MVariadicInstruction, // memoryBase is nullptr on some platforms |
| 820 | public NoTypePolicy::Data { |
| 821 | wasm::MemoryAccessDesc access_; |
| 822 | |
| 823 | explicit MWasmLoad(const wasm::MemoryAccessDesc& access, MIRType resultType) |
| 824 | : MVariadicInstruction(classOpcode), access_(access) { |
| 825 | setGuard(); |
| 826 | setResultType(resultType); |
| 827 | } |
| 828 | |
| 829 | public: |
| 830 | INSTRUCTION_HEADER(WasmLoad) |
| 831 | 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); }; |
| 832 | |
| 833 | static MWasmLoad* New(TempAllocator& alloc, MDefinition* memoryBase, |
| 834 | MDefinition* base, const wasm::MemoryAccessDesc& access, |
| 835 | MIRType resultType) { |
| 836 | MWasmLoad* load = new (alloc) MWasmLoad(access, resultType); |
| 837 | if (!load->init(alloc, 1 + !!memoryBase)) { |
| 838 | return nullptr; |
| 839 | } |
| 840 | |
| 841 | load->initOperand(0, base); |
| 842 | if (memoryBase) { |
| 843 | load->initOperand(1, memoryBase); |
| 844 | } |
| 845 | |
| 846 | return load; |
| 847 | } |
| 848 | |
| 849 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 850 | |
| 851 | AliasSet getAliasSet() const override { |
| 852 | // When a barrier is needed, make the instruction effectful by giving |
| 853 | // it a "store" effect. |
| 854 | if (access_.isAtomic()) { |
| 855 | return AliasSet::Store(AliasSet::WasmHeap); |
| 856 | } |
| 857 | return AliasSet::Load(AliasSet::WasmHeap); |
| 858 | } |
| 859 | |
| 860 | bool hasMemoryBase() const { return numOperands() > 1; } |
| 861 | |
| 862 | #ifdef JS_JITSPEW1 |
| 863 | void getExtras(ExtrasCollector* extras) const override { |
| 864 | char buf[64]; |
| 865 | SprintfLiteral(buf, "(offs=%lld)", (long long int)access().offset64()); |
| 866 | extras->add(buf); |
| 867 | } |
| 868 | #endif |
| 869 | |
| 870 | // Unfortunately we cannot use ALLOW_CLONE here, due to the variable number |
| 871 | // of operands. |
| 872 | bool canClone() const override { return true; } |
| 873 | MInstruction* clone(TempAllocator& alloc, |
| 874 | const MDefinitionVector& inputs) const override { |
| 875 | MInstruction* res = |
| 876 | MWasmLoad::New(alloc, hasMemoryBase() ? memoryBase() : nullptr, base(), |
| 877 | access(), type()); |
| 878 | if (!res) { |
| 879 | return nullptr; |
| 880 | } |
| 881 | for (size_t i = 0; i < numOperands(); i++) { |
| 882 | res->replaceOperand(i, inputs[i]); |
| 883 | } |
| 884 | return res; |
| 885 | } |
| 886 | }; |
| 887 | |
| 888 | class MWasmStore : public MVariadicInstruction, public NoTypePolicy::Data { |
| 889 | wasm::MemoryAccessDesc access_; |
| 890 | |
| 891 | explicit MWasmStore(const wasm::MemoryAccessDesc& access) |
| 892 | : MVariadicInstruction(classOpcode), access_(access) { |
| 893 | setGuard(); |
| 894 | } |
| 895 | |
| 896 | public: |
| 897 | INSTRUCTION_HEADER(WasmStore) |
| 898 | 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); } |
| 899 | |
| 900 | static MWasmStore* New(TempAllocator& alloc, MDefinition* memoryBase, |
| 901 | MDefinition* base, |
| 902 | const wasm::MemoryAccessDesc& access, |
| 903 | MDefinition* value) { |
| 904 | MWasmStore* store = new (alloc) MWasmStore(access); |
| 905 | if (!store->init(alloc, 2 + !!memoryBase)) { |
| 906 | return nullptr; |
| 907 | } |
| 908 | |
| 909 | store->initOperand(0, base); |
| 910 | store->initOperand(1, value); |
| 911 | if (memoryBase) { |
| 912 | store->initOperand(2, memoryBase); |
| 913 | } |
| 914 | |
| 915 | return store; |
| 916 | } |
| 917 | |
| 918 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 919 | |
| 920 | AliasSet getAliasSet() const override { |
| 921 | return AliasSet::Store(AliasSet::WasmHeap); |
| 922 | } |
| 923 | |
| 924 | bool hasMemoryBase() const { return numOperands() > 2; } |
| 925 | |
| 926 | #ifdef JS_JITSPEW1 |
| 927 | void getExtras(ExtrasCollector* extras) const override { |
| 928 | char buf[64]; |
| 929 | SprintfLiteral(buf, "(offs=%lld)", (long long int)access().offset64()); |
| 930 | extras->add(buf); |
| 931 | } |
| 932 | #endif |
| 933 | |
| 934 | bool canClone() const override { return true; } |
| 935 | MInstruction* clone(TempAllocator& alloc, |
| 936 | const MDefinitionVector& inputs) const override { |
| 937 | MInstruction* res = |
| 938 | MWasmStore::New(alloc, hasMemoryBase() ? memoryBase() : nullptr, base(), |
| 939 | access(), value()); |
| 940 | if (!res) { |
| 941 | return nullptr; |
| 942 | } |
| 943 | for (size_t i = 0; i < numOperands(); i++) { |
| 944 | res->replaceOperand(i, inputs[i]); |
| 945 | } |
| 946 | return res; |
| 947 | } |
| 948 | }; |
| 949 | |
| 950 | class MWasmCompareExchangeHeap : public MVariadicInstruction, |
| 951 | public NoTypePolicy::Data { |
| 952 | wasm::MemoryAccessDesc access_; |
| 953 | wasm::BytecodeOffset bytecodeOffset_; |
| 954 | |
| 955 | explicit MWasmCompareExchangeHeap(const wasm::MemoryAccessDesc& access, |
| 956 | wasm::BytecodeOffset bytecodeOffset) |
| 957 | : MVariadicInstruction(classOpcode), |
| 958 | access_(access), |
| 959 | bytecodeOffset_(bytecodeOffset) { |
| 960 | setGuard(); // Not removable |
| 961 | setResultType(ScalarTypeToMIRType(access.type())); |
| 962 | } |
| 963 | |
| 964 | public: |
| 965 | INSTRUCTION_HEADER(WasmCompareExchangeHeap) |
| 966 | 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); } |
| 967 | (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); } |
| 968 | |
| 969 | static MWasmCompareExchangeHeap* New(TempAllocator& alloc, |
| 970 | wasm::BytecodeOffset bytecodeOffset, |
| 971 | MDefinition* memoryBase, |
| 972 | MDefinition* base, |
| 973 | const wasm::MemoryAccessDesc& access, |
| 974 | MDefinition* oldv, MDefinition* newv, |
| 975 | MDefinition* instance) { |
| 976 | MWasmCompareExchangeHeap* cas = |
| 977 | new (alloc) MWasmCompareExchangeHeap(access, bytecodeOffset); |
| 978 | if (!cas->init(alloc, 4 + !!memoryBase)) { |
| 979 | return nullptr; |
| 980 | } |
| 981 | cas->initOperand(0, base); |
| 982 | cas->initOperand(1, oldv); |
| 983 | cas->initOperand(2, newv); |
| 984 | cas->initOperand(3, instance); |
| 985 | if (memoryBase) { |
| 986 | cas->initOperand(4, memoryBase); |
| 987 | } |
| 988 | return cas; |
| 989 | } |
| 990 | |
| 991 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 992 | wasm::BytecodeOffset bytecodeOffset() const { return bytecodeOffset_; } |
| 993 | |
| 994 | AliasSet getAliasSet() const override { |
| 995 | return AliasSet::Store(AliasSet::WasmHeap); |
| 996 | } |
| 997 | |
| 998 | bool hasMemoryBase() const { return numOperands() > 4; } |
| 999 | }; |
| 1000 | |
| 1001 | class MWasmAtomicExchangeHeap : public MVariadicInstruction, |
| 1002 | public NoTypePolicy::Data { |
| 1003 | wasm::MemoryAccessDesc access_; |
| 1004 | wasm::BytecodeOffset bytecodeOffset_; |
| 1005 | |
| 1006 | explicit MWasmAtomicExchangeHeap(const wasm::MemoryAccessDesc& access, |
| 1007 | wasm::BytecodeOffset bytecodeOffset) |
| 1008 | : MVariadicInstruction(classOpcode), |
| 1009 | access_(access), |
| 1010 | bytecodeOffset_(bytecodeOffset) { |
| 1011 | setGuard(); // Not removable |
| 1012 | setResultType(ScalarTypeToMIRType(access.type())); |
| 1013 | } |
| 1014 | |
| 1015 | public: |
| 1016 | INSTRUCTION_HEADER(WasmAtomicExchangeHeap) |
| 1017 | 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); } |
| 1018 | |
| 1019 | static MWasmAtomicExchangeHeap* New(TempAllocator& alloc, |
| 1020 | wasm::BytecodeOffset bytecodeOffset, |
| 1021 | MDefinition* memoryBase, |
| 1022 | MDefinition* base, |
| 1023 | const wasm::MemoryAccessDesc& access, |
| 1024 | MDefinition* value, |
| 1025 | MDefinition* instance) { |
| 1026 | MWasmAtomicExchangeHeap* xchg = |
| 1027 | new (alloc) MWasmAtomicExchangeHeap(access, bytecodeOffset); |
| 1028 | if (!xchg->init(alloc, 3 + !!memoryBase)) { |
| 1029 | return nullptr; |
| 1030 | } |
| 1031 | |
| 1032 | xchg->initOperand(0, base); |
| 1033 | xchg->initOperand(1, value); |
| 1034 | xchg->initOperand(2, instance); |
| 1035 | if (memoryBase) { |
| 1036 | xchg->initOperand(3, memoryBase); |
| 1037 | } |
| 1038 | |
| 1039 | return xchg; |
| 1040 | } |
| 1041 | |
| 1042 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 1043 | wasm::BytecodeOffset bytecodeOffset() const { return bytecodeOffset_; } |
| 1044 | |
| 1045 | AliasSet getAliasSet() const override { |
| 1046 | return AliasSet::Store(AliasSet::WasmHeap); |
| 1047 | } |
| 1048 | |
| 1049 | bool hasMemoryBase() const { return numOperands() > 3; } |
| 1050 | }; |
| 1051 | |
| 1052 | class MWasmAtomicBinopHeap : public MVariadicInstruction, |
| 1053 | public NoTypePolicy::Data { |
| 1054 | AtomicOp op_; |
| 1055 | wasm::MemoryAccessDesc access_; |
| 1056 | wasm::BytecodeOffset bytecodeOffset_; |
| 1057 | |
| 1058 | explicit MWasmAtomicBinopHeap(AtomicOp op, |
| 1059 | const wasm::MemoryAccessDesc& access, |
| 1060 | wasm::BytecodeOffset bytecodeOffset) |
| 1061 | : MVariadicInstruction(classOpcode), |
| 1062 | op_(op), |
| 1063 | access_(access), |
| 1064 | bytecodeOffset_(bytecodeOffset) { |
| 1065 | setGuard(); // Not removable |
| 1066 | setResultType(ScalarTypeToMIRType(access.type())); |
| 1067 | } |
| 1068 | |
| 1069 | public: |
| 1070 | INSTRUCTION_HEADER(WasmAtomicBinopHeap) |
| 1071 | 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); } |
| 1072 | |
| 1073 | static MWasmAtomicBinopHeap* New(TempAllocator& alloc, |
| 1074 | wasm::BytecodeOffset bytecodeOffset, |
| 1075 | AtomicOp op, MDefinition* memoryBase, |
| 1076 | MDefinition* base, |
| 1077 | const wasm::MemoryAccessDesc& access, |
| 1078 | MDefinition* v, MDefinition* instance) { |
| 1079 | MWasmAtomicBinopHeap* binop = |
| 1080 | new (alloc) MWasmAtomicBinopHeap(op, access, bytecodeOffset); |
| 1081 | if (!binop->init(alloc, 3 + !!memoryBase)) { |
| 1082 | return nullptr; |
| 1083 | } |
| 1084 | |
| 1085 | binop->initOperand(0, base); |
| 1086 | binop->initOperand(1, v); |
| 1087 | binop->initOperand(2, instance); |
| 1088 | if (memoryBase) { |
| 1089 | binop->initOperand(3, memoryBase); |
| 1090 | } |
| 1091 | |
| 1092 | return binop; |
| 1093 | } |
| 1094 | |
| 1095 | AtomicOp operation() const { return op_; } |
| 1096 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 1097 | wasm::BytecodeOffset bytecodeOffset() const { return bytecodeOffset_; } |
| 1098 | |
| 1099 | AliasSet getAliasSet() const override { |
| 1100 | return AliasSet::Store(AliasSet::WasmHeap); |
| 1101 | } |
| 1102 | |
| 1103 | bool hasMemoryBase() const { return numOperands() > 3; } |
| 1104 | }; |
| 1105 | |
| 1106 | class MWasmLoadInstanceDataField : public MUnaryInstruction, |
| 1107 | public NoTypePolicy::Data { |
| 1108 | unsigned instanceDataOffset_; |
| 1109 | bool isConstant_; |
| 1110 | |
| 1111 | MWasmLoadInstanceDataField( |
| 1112 | MIRType type, unsigned instanceDataOffset, bool isConstant, |
| 1113 | MDefinition* instance, |
| 1114 | wasm::MaybeRefType maybeRefType = wasm::MaybeRefType()) |
| 1115 | : MUnaryInstruction(classOpcode, instance), |
| 1116 | instanceDataOffset_(instanceDataOffset), |
| 1117 | isConstant_(isConstant) { |
| 1118 | 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", 1119); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "IsNumberType(type) || type == MIRType::Simd128 || type == MIRType::Pointer || type == MIRType::WasmAnyRef" ")"); do { MOZ_CrashSequence(__null, 1119); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 1119 | 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", 1119); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "IsNumberType(type) || type == MIRType::Simd128 || type == MIRType::Pointer || type == MIRType::WasmAnyRef" ")"); do { MOZ_CrashSequence(__null, 1119); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1120 | setResultType(type); |
| 1121 | setMovable(); |
| 1122 | setWasmRefType(maybeRefType); |
| 1123 | } |
| 1124 | |
| 1125 | public: |
| 1126 | INSTRUCTION_HEADER(WasmLoadInstanceDataField) |
| 1127 | 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)...); } |
| 1128 | NAMED_OPERANDS((0, instance))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } |
| 1129 | |
| 1130 | unsigned instanceDataOffset() const { return instanceDataOffset_; } |
| 1131 | |
| 1132 | HashNumber valueHash() const override; |
| 1133 | bool congruentTo(const MDefinition* ins) const override; |
| 1134 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 1135 | |
| 1136 | AliasSet getAliasSet() const override { |
| 1137 | return isConstant_ ? AliasSet::None() |
| 1138 | : AliasSet::Load(AliasSet::WasmInstanceData); |
| 1139 | } |
| 1140 | |
| 1141 | AliasType mightAlias(const MDefinition* def) const override; |
| 1142 | |
| 1143 | #ifdef JS_JITSPEW1 |
| 1144 | void getExtras(ExtrasCollector* extras) const override { |
| 1145 | char buf[96]; |
| 1146 | SprintfLiteral(buf, "(offs=%lld, isConst=%s)", |
| 1147 | (long long int)instanceDataOffset_, |
| 1148 | isConstant_ ? "true" : "false"); |
| 1149 | extras->add(buf); |
| 1150 | } |
| 1151 | #endif |
| 1152 | |
| 1153 | 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", 1153); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1153); __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; } |
| 1154 | }; |
| 1155 | |
| 1156 | // Fetch 64 bits of data from a specified byte offset inside |
| 1157 | // Instance::baselineScratchWords_. The low 32 bits are read from |
| 1158 | // [offset .. offset+3] and the upper 32 bits from [offset+4 .. offset+7], |
| 1159 | // regardless of the endianness of the host. However, each 32-bit unit is |
| 1160 | // loaded using the host's own endianness. See also |
| 1161 | // MWasmStoreInstanceScratch2xI32, and comments on Instance::addSubI128. |
| 1162 | class MWasmLoadInstanceScratch2xI32 : public MUnaryInstruction, |
| 1163 | public NoTypePolicy::Data { |
| 1164 | uint32_t byteOffset_; |
| 1165 | |
| 1166 | MWasmLoadInstanceScratch2xI32(uint32_t byteOffset, MDefinition* instance) |
| 1167 | : MUnaryInstruction(classOpcode, instance), byteOffset_(byteOffset) { |
| 1168 | 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", 1168); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords()" ")"); do { MOZ_CrashSequence(__null, 1168); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1169 | 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", 1169); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "instance->type() == MIRType::Pointer" ")" ); do { MOZ_CrashSequence(__null, 1169); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1170 | setResultType(MIRType::Int64); |
| 1171 | setMovable(); |
| 1172 | } |
| 1173 | |
| 1174 | public: |
| 1175 | INSTRUCTION_HEADER(WasmLoadInstanceScratch2xI32) |
| 1176 | 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)...); } |
| 1177 | NAMED_OPERANDS((0, instance))static constexpr size_t instanceOperand = 0; MDefinition* instance () const { return getOperand(0); } |
| 1178 | |
| 1179 | uint32_t byteOffset() const { return byteOffset_; } |
| 1180 | |
| 1181 | AliasSet getAliasSet() const override { |
| 1182 | return AliasSet::Load(AliasSet::WasmInstanceScratchWords); |
| 1183 | } |
| 1184 | |
| 1185 | bool congruentTo(const MDefinition* ins) const override { |
| 1186 | return ins->isWasmLoadInstanceScratch2xI32() && |
| 1187 | congruentIfOperandsEqual(ins) && |
| 1188 | ins->toWasmLoadInstanceScratch2xI32()->byteOffset() == byteOffset(); |
| 1189 | } |
| 1190 | |
| 1191 | #ifdef JS_JITSPEW1 |
| 1192 | void getExtras(ExtrasCollector* extras) const override { |
| 1193 | char buf[96]; |
| 1194 | SprintfLiteral(buf, "(byteOffset=%u)", byteOffset_); |
| 1195 | extras->add(buf); |
| 1196 | } |
| 1197 | #endif |
| 1198 | |
| 1199 | 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", 1199); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1199); __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; } |
| 1200 | }; |
| 1201 | |
| 1202 | class MWasmLoadGlobalCell : public MUnaryInstruction, |
| 1203 | public NoTypePolicy::Data { |
| 1204 | MWasmLoadGlobalCell(MIRType type, MDefinition* cellPtr, |
| 1205 | wasm::ValType globalType) |
| 1206 | : MUnaryInstruction(classOpcode, cellPtr) { |
| 1207 | setResultType(type); |
| 1208 | setMovable(); |
| 1209 | setWasmRefType(globalType.toMaybeRefType()); |
| 1210 | } |
| 1211 | |
| 1212 | public: |
| 1213 | INSTRUCTION_HEADER(WasmLoadGlobalCell) |
| 1214 | 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)...); } |
| 1215 | NAMED_OPERANDS((0, cellPtr))static constexpr size_t cellPtrOperand = 0; MDefinition* cellPtr () const { return getOperand(0); } |
| 1216 | |
| 1217 | // The default valueHash is good enough, because there are no non-operand |
| 1218 | // fields. |
| 1219 | bool congruentTo(const MDefinition* ins) const override; |
| 1220 | |
| 1221 | AliasSet getAliasSet() const override { |
| 1222 | return AliasSet::Load(AliasSet::WasmGlobalCell); |
| 1223 | } |
| 1224 | |
| 1225 | AliasType mightAlias(const MDefinition* def) const override; |
| 1226 | |
| 1227 | 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", 1227); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1227); __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; } |
| 1228 | }; |
| 1229 | |
| 1230 | class MWasmLoadTableElement : public MBinaryInstruction, |
| 1231 | public NoTypePolicy::Data { |
| 1232 | MWasmLoadTableElement(MDefinition* elements, MDefinition* index, |
| 1233 | wasm::RefType refType) |
| 1234 | : MBinaryInstruction(classOpcode, elements, index) { |
| 1235 | setResultType(MIRType::WasmAnyRef); |
| 1236 | setWasmRefType(wasm::MaybeRefType(refType)); |
| 1237 | } |
| 1238 | |
| 1239 | public: |
| 1240 | INSTRUCTION_HEADER(WasmLoadTableElement) |
| 1241 | 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)...); } |
| 1242 | NAMED_OPERANDS((0, elements))static constexpr size_t elementsOperand = 0; MDefinition* elements () const { return getOperand(0); } |
| 1243 | NAMED_OPERANDS((1, index))static constexpr size_t indexOperand = 1; MDefinition* index( ) const { return getOperand(1); } |
| 1244 | |
| 1245 | AliasSet getAliasSet() const override { |
| 1246 | return AliasSet::Load(AliasSet::WasmTableElement); |
| 1247 | } |
| 1248 | }; |
| 1249 | |
| 1250 | class MWasmStoreInstanceDataField : public MBinaryInstruction, |
| 1251 | public NoTypePolicy::Data { |
| 1252 | MWasmStoreInstanceDataField(unsigned instanceDataOffset, MDefinition* value, |
| 1253 | MDefinition* instance) |
| 1254 | : MBinaryInstruction(classOpcode, value, instance), |
| 1255 | instanceDataOffset_(instanceDataOffset) {} |
| 1256 | |
| 1257 | unsigned instanceDataOffset_; |
| 1258 | |
| 1259 | public: |
| 1260 | INSTRUCTION_HEADER(WasmStoreInstanceDataField) |
| 1261 | 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)...); } |
| 1262 | 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); } |
| 1263 | |
| 1264 | unsigned instanceDataOffset() const { return instanceDataOffset_; } |
| 1265 | |
| 1266 | AliasSet getAliasSet() const override { |
| 1267 | return AliasSet::Store(AliasSet::WasmInstanceData); |
| 1268 | } |
| 1269 | }; |
| 1270 | |
| 1271 | // Store 64 bits of data at a specified byte offset inside |
| 1272 | // Instance::baselineScratchWords_. See comments on |
| 1273 | // MWasmLoadInstanceScratch2xI32 for important details. |
| 1274 | class MWasmStoreInstanceScratch2xI32 : public MBinaryInstruction, |
| 1275 | public NoTypePolicy::Data { |
| 1276 | unsigned byteOffset_; |
| 1277 | |
| 1278 | MWasmStoreInstanceScratch2xI32(uint32_t byteOffset, MDefinition* value, |
| 1279 | MDefinition* instance) |
| 1280 | : MBinaryInstruction(classOpcode, value, instance), |
| 1281 | byteOffset_(byteOffset) { |
| 1282 | 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", 1282); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "byteOffset + 8 <= wasm::Instance::sizeofBaselineScratchWords()" ")"); do { MOZ_CrashSequence(__null, 1282); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1283 | 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" , 1283); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 1283); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1284 | 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", 1284); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "instance->type() == MIRType::Pointer" ")" ); do { MOZ_CrashSequence(__null, 1284); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1285 | } |
| 1286 | |
| 1287 | public: |
| 1288 | INSTRUCTION_HEADER(WasmStoreInstanceScratch2xI32) |
| 1289 | 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)...); } |
| 1290 | 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); } |
| 1291 | |
| 1292 | unsigned byteOffset() const { return byteOffset_; } |
| 1293 | |
| 1294 | AliasSet getAliasSet() const override { |
| 1295 | return AliasSet::Store(AliasSet::WasmInstanceScratchWords); |
| 1296 | } |
| 1297 | |
| 1298 | bool congruentTo(const MDefinition* ins) const override { return false; } |
| 1299 | |
| 1300 | #ifdef JS_JITSPEW1 |
| 1301 | void getExtras(ExtrasCollector* extras) const override { |
| 1302 | char buf[96]; |
| 1303 | SprintfLiteral(buf, "(byteOffset=%u)", byteOffset_); |
| 1304 | extras->add(buf); |
| 1305 | } |
| 1306 | #endif |
| 1307 | |
| 1308 | 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", 1308); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1308); __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; } |
| 1309 | }; |
| 1310 | |
| 1311 | class MWasmStoreGlobalCell : public MBinaryInstruction, |
| 1312 | public NoTypePolicy::Data { |
| 1313 | MWasmStoreGlobalCell(MDefinition* value, MDefinition* cellPtr) |
| 1314 | : MBinaryInstruction(classOpcode, value, cellPtr) {} |
| 1315 | |
| 1316 | public: |
| 1317 | INSTRUCTION_HEADER(WasmStoreGlobalCell) |
| 1318 | 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)...); } |
| 1319 | 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); } |
| 1320 | |
| 1321 | AliasSet getAliasSet() const override { |
| 1322 | return AliasSet::Store(AliasSet::WasmGlobalCell); |
| 1323 | } |
| 1324 | |
| 1325 | 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", 1325); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1325); __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; } |
| 1326 | }; |
| 1327 | |
| 1328 | class MWasmStoreStackResult : public MBinaryInstruction, |
| 1329 | public NoTypePolicy::Data { |
| 1330 | MWasmStoreStackResult(MDefinition* stackResultArea, uint32_t offset, |
| 1331 | MDefinition* value) |
| 1332 | : MBinaryInstruction(classOpcode, stackResultArea, value), |
| 1333 | offset_(offset) {} |
| 1334 | |
| 1335 | uint32_t offset_; |
| 1336 | |
| 1337 | public: |
| 1338 | INSTRUCTION_HEADER(WasmStoreStackResult) |
| 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, 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); } |
| 1341 | |
| 1342 | uint32_t offset() const { return offset_; } |
| 1343 | |
| 1344 | AliasSet getAliasSet() const override { |
| 1345 | return AliasSet::Store(AliasSet::WasmStackResult); |
| 1346 | } |
| 1347 | }; |
| 1348 | |
| 1349 | // Represents a known-good derived pointer into an object or memory region (in |
| 1350 | // the most general sense) that will not move while the derived pointer is live. |
| 1351 | // The `offset` *must* be a valid offset into the object represented by `base`; |
| 1352 | // hence overflow in the address calculation will never be an issue. `offset` |
| 1353 | // must be representable as a 31-bit unsigned integer. |
| 1354 | // |
| 1355 | // DO NOT use this with a base value of any JS-heap-resident object type. |
| 1356 | // Such a value would need to be adjusted during GC, yet we have no mechanism |
| 1357 | // to do that. See bug 1810090. |
| 1358 | |
| 1359 | class MWasmDerivedPointer : public MUnaryInstruction, |
| 1360 | public NoTypePolicy::Data { |
| 1361 | MWasmDerivedPointer(MDefinition* base, size_t offset) |
| 1362 | : MUnaryInstruction(classOpcode, base), offset_(uint32_t(offset)) { |
| 1363 | 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", 1363); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "offset <= (2147483647)" ")"); do { MOZ_CrashSequence (__null, 1363); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1364 | // Do not change this to allow `base` to be a GC-heap allocated type. |
| 1365 | 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", 1366); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::Pointer || base->type() == TargetWordMIRType()" ")"); do { MOZ_CrashSequence(__null, 1366); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 1366 | 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", 1366); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::Pointer || base->type() == TargetWordMIRType()" ")"); do { MOZ_CrashSequence(__null, 1366); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1367 | setResultType(MIRType::Pointer); |
| 1368 | setMovable(); |
| 1369 | } |
| 1370 | |
| 1371 | uint32_t offset_; |
| 1372 | |
| 1373 | public: |
| 1374 | INSTRUCTION_HEADER(WasmDerivedPointer) |
| 1375 | 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)...); } |
| 1376 | NAMED_OPERANDS((0, base))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } |
| 1377 | |
| 1378 | uint32_t offset() const { return offset_; } |
| 1379 | |
| 1380 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1381 | |
| 1382 | HashNumber valueHash() const override { |
| 1383 | HashNumber hash = MUnaryInstruction::valueHash(); |
| 1384 | hash = addU32ToHash(hash, offset()); |
| 1385 | return hash; |
| 1386 | } |
| 1387 | bool congruentTo(const MDefinition* ins) const override { |
| 1388 | return congruentIfOperandsEqual(ins) && |
| 1389 | ins->toWasmDerivedPointer()->offset() == offset(); |
| 1390 | } |
| 1391 | |
| 1392 | #ifdef JS_JITSPEW1 |
| 1393 | void getExtras(ExtrasCollector* extras) const override { |
| 1394 | char buf[64]; |
| 1395 | SprintfLiteral(buf, "(offs=%lld)", (long long int)offset_); |
| 1396 | extras->add(buf); |
| 1397 | } |
| 1398 | #endif |
| 1399 | |
| 1400 | 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", 1400); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1400); __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; } |
| 1401 | }; |
| 1402 | |
| 1403 | // As with MWasmDerivedPointer, DO NOT use this with a base value of any |
| 1404 | // JS-heap-resident object type. |
| 1405 | class MWasmDerivedIndexPointer : public MBinaryInstruction, |
| 1406 | public NoTypePolicy::Data { |
| 1407 | MWasmDerivedIndexPointer(MDefinition* base, MDefinition* index, Scale scale) |
| 1408 | : MBinaryInstruction(classOpcode, base, index), scale_(scale) { |
| 1409 | // Do not change this to allow `base` to be a GC-heap allocated type. |
| 1410 | 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" , 1410); AnnotateMozCrashReason("MOZ_ASSERT" "(" "base->type() == MIRType::Pointer" ")"); do { MOZ_CrashSequence(__null, 1410); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1411 | setResultType(MIRType::Pointer); |
| 1412 | setMovable(); |
| 1413 | } |
| 1414 | |
| 1415 | Scale scale_; |
| 1416 | |
| 1417 | public: |
| 1418 | INSTRUCTION_HEADER(WasmDerivedIndexPointer) |
| 1419 | 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)...); } |
| 1420 | NAMED_OPERANDS((0, base))static constexpr size_t baseOperand = 0; MDefinition* base() const { return getOperand(0); } |
| 1421 | NAMED_OPERANDS((1, index))static constexpr size_t indexOperand = 1; MDefinition* index( ) const { return getOperand(1); } |
| 1422 | |
| 1423 | Scale scale() const { return scale_; } |
| 1424 | |
| 1425 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1426 | |
| 1427 | bool congruentTo(const MDefinition* ins) const override { |
| 1428 | return congruentIfOperandsEqual(ins) && |
| 1429 | ins->toWasmDerivedIndexPointer()->scale() == scale(); |
| 1430 | } |
| 1431 | |
| 1432 | 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", 1432); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1432); __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; } |
| 1433 | }; |
| 1434 | |
| 1435 | // Whether to perform a pre-write barrier for a wasm store reference. |
| 1436 | enum class WasmPreBarrierKind : uint8_t { None, Normal }; |
| 1437 | |
| 1438 | // Whether to perform a post-write barrier for a wasm store reference. |
| 1439 | enum class WasmPostBarrierKind : uint8_t { None, Edge, WholeCell }; |
| 1440 | |
| 1441 | // Stores a reference to an address. This performs a pre-barrier on the address, |
| 1442 | // but not a post-barrier. A post-barrier must be performed separately, if it's |
| 1443 | // required. The accessed location is `valueBase + valueOffset`. The latter |
| 1444 | // must be be representable as a 31-bit unsigned integer. |
| 1445 | |
| 1446 | class MWasmStoreRef : public MAryInstruction<3>, public NoTypePolicy::Data { |
| 1447 | uint32_t offset_; |
| 1448 | AliasSet::Flag aliasSet_; |
| 1449 | WasmPreBarrierKind preBarrierKind_; |
| 1450 | |
| 1451 | MWasmStoreRef(MDefinition* instance, MDefinition* valueBase, |
| 1452 | size_t valueOffset, MDefinition* value, AliasSet::Flag aliasSet, |
| 1453 | WasmPreBarrierKind preBarrierKind) |
| 1454 | : MAryInstruction<3>(classOpcode), |
| 1455 | offset_(uint32_t(valueOffset)), |
| 1456 | aliasSet_(aliasSet), |
| 1457 | preBarrierKind_(preBarrierKind) { |
| 1458 | 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" , 1458); AnnotateMozCrashReason("MOZ_ASSERT" "(" "valueOffset <= (2147483647)" ")"); do { MOZ_CrashSequence(__null, 1458); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1459 | 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", 1460); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "valueBase->type() == MIRType::Pointer || valueBase->type() == MIRType::StackResults" ")"); do { MOZ_CrashSequence(__null, 1460); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 1460 | 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", 1460); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "valueBase->type() == MIRType::Pointer || valueBase->type() == MIRType::StackResults" ")"); do { MOZ_CrashSequence(__null, 1460); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1461 | 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", 1461); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1461); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1462 | initOperand(0, instance); |
| 1463 | initOperand(1, valueBase); |
| 1464 | initOperand(2, value); |
| 1465 | } |
| 1466 | |
| 1467 | public: |
| 1468 | INSTRUCTION_HEADER(WasmStoreRef) |
| 1469 | 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)...); } |
| 1470 | 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); } |
| 1471 | |
| 1472 | uint32_t offset() const { return offset_; } |
| 1473 | AliasSet getAliasSet() const override { return AliasSet::Store(aliasSet_); } |
| 1474 | WasmPreBarrierKind preBarrierKind() const { return preBarrierKind_; } |
| 1475 | |
| 1476 | #ifdef JS_JITSPEW1 |
| 1477 | void getExtras(ExtrasCollector* extras) const override { |
| 1478 | char buf[64]; |
| 1479 | SprintfLiteral(buf, "(offs=%lld)", (long long int)offset_); |
| 1480 | extras->add(buf); |
| 1481 | } |
| 1482 | #endif |
| 1483 | }; |
| 1484 | |
| 1485 | // Given a value being written to another object, update the generational store |
| 1486 | // buffer if the value is in the nursery and object is in the tenured heap. |
| 1487 | class MWasmPostWriteBarrierWholeCell : public MTernaryInstruction, |
| 1488 | public NoTypePolicy::Data { |
| 1489 | MWasmPostWriteBarrierWholeCell(MDefinition* instance, MDefinition* object, |
| 1490 | MDefinition* value) |
| 1491 | : MTernaryInstruction(classOpcode, instance, object, value) { |
| 1492 | 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", 1492); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "object->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1492); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1493 | 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", 1493); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1493); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1494 | setGuard(); |
| 1495 | } |
| 1496 | |
| 1497 | public: |
| 1498 | INSTRUCTION_HEADER(WasmPostWriteBarrierWholeCell) |
| 1499 | 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)...); } |
| 1500 | 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); } |
| 1501 | |
| 1502 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1503 | |
| 1504 | 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", 1504); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1504); __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; } |
| 1505 | }; |
| 1506 | |
| 1507 | // Given a value being written to another object, update the generational store |
| 1508 | // buffer if the value is in the nursery and object is in the tenured heap. |
| 1509 | class MWasmPostWriteBarrierEdgeAtIndex : public MAryInstruction<5>, |
| 1510 | public NoTypePolicy::Data { |
| 1511 | uint32_t elemSize_; |
| 1512 | |
| 1513 | MWasmPostWriteBarrierEdgeAtIndex(MDefinition* instance, MDefinition* object, |
| 1514 | MDefinition* valueBase, MDefinition* index, |
| 1515 | uint32_t scale, MDefinition* value) |
| 1516 | : MAryInstruction<5>(classOpcode), elemSize_(scale) { |
| 1517 | 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", 1517); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "object->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1517); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1518 | 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", 1518); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 1518); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1519 | initOperand(0, instance); |
| 1520 | initOperand(1, object); |
| 1521 | initOperand(2, valueBase); |
| 1522 | initOperand(3, index); |
| 1523 | initOperand(4, value); |
| 1524 | setGuard(); |
| 1525 | } |
| 1526 | |
| 1527 | public: |
| 1528 | INSTRUCTION_HEADER(WasmPostWriteBarrierEdgeAtIndex) |
| 1529 | 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)...); } |
| 1530 | 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); } |
| 1531 | (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); } |
| 1532 | |
| 1533 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1534 | uint32_t elemSize() const { return elemSize_; } |
| 1535 | |
| 1536 | 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", 1536); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1536); __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 ; } |
| 1537 | }; |
| 1538 | |
| 1539 | class MWasmParameter : public MNullaryInstruction { |
| 1540 | ABIArg abi_; |
| 1541 | |
| 1542 | MWasmParameter(ABIArg abi, MIRType mirType, |
| 1543 | wasm::MaybeRefType refType = wasm::MaybeRefType()) |
| 1544 | : MNullaryInstruction(classOpcode), abi_(abi) { |
| 1545 | setResultType(mirType); |
| 1546 | setWasmRefType(refType); |
| 1547 | } |
| 1548 | |
| 1549 | public: |
| 1550 | INSTRUCTION_HEADER(WasmParameter) |
| 1551 | 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)...); } |
| 1552 | // MWasmParameter has no getAliasSet routine. Hence it acquires the default |
| 1553 | // aliases-everything setting. This doesn't matter in practice because these |
| 1554 | // nodes only appear at the start of the function's entry block, and in any |
| 1555 | // case they are not marked as movable. |
| 1556 | |
| 1557 | ABIArg abi() const { return abi_; } |
| 1558 | }; |
| 1559 | |
| 1560 | class MWasmReturn : public MAryControlInstruction<2, 0>, |
| 1561 | public NoTypePolicy::Data { |
| 1562 | MWasmReturn(MDefinition* ins, MDefinition* instance) |
| 1563 | : MAryControlInstruction(classOpcode) { |
| 1564 | initOperand(0, ins); |
| 1565 | initOperand(1, instance); |
| 1566 | } |
| 1567 | |
| 1568 | public: |
| 1569 | INSTRUCTION_HEADER(WasmReturn) |
| 1570 | 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)...); } |
| 1571 | |
| 1572 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1573 | }; |
| 1574 | |
| 1575 | class MWasmReturnVoid : public MAryControlInstruction<1, 0>, |
| 1576 | public NoTypePolicy::Data { |
| 1577 | explicit MWasmReturnVoid(MDefinition* instance) |
| 1578 | : MAryControlInstruction(classOpcode) { |
| 1579 | initOperand(0, instance); |
| 1580 | } |
| 1581 | |
| 1582 | public: |
| 1583 | INSTRUCTION_HEADER(WasmReturnVoid) |
| 1584 | 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)...); } |
| 1585 | |
| 1586 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1587 | }; |
| 1588 | |
| 1589 | class MWasmStackArg : public MUnaryInstruction, public NoTypePolicy::Data { |
| 1590 | MWasmStackArg(uint32_t spOffset, MDefinition* ins) |
| 1591 | : MUnaryInstruction(classOpcode, ins), spOffset_(spOffset) {} |
| 1592 | |
| 1593 | uint32_t spOffset_; |
| 1594 | |
| 1595 | public: |
| 1596 | INSTRUCTION_HEADER(WasmStackArg) |
| 1597 | 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)...); } |
| 1598 | NAMED_OPERANDS((0, arg))static constexpr size_t argOperand = 0; MDefinition* arg() const { return getOperand(0); } |
| 1599 | |
| 1600 | uint32_t spOffset() const { return spOffset_; } |
| 1601 | void incrementOffset(uint32_t inc) { spOffset_ += inc; } |
| 1602 | AliasSet getAliasSet() const override { |
| 1603 | return AliasSet::Store(AliasSet::Flag::Any); |
| 1604 | } |
| 1605 | |
| 1606 | 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", 1606); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 1606); __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; } |
| 1607 | }; |
| 1608 | |
| 1609 | template <typename Location> |
| 1610 | class MWasmResultBase : public MNullaryInstruction { |
| 1611 | Location loc_; |
| 1612 | |
| 1613 | protected: |
| 1614 | MWasmResultBase(Opcode op, MIRType type, Location loc) |
| 1615 | : MNullaryInstruction(op), loc_(loc) { |
| 1616 | setResultType(type); |
| 1617 | setCallResultCapture(); |
| 1618 | } |
| 1619 | |
| 1620 | public: |
| 1621 | Location loc() { return loc_; } |
| 1622 | }; |
| 1623 | |
| 1624 | class MWasmRegisterResult : public MWasmResultBase<Register> { |
| 1625 | MWasmRegisterResult(MIRType type, Register reg, |
| 1626 | wasm::MaybeRefType maybeRefType = wasm::MaybeRefType()) |
| 1627 | : MWasmResultBase(classOpcode, type, reg) { |
| 1628 | setWasmRefType(maybeRefType); |
| 1629 | } |
| 1630 | |
| 1631 | public: |
| 1632 | INSTRUCTION_HEADER(WasmRegisterResult) |
| 1633 | 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)...); } |
| 1634 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1635 | }; |
| 1636 | |
| 1637 | class MWasmFloatRegisterResult : public MWasmResultBase<FloatRegister> { |
| 1638 | MWasmFloatRegisterResult(MIRType type, FloatRegister reg) |
| 1639 | : MWasmResultBase(classOpcode, type, reg) {} |
| 1640 | |
| 1641 | public: |
| 1642 | INSTRUCTION_HEADER(WasmFloatRegisterResult) |
| 1643 | 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)...); } |
| 1644 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1645 | }; |
| 1646 | |
| 1647 | class MWasmSystemFloatRegisterResult : public MWasmResultBase<FloatRegister> { |
| 1648 | MWasmSystemFloatRegisterResult(MIRType type, FloatRegister reg, bool hardFP) |
| 1649 | : MWasmResultBase(classOpcode, type, reg), hardFP_(hardFP) {} |
| 1650 | |
| 1651 | bool hardFP_; |
| 1652 | |
| 1653 | public: |
| 1654 | INSTRUCTION_HEADER(WasmSystemFloatRegisterResult) |
| 1655 | 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)...); } |
| 1656 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1657 | |
| 1658 | bool hardFP() const { return hardFP_; } |
| 1659 | }; |
| 1660 | |
| 1661 | class MWasmRegister64Result : public MWasmResultBase<Register64> { |
| 1662 | explicit MWasmRegister64Result(Register64 reg) |
| 1663 | : MWasmResultBase(classOpcode, MIRType::Int64, reg) {} |
| 1664 | |
| 1665 | public: |
| 1666 | INSTRUCTION_HEADER(WasmRegister64Result) |
| 1667 | 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)...); } |
| 1668 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1669 | }; |
| 1670 | |
| 1671 | class MWasmStackResultArea : public MNullaryInstruction { |
| 1672 | public: |
| 1673 | class StackResult { |
| 1674 | // Offset in bytes from lowest address of stack result area. |
| 1675 | uint32_t offset_ = 0; |
| 1676 | MIRType type_; |
| 1677 | |
| 1678 | public: |
| 1679 | StackResult() : type_(MIRType::Undefined) {} |
| 1680 | StackResult(uint32_t offset, MIRType type) : offset_(offset), type_(type) {} |
| 1681 | |
| 1682 | bool initialized() const { return type_ != MIRType::Undefined; } |
| 1683 | uint32_t offset() const { |
| 1684 | 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", 1684); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "initialized()" ")"); do { MOZ_CrashSequence (__null, 1684); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1685 | return offset_; |
| 1686 | } |
| 1687 | MIRType type() const { |
| 1688 | 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", 1688); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "initialized()" ")"); do { MOZ_CrashSequence (__null, 1688); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1689 | return type_; |
| 1690 | } |
| 1691 | uint32_t endOffset() const { |
| 1692 | return offset() + wasm::MIRTypeToABIResultSize(type()); |
| 1693 | } |
| 1694 | }; |
| 1695 | |
| 1696 | private: |
| 1697 | FixedList<StackResult> results_; |
| 1698 | uint32_t base_; |
| 1699 | |
| 1700 | explicit MWasmStackResultArea() |
| 1701 | : MNullaryInstruction(classOpcode), base_(UINT32_MAX(4294967295U)) { |
| 1702 | setResultType(MIRType::StackResults); |
| 1703 | } |
| 1704 | |
| 1705 | void assertInitialized() const { |
| 1706 | #ifdef DEBUG1 |
| 1707 | for (size_t i = 0; i < results_.length(); i++) { |
| 1708 | 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", 1708); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "results_[i].initialized()" ")"); do { MOZ_CrashSequence (__null, 1708); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1709 | } |
| 1710 | #endif |
| 1711 | } |
| 1712 | |
| 1713 | bool baseInitialized() const { return base_ != UINT32_MAX(4294967295U); } |
| 1714 | |
| 1715 | public: |
| 1716 | INSTRUCTION_HEADER(WasmStackResultArea) |
| 1717 | 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)...); } |
| 1718 | |
| 1719 | [[nodiscard]] bool init(TempAllocator& alloc, size_t stackResultCount) { |
| 1720 | 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", 1720); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "results_.length() == 0" ")"); do { MOZ_CrashSequence (__null, 1720); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1721 | if (!results_.init(alloc, stackResultCount)) { |
| 1722 | return false; |
| 1723 | } |
| 1724 | for (size_t n = 0; n < stackResultCount; n++) { |
| 1725 | results_[n] = StackResult(); |
| 1726 | } |
| 1727 | return true; |
| 1728 | } |
| 1729 | |
| 1730 | size_t resultCount() const { return results_.length(); } |
| 1731 | const StackResult& result(size_t n) const { |
| 1732 | 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", 1732); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "results_[n].initialized()" ")"); do { MOZ_CrashSequence (__null, 1732); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1733 | return results_[n]; |
| 1734 | } |
| 1735 | void initResult(size_t n, const StackResult& loc) { |
| 1736 | 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", 1736); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!results_[n].initialized()" ")"); do { MOZ_CrashSequence (__null, 1736); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1737 | 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" , 1737); AnnotateMozCrashReason("MOZ_ASSERT" "(" "(n == 0) == (loc.offset() == 0)" ")"); do { MOZ_CrashSequence(__null, 1737); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1738 | 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", 1738); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "loc.offset() >= result(n - 1).endOffset()" ")"); do { MOZ_CrashSequence(__null, 1738); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
| 1739 | results_[n] = loc; |
| 1740 | } |
| 1741 | |
| 1742 | uint32_t byteSize() const { |
| 1743 | assertInitialized(); |
| 1744 | if (resultCount() == 0) { |
| 1745 | return 0; |
| 1746 | } |
| 1747 | return result(resultCount() - 1).endOffset(); |
| 1748 | } |
| 1749 | |
| 1750 | // Stack index indicating base of stack area. |
| 1751 | uint32_t base() const { |
| 1752 | 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", 1752); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "baseInitialized()" ")"); do { MOZ_CrashSequence (__null, 1752); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1753 | return base_; |
| 1754 | } |
| 1755 | void setBase(uint32_t base) { |
| 1756 | 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", 1756); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!baseInitialized()" ")"); do { MOZ_CrashSequence (__null, 1756); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1757 | base_ = base; |
| 1758 | 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", 1758); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "baseInitialized()" ")"); do { MOZ_CrashSequence (__null, 1758); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1759 | } |
| 1760 | }; |
| 1761 | |
| 1762 | class MWasmStackResult : public MUnaryInstruction, public NoTypePolicy::Data { |
| 1763 | uint32_t resultIdx_; |
| 1764 | |
| 1765 | MWasmStackResult(MWasmStackResultArea* resultArea, size_t idx) |
| 1766 | : MUnaryInstruction(classOpcode, resultArea), resultIdx_(idx) { |
| 1767 | setResultType(result().type()); |
| 1768 | setCallResultCapture(); |
| 1769 | } |
| 1770 | |
| 1771 | public: |
| 1772 | INSTRUCTION_HEADER(WasmStackResult) |
| 1773 | 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)...); } |
| 1774 | NAMED_OPERANDS((0, resultArea))static constexpr size_t resultAreaOperand = 0; MDefinition* resultArea () const { return getOperand(0); } |
| 1775 | |
| 1776 | const MWasmStackResultArea::StackResult& result() const { |
| 1777 | return resultArea()->toWasmStackResultArea()->result(resultIdx_); |
| 1778 | } |
| 1779 | }; |
| 1780 | |
| 1781 | // Mixin class for wasm calls that may or may not be catchable. |
| 1782 | class MWasmCallBase { |
| 1783 | public: |
| 1784 | struct Arg { |
| 1785 | AnyRegister reg; |
| 1786 | MDefinition* def; |
| 1787 | Arg(AnyRegister reg, MDefinition* def) : reg(reg), def(def) {} |
| 1788 | }; |
| 1789 | using Args = Vector<Arg, 8, SystemAllocPolicy>; |
| 1790 | |
| 1791 | protected: |
| 1792 | wasm::CallSiteDesc desc_; |
| 1793 | wasm::CalleeDesc callee_; |
| 1794 | wasm::FailureMode builtinMethodFailureMode_; |
| 1795 | wasm::Trap builtinMethodFailureTrap_; |
| 1796 | FixedList<AnyRegister> argRegs_; |
| 1797 | uint32_t stackArgAreaSizeUnaligned_; |
| 1798 | ABIArg instanceArg_; |
| 1799 | bool inTry_; |
| 1800 | size_t tryNoteIndex_; |
| 1801 | |
| 1802 | MWasmCallBase(const wasm::CallSiteDesc& desc, const wasm::CalleeDesc& callee, |
| 1803 | uint32_t stackArgAreaSizeUnaligned, bool inTry, |
| 1804 | size_t tryNoteIndex) |
| 1805 | : desc_(desc), |
| 1806 | callee_(callee), |
| 1807 | builtinMethodFailureMode_(wasm::FailureMode::Infallible), |
| 1808 | stackArgAreaSizeUnaligned_(stackArgAreaSizeUnaligned), |
| 1809 | inTry_(inTry), |
| 1810 | tryNoteIndex_(tryNoteIndex) {} |
| 1811 | |
| 1812 | template <class MVariadicT> |
| 1813 | [[nodiscard]] bool initWithArgs(TempAllocator& alloc, MVariadicT* ins, |
| 1814 | const Args& args, |
| 1815 | MDefinition* tableAddressOrRef) { |
| 1816 | if (!argRegs_.init(alloc, args.length())) { |
| 1817 | return false; |
| 1818 | } |
| 1819 | for (size_t i = 0; i < argRegs_.length(); i++) { |
| 1820 | argRegs_[i] = args[i].reg; |
| 1821 | } |
| 1822 | |
| 1823 | if (!ins->init(alloc, argRegs_.length() + (tableAddressOrRef ? 1 : 0))) { |
| 1824 | return false; |
| 1825 | } |
| 1826 | // FixedList doesn't initialize its elements, so do an unchecked init. |
| 1827 | for (size_t i = 0; i < argRegs_.length(); i++) { |
| 1828 | ins->initOperand(i, args[i].def); |
| 1829 | } |
| 1830 | if (tableAddressOrRef) { |
| 1831 | ins->initOperand(argRegs_.length(), tableAddressOrRef); |
| 1832 | } |
| 1833 | return true; |
| 1834 | } |
| 1835 | |
| 1836 | public: |
| 1837 | static bool IsWasmCall(MDefinition* def) { |
| 1838 | return def->isWasmCallCatchable() || def->isWasmCallUncatchable() || |
| 1839 | def->isWasmReturnCall(); |
| 1840 | } |
| 1841 | |
| 1842 | size_t numArgs() const { return argRegs_.length(); } |
| 1843 | AnyRegister registerForArg(size_t index) const { |
| 1844 | 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", 1844); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "index < numArgs()" ")"); do { MOZ_CrashSequence (__null, 1844); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 1845 | return argRegs_[index]; |
| 1846 | } |
| 1847 | const wasm::CallSiteDesc& desc() const { return desc_; } |
| 1848 | const wasm::CalleeDesc& callee() const { return callee_; } |
| 1849 | wasm::FailureMode builtinMethodFailureMode() const { |
| 1850 | 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", 1850); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod" ")"); do { MOZ_CrashSequence(__null, 1850); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1851 | return builtinMethodFailureMode_; |
| 1852 | } |
| 1853 | wasm::Trap builtinMethodFailureTrap() const { |
| 1854 | 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", 1854); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "callee_.which() == wasm::CalleeDesc::BuiltinInstanceMethod" ")"); do { MOZ_CrashSequence(__null, 1854); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 1855 | return builtinMethodFailureTrap_; |
| 1856 | } |
| 1857 | uint32_t stackArgAreaSizeUnaligned() const { |
| 1858 | return stackArgAreaSizeUnaligned_; |
| 1859 | } |
| 1860 | |
| 1861 | const ABIArg& instanceArg() const { return instanceArg_; } |
| 1862 | |
| 1863 | bool inTry() const { return inTry_; } |
| 1864 | size_t tryNoteIndex() const { return tryNoteIndex_; } |
| 1865 | |
| 1866 | static AliasSet wasmCallAliasSet() { |
| 1867 | // This is ok because: |
| 1868 | // - numElements is immutable |
| 1869 | // - the GC will rewrite any array or struct data pointers on move |
| 1870 | AliasSet exclude = AliasSet(AliasSet::WasmArrayNumElements) | |
| 1871 | AliasSet(AliasSet::WasmArrayDataPointer) | |
| 1872 | AliasSet(AliasSet::WasmStructOutlineDataPointer); |
| 1873 | return AliasSet::Store(AliasSet::Any) & ~exclude; |
| 1874 | } |
| 1875 | }; |
| 1876 | |
| 1877 | // A wasm call that is catchable. This instruction is a control instruction, |
| 1878 | // and terminates the block it is on. A normal return will proceed in a the |
| 1879 | // fallthrough block. An exceptional return will unwind into the landing pad |
| 1880 | // block for this call. The landing pad block must begin with an |
| 1881 | // MWasmCallLandingPrePad. |
| 1882 | class MWasmCallCatchable final : public MVariadicControlInstruction<2>, |
| 1883 | public MWasmCallBase, |
| 1884 | public NoTypePolicy::Data { |
| 1885 | MWasmCallCatchable(const wasm::CallSiteDesc& desc, |
| 1886 | const wasm::CalleeDesc& callee, |
| 1887 | uint32_t stackArgAreaSizeUnaligned, size_t tryNoteIndex) |
| 1888 | : MVariadicControlInstruction(classOpcode), |
| 1889 | MWasmCallBase(desc, callee, stackArgAreaSizeUnaligned, true, |
| 1890 | tryNoteIndex) {} |
| 1891 | |
| 1892 | public: |
| 1893 | INSTRUCTION_HEADER(WasmCallCatchable) |
| 1894 | |
| 1895 | static MWasmCallCatchable* New( |
| 1896 | TempAllocator& alloc, const wasm::CallSiteDesc& desc, |
| 1897 | const wasm::CalleeDesc& callee, const Args& args, |
| 1898 | uint32_t stackArgAreaSizeUnaligned, uint32_t tryNoteIndex, |
| 1899 | MBasicBlock* fallthroughBlock, MBasicBlock* prePadBlock, |
| 1900 | MDefinition* tableAddressOrRef = nullptr); |
| 1901 | |
| 1902 | static MWasmCallCatchable* NewBuiltinInstanceMethodCall( |
| 1903 | TempAllocator& alloc, const wasm::CallSiteDesc& desc, |
| 1904 | const wasm::SymbolicAddress builtin, wasm::FailureMode failureMode, |
| 1905 | wasm::Trap failureTrap, const ABIArg& instanceArg, const Args& args, |
| 1906 | uint32_t stackArgAreaSizeUnaligned, uint32_t tryNoteIndex, |
| 1907 | MBasicBlock* fallthroughBlock, MBasicBlock* prePadBlock); |
| 1908 | |
| 1909 | bool possiblyCalls() const override { return true; } |
| 1910 | AliasSet getAliasSet() const override { return wasmCallAliasSet(); } |
| 1911 | |
| 1912 | static const size_t FallthroughBranchIndex = 0; |
| 1913 | static const size_t PrePadBranchIndex = 1; |
| 1914 | }; |
| 1915 | |
| 1916 | // A wasm call that is not catchable. This instruction is not a control |
| 1917 | // instruction, and therefore is not a block terminator. |
| 1918 | class MWasmCallUncatchable final : public MVariadicInstruction, |
| 1919 | public MWasmCallBase, |
| 1920 | public NoTypePolicy::Data { |
| 1921 | MWasmCallUncatchable(const wasm::CallSiteDesc& desc, |
| 1922 | const wasm::CalleeDesc& callee, |
| 1923 | uint32_t stackArgAreaSizeUnaligned) |
| 1924 | : MVariadicInstruction(classOpcode), |
| 1925 | MWasmCallBase(desc, callee, stackArgAreaSizeUnaligned, false, 0) {} |
| 1926 | |
| 1927 | public: |
| 1928 | INSTRUCTION_HEADER(WasmCallUncatchable) |
| 1929 | |
| 1930 | static MWasmCallUncatchable* New(TempAllocator& alloc, |
| 1931 | const wasm::CallSiteDesc& desc, |
| 1932 | const wasm::CalleeDesc& callee, |
| 1933 | const Args& args, |
| 1934 | uint32_t stackArgAreaSizeUnaligned, |
| 1935 | MDefinition* tableAddressOrRef = nullptr); |
| 1936 | |
| 1937 | static MWasmCallUncatchable* NewBuiltinInstanceMethodCall( |
| 1938 | TempAllocator& alloc, const wasm::CallSiteDesc& desc, |
| 1939 | const wasm::SymbolicAddress builtin, wasm::FailureMode failureMode, |
| 1940 | wasm::Trap failureTrap, const ABIArg& instanceArg, const Args& args, |
| 1941 | uint32_t stackArgAreaSizeUnaligned); |
| 1942 | |
| 1943 | bool possiblyCalls() const override { return true; } |
| 1944 | AliasSet getAliasSet() const override { return wasmCallAliasSet(); } |
| 1945 | }; |
| 1946 | |
| 1947 | class MWasmReturnCall final : public MVariadicControlInstruction<0>, |
| 1948 | public MWasmCallBase, |
| 1949 | public NoTypePolicy::Data { |
| 1950 | MWasmReturnCall(const wasm::CallSiteDesc& desc, |
| 1951 | const wasm::CalleeDesc& callee, |
| 1952 | uint32_t stackArgAreaSizeUnaligned) |
| 1953 | : MVariadicControlInstruction(classOpcode), |
| 1954 | MWasmCallBase(desc, callee, stackArgAreaSizeUnaligned, false, 0) {} |
| 1955 | |
| 1956 | public: |
| 1957 | INSTRUCTION_HEADER(WasmReturnCall) |
| 1958 | |
| 1959 | static MWasmReturnCall* New(TempAllocator& alloc, |
| 1960 | const wasm::CallSiteDesc& desc, |
| 1961 | const wasm::CalleeDesc& callee, const Args& args, |
| 1962 | uint32_t stackArgAreaSizeUnaligned, |
| 1963 | MDefinition* tableAddressOrRef = nullptr); |
| 1964 | |
| 1965 | bool possiblyCalls() const override { return true; } |
| 1966 | }; |
| 1967 | |
| 1968 | // A marker instruction for a block which is the landing pad for a catchable |
| 1969 | // wasm call. This instruction does not emit any code, only filling in |
| 1970 | // metadata. This instruction must be the first instruction added to the |
| 1971 | // landing pad block. |
| 1972 | class MWasmCallLandingPrePad : public MNullaryInstruction { |
| 1973 | // The block of the call that may unwind to this landing pad. |
| 1974 | MBasicBlock* callBlock_; |
| 1975 | // The index of the try note to initialize a landing pad for. |
| 1976 | size_t tryNoteIndex_; |
| 1977 | |
| 1978 | explicit MWasmCallLandingPrePad(MBasicBlock* callBlock, size_t tryNoteIndex) |
| 1979 | : MNullaryInstruction(classOpcode), |
| 1980 | callBlock_(callBlock), |
| 1981 | tryNoteIndex_(tryNoteIndex) { |
| 1982 | setGuard(); |
| 1983 | } |
| 1984 | |
| 1985 | public: |
| 1986 | INSTRUCTION_HEADER(WasmCallLandingPrePad) |
| 1987 | 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)...); } |
| 1988 | |
| 1989 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 1990 | |
| 1991 | size_t tryNoteIndex() { return tryNoteIndex_; } |
| 1992 | MBasicBlock* callBlock() { return callBlock_; } |
| 1993 | }; |
| 1994 | |
| 1995 | #ifdef ENABLE_WASM_JSPI1 |
| 1996 | |
| 1997 | class MWasmResume final : public MControlInstruction, |
| 1998 | public NoTypePolicy::Data { |
| 1999 | private: |
| 2000 | static constexpr size_t InstanceIndex = 0; |
| 2001 | static constexpr size_t ContIndex = 1; |
| 2002 | static constexpr size_t HandlersParamsAreaIndex = 2; |
| 2003 | static constexpr size_t ContResultsAreaIndex = 3; |
| 2004 | static constexpr size_t MaxArity = 4; |
| 2005 | |
| 2006 | static constexpr size_t FallthroughBranchIndex = 0; |
| 2007 | |
| 2008 | mozilla::Vector<MBasicBlock*, 3, JitAllocPolicy> successors_; |
| 2009 | mozilla::Array<MUse, MaxArity> operands_; |
| 2010 | mozilla::Vector<wasm::HandlerJitOffsets, 1, JitAllocPolicy> handlers_; |
| 2011 | wasm::CallSiteDesc callSiteDesc_; |
| 2012 | mozilla::Maybe<uint32_t> tryNoteIndex_; |
| 2013 | |
| 2014 | // handlersParamsArea and contResultsArea are always present (empty areas when |
| 2015 | // the resume has no handlers / the cont has no results) so the operand set is |
| 2016 | // fixed. |
| 2017 | MWasmResume(TempAllocator& alloc, const wasm::CallSiteDesc& callSiteDesc, |
| 2018 | mozilla::Maybe<uint32_t> tryNoteIndex, MDefinition* instance, |
| 2019 | MDefinition* cont, MWasmStackResultArea* handlersParamsArea, |
| 2020 | MWasmStackResultArea* contResultsArea) |
| 2021 | : MControlInstruction(classOpcode), |
| 2022 | successors_(alloc), |
| 2023 | handlers_(alloc), |
| 2024 | callSiteDesc_(callSiteDesc), |
| 2025 | tryNoteIndex_(tryNoteIndex) { |
| 2026 | 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", 2026); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "instance && cont && handlersParamsArea && contResultsArea" ")"); do { MOZ_CrashSequence(__null, 2026); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2027 | initOperand(InstanceIndex, instance); |
| 2028 | initOperand(ContIndex, cont); |
| 2029 | initOperand(HandlersParamsAreaIndex, handlersParamsArea); |
| 2030 | initOperand(ContResultsAreaIndex, contResultsArea); |
| 2031 | } |
| 2032 | |
| 2033 | size_t prePadBranchIndex() const { |
| 2034 | 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" , 2034); AnnotateMozCrashReason("MOZ_ASSERT" "(" "hasTryNote()" ")"); do { MOZ_CrashSequence(__null, 2034); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2035 | return FallthroughBranchIndex + 1; |
| 2036 | } |
| 2037 | size_t handlerBranchIndex(size_t handlerIndex) const { |
| 2038 | size_t previousIndex = |
| 2039 | hasTryNote() ? prePadBranchIndex() : FallthroughBranchIndex; |
| 2040 | size_t baseIndex = previousIndex + 1; |
| 2041 | return baseIndex + handlerIndex; |
| 2042 | } |
| 2043 | |
| 2044 | protected: |
| 2045 | MUse* getUseFor(size_t index) final { return &operands_[index]; } |
| 2046 | const MUse* getUseFor(size_t index) const final { return &operands_[index]; } |
| 2047 | void initOperand(size_t index, MDefinition* operand) { |
| 2048 | operands_[index].init(operand, this); |
| 2049 | } |
| 2050 | |
| 2051 | public: |
| 2052 | INSTRUCTION_HEADER(WasmResume) |
| 2053 | |
| 2054 | static MWasmResume* New(TempAllocator& alloc, |
| 2055 | const wasm::CallSiteDesc& callSiteDesc, |
| 2056 | mozilla::Maybe<uint32_t> tryNoteIndex, |
| 2057 | MDefinition* instance, MDefinition* cont, |
| 2058 | MWasmStackResultArea* handlersParamsArea, |
| 2059 | MWasmStackResultArea* contResultsArea) { |
| 2060 | return new (alloc) MWasmResume(alloc, callSiteDesc, tryNoteIndex, instance, |
| 2061 | cont, handlersParamsArea, contResultsArea); |
| 2062 | } |
| 2063 | |
| 2064 | [[nodiscard]] bool init(MBasicBlock* fallthroughBlock, |
| 2065 | MBasicBlock* prePadBlock, size_t numHandlers); |
| 2066 | [[nodiscard]] bool initHandler(size_t index, uint32_t tagInstanceDataOffset, |
| 2067 | uint32_t resultsAreaOffset, |
| 2068 | MBasicBlock* target); |
| 2069 | |
| 2070 | size_t numHandlers() const { return handlers_.length(); } |
| 2071 | mozilla::Span<wasm::HandlerJitOffsets> handlers() { return handlers_; } |
| 2072 | const wasm::HandlerJitOffsets& handler(size_t index) const { |
| 2073 | return handlers_[index]; |
| 2074 | } |
| 2075 | const wasm::CallSiteDesc& callSiteDesc() const { return callSiteDesc_; } |
| 2076 | bool hasTryNote() const { return tryNoteIndex_.isSome(); } |
| 2077 | mozilla::Maybe<uint32_t> tryNoteIndex() const { return tryNoteIndex_; } |
| 2078 | MBasicBlock* handlerBlock(size_t index) const { |
| 2079 | return getSuccessor(handlerBranchIndex(index)); |
| 2080 | } |
| 2081 | MBasicBlock* prePadBlock() const { return getSuccessor(prePadBranchIndex()); } |
| 2082 | MBasicBlock* fallthroughBlock() const { |
| 2083 | return getSuccessor(FallthroughBranchIndex); |
| 2084 | } |
| 2085 | |
| 2086 | MDefinition* instance() const { return getOperand(InstanceIndex); } |
| 2087 | MDefinition* cont() const { return getOperand(ContIndex); } |
| 2088 | MWasmStackResultArea* handlersParamsArea() const { |
| 2089 | return getOperand(HandlersParamsAreaIndex)->toWasmStackResultArea(); |
| 2090 | } |
| 2091 | MWasmStackResultArea* contResultsArea() const { |
| 2092 | return getOperand(ContResultsAreaIndex)->toWasmStackResultArea(); |
| 2093 | } |
| 2094 | |
| 2095 | bool possiblyCalls() const final { return true; } |
| 2096 | AliasSet getAliasSet() const final { |
| 2097 | return MWasmCallBase::wasmCallAliasSet(); |
| 2098 | } |
| 2099 | |
| 2100 | size_t numSuccessors() const final { return successors_.length(); } |
| 2101 | MBasicBlock* getSuccessor(size_t i) const final { return successors_[i]; } |
| 2102 | void replaceSuccessor(size_t i, MBasicBlock* successor) final { |
| 2103 | successors_[i] = successor; |
| 2104 | } |
| 2105 | |
| 2106 | MDefinition* getOperand(size_t index) const final { |
| 2107 | return operands_[index].producer(); |
| 2108 | } |
| 2109 | size_t numOperands() const final { return MaxArity; } |
| 2110 | size_t indexOf(const MUse* u) const final { |
| 2111 | 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", 2111); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "u >= &operands_[0]" ")"); do { MOZ_CrashSequence (__null, 2111); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2112 | 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", 2112); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "u <= &operands_[numOperands() - 1]" ")"); do { MOZ_CrashSequence(__null, 2112); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2113 | return u - &operands_[0]; |
| 2114 | } |
| 2115 | void replaceOperand(size_t index, MDefinition* operand) final { |
| 2116 | operands_[index].replaceProducer(operand); |
| 2117 | } |
| 2118 | }; |
| 2119 | |
| 2120 | #endif // ENABLE_WASM_JSPI |
| 2121 | |
| 2122 | class MWasmSelect : public MTernaryInstruction, public NoTypePolicy::Data { |
| 2123 | MWasmSelect(MDefinition* trueExpr, MDefinition* falseExpr, |
| 2124 | MDefinition* condExpr) |
| 2125 | : MTernaryInstruction(classOpcode, trueExpr, falseExpr, condExpr) { |
| 2126 | 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", 2126); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "condExpr->type() == MIRType::Int32" ")" ); do { MOZ_CrashSequence(__null, 2126); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2127 | 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", 2127); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "trueExpr->type() == falseExpr->type()" ")"); do { MOZ_CrashSequence(__null, 2127); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2128 | setResultType(trueExpr->type()); |
| 2129 | setMovable(); |
| 2130 | } |
| 2131 | |
| 2132 | public: |
| 2133 | INSTRUCTION_HEADER(WasmSelect) |
| 2134 | 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)...); } |
| 2135 | 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); } |
| 2136 | |
| 2137 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2138 | |
| 2139 | bool congruentTo(const MDefinition* ins) const override { |
| 2140 | return congruentIfOperandsEqual(ins); |
| 2141 | } |
| 2142 | |
| 2143 | wasm::MaybeRefType computeWasmRefType() const override { |
| 2144 | return wasm::MaybeRefType::leastUpperBound(trueExpr()->wasmRefType(), |
| 2145 | falseExpr()->wasmRefType()); |
| 2146 | } |
| 2147 | |
| 2148 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2149 | |
| 2150 | 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", 2150); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2150); __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; } |
| 2151 | }; |
| 2152 | |
| 2153 | // Wasm SIMD. |
| 2154 | // |
| 2155 | // See comment in WasmIonCompile.cpp for a justification for these nodes. |
| 2156 | |
| 2157 | // (v128, v128, v128) -> v128 effect-free operation. |
| 2158 | class MWasmTernarySimd128 : public MTernaryInstruction, |
| 2159 | public NoTypePolicy::Data { |
| 2160 | wasm::SimdOp simdOp_; |
| 2161 | |
| 2162 | MWasmTernarySimd128(MDefinition* v0, MDefinition* v1, MDefinition* v2, |
| 2163 | wasm::SimdOp simdOp) |
| 2164 | : MTernaryInstruction(classOpcode, v0, v1, v2), simdOp_(simdOp) { |
| 2165 | setMovable(); |
| 2166 | setResultType(MIRType::Simd128); |
| 2167 | } |
| 2168 | |
| 2169 | public: |
| 2170 | INSTRUCTION_HEADER(WasmTernarySimd128) |
| 2171 | 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)...); } |
| 2172 | 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); } |
| 2173 | |
| 2174 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2175 | bool congruentTo(const MDefinition* ins) const override { |
| 2176 | return congruentIfOperandsEqual(ins) && |
| 2177 | simdOp() == ins->toWasmTernarySimd128()->simdOp(); |
| 2178 | } |
| 2179 | #ifdef ENABLE_JIT_SIMD1 |
| 2180 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2181 | |
| 2182 | // If the control mask of a bitselect allows the operation to be specialized |
| 2183 | // as a shuffle and it is profitable to specialize it on this platform, return |
| 2184 | // true and the appropriate shuffle mask. |
| 2185 | bool specializeBitselectConstantMaskAsShuffle(int8_t shuffle[16]); |
| 2186 | // Checks if more relaxed version of lane select can be used. It returns true |
| 2187 | // if a bit mask input expected to be all 0s or 1s for entire 8-bit lanes, |
| 2188 | // false otherwise. |
| 2189 | bool canRelaxBitselect(); |
| 2190 | #endif |
| 2191 | |
| 2192 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2193 | |
| 2194 | 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", 2194); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2194); __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; } |
| 2195 | }; |
| 2196 | |
| 2197 | // (v128, v128) -> v128 effect-free operations. |
| 2198 | class MWasmBinarySimd128 : public MBinaryInstruction, |
| 2199 | public NoTypePolicy::Data { |
| 2200 | wasm::SimdOp simdOp_; |
| 2201 | |
| 2202 | MWasmBinarySimd128(MDefinition* lhs, MDefinition* rhs, bool commutative, |
| 2203 | wasm::SimdOp simdOp) |
| 2204 | : MBinaryInstruction(classOpcode, lhs, rhs), simdOp_(simdOp) { |
| 2205 | setMovable(); |
| 2206 | setResultType(MIRType::Simd128); |
| 2207 | if (commutative) { |
| 2208 | setCommutative(); |
| 2209 | } |
| 2210 | } |
| 2211 | |
| 2212 | public: |
| 2213 | INSTRUCTION_HEADER(WasmBinarySimd128) |
| 2214 | 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)...); } |
| 2215 | |
| 2216 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2217 | bool congruentTo(const MDefinition* ins) const override { |
| 2218 | return congruentIfOperandsEqual(ins) && |
| 2219 | ins->toWasmBinarySimd128()->simdOp() == simdOp_; |
| 2220 | } |
| 2221 | #ifdef ENABLE_JIT_SIMD1 |
| 2222 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2223 | |
| 2224 | // Checks if pmaddubsw operation is supported. |
| 2225 | bool canPmaddubsw(); |
| 2226 | |
| 2227 | // Checks if a not-equal of an and against zero can be one test-bits |
| 2228 | // operation. |
| 2229 | bool canTestBits(); |
| 2230 | #endif |
| 2231 | |
| 2232 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2233 | |
| 2234 | // Platform-dependent specialization. |
| 2235 | bool specializeForConstantRhs(); |
| 2236 | |
| 2237 | 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", 2237); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2237); __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; } |
| 2238 | }; |
| 2239 | |
| 2240 | // (v128, const) -> v128 effect-free operations. |
| 2241 | class MWasmBinarySimd128WithConstant : public MUnaryInstruction, |
| 2242 | public NoTypePolicy::Data { |
| 2243 | SimdConstant rhs_; |
| 2244 | wasm::SimdOp simdOp_; |
| 2245 | |
| 2246 | MWasmBinarySimd128WithConstant(MDefinition* lhs, const SimdConstant& rhs, |
| 2247 | wasm::SimdOp simdOp) |
| 2248 | : MUnaryInstruction(classOpcode, lhs), rhs_(rhs), simdOp_(simdOp) { |
| 2249 | setMovable(); |
| 2250 | setResultType(MIRType::Simd128); |
| 2251 | } |
| 2252 | |
| 2253 | public: |
| 2254 | INSTRUCTION_HEADER(WasmBinarySimd128WithConstant) |
| 2255 | 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)...); } |
| 2256 | |
| 2257 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2258 | bool congruentTo(const MDefinition* ins) const override { |
| 2259 | return congruentIfOperandsEqual(ins) && |
| 2260 | ins->toWasmBinarySimd128WithConstant()->simdOp() == simdOp_ && |
| 2261 | rhs_.bitwiseEqual(ins->toWasmBinarySimd128WithConstant()->rhs()); |
| 2262 | } |
| 2263 | |
| 2264 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2265 | MDefinition* lhs() const { return input(); } |
| 2266 | const SimdConstant& rhs() const { return rhs_; } |
| 2267 | |
| 2268 | 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", 2268); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2268); __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; } |
| 2269 | }; |
| 2270 | |
| 2271 | // (v128, scalar, imm) -> v128 effect-free operations. |
| 2272 | class MWasmReplaceLaneSimd128 : public MBinaryInstruction, |
| 2273 | public NoTypePolicy::Data { |
| 2274 | uint32_t laneIndex_; |
| 2275 | wasm::SimdOp simdOp_; |
| 2276 | |
| 2277 | MWasmReplaceLaneSimd128(MDefinition* lhs, MDefinition* rhs, |
| 2278 | uint32_t laneIndex, wasm::SimdOp simdOp) |
| 2279 | : MBinaryInstruction(classOpcode, lhs, rhs), |
| 2280 | laneIndex_(laneIndex), |
| 2281 | simdOp_(simdOp) { |
| 2282 | setMovable(); |
| 2283 | setResultType(MIRType::Simd128); |
| 2284 | } |
| 2285 | |
| 2286 | public: |
| 2287 | INSTRUCTION_HEADER(WasmReplaceLaneSimd128) |
| 2288 | 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)...); } |
| 2289 | |
| 2290 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2291 | bool congruentTo(const MDefinition* ins) const override { |
| 2292 | return congruentIfOperandsEqual(ins) && |
| 2293 | ins->toWasmReplaceLaneSimd128()->simdOp() == simdOp_ && |
| 2294 | ins->toWasmReplaceLaneSimd128()->laneIndex() == laneIndex_; |
| 2295 | } |
| 2296 | |
| 2297 | #ifdef ENABLE_JIT_SIMD1 |
| 2298 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2299 | |
| 2300 | // Checks if a lane can be moved directly between vectors. |
| 2301 | bool canMoveLane(); |
| 2302 | #endif |
| 2303 | |
| 2304 | uint32_t laneIndex() const { return laneIndex_; } |
| 2305 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2306 | |
| 2307 | 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", 2307); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2307); __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; } |
| 2308 | }; |
| 2309 | |
| 2310 | // (scalar) -> v128 effect-free operations. |
| 2311 | class MWasmScalarToSimd128 : public MUnaryInstruction, |
| 2312 | public NoTypePolicy::Data { |
| 2313 | wasm::SimdOp simdOp_; |
| 2314 | |
| 2315 | MWasmScalarToSimd128(MDefinition* src, wasm::SimdOp simdOp) |
| 2316 | : MUnaryInstruction(classOpcode, src), simdOp_(simdOp) { |
| 2317 | setMovable(); |
| 2318 | setResultType(MIRType::Simd128); |
| 2319 | } |
| 2320 | |
| 2321 | public: |
| 2322 | INSTRUCTION_HEADER(WasmScalarToSimd128) |
| 2323 | 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)...); } |
| 2324 | |
| 2325 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2326 | bool congruentTo(const MDefinition* ins) const override { |
| 2327 | return congruentIfOperandsEqual(ins) && |
| 2328 | ins->toWasmScalarToSimd128()->simdOp() == simdOp_; |
| 2329 | } |
| 2330 | #ifdef ENABLE_JIT_SIMD1 |
| 2331 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2332 | #endif |
| 2333 | |
| 2334 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2335 | |
| 2336 | 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", 2336); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2336); __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; } |
| 2337 | }; |
| 2338 | |
| 2339 | // (v128, imm) -> scalar effect-free operations. |
| 2340 | class MWasmReduceSimd128 : public MUnaryInstruction, public NoTypePolicy::Data { |
| 2341 | wasm::SimdOp simdOp_; |
| 2342 | uint32_t imm_; |
| 2343 | |
| 2344 | MWasmReduceSimd128(MDefinition* src, wasm::SimdOp simdOp, MIRType outType, |
| 2345 | uint32_t imm) |
| 2346 | : MUnaryInstruction(classOpcode, src), simdOp_(simdOp), imm_(imm) { |
| 2347 | setMovable(); |
| 2348 | setResultType(outType); |
| 2349 | } |
| 2350 | |
| 2351 | public: |
| 2352 | INSTRUCTION_HEADER(WasmReduceSimd128) |
| 2353 | 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)...); } |
| 2354 | |
| 2355 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 2356 | bool congruentTo(const MDefinition* ins) const override { |
| 2357 | return congruentIfOperandsEqual(ins) && |
| 2358 | ins->toWasmReduceSimd128()->simdOp() == simdOp_ && |
| 2359 | ins->toWasmReduceSimd128()->imm() == imm_; |
| 2360 | } |
| 2361 | #ifdef ENABLE_JIT_SIMD1 |
| 2362 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 2363 | #endif |
| 2364 | |
| 2365 | uint32_t imm() const { return imm_; } |
| 2366 | wasm::SimdOp simdOp() const { return simdOp_; } |
| 2367 | |
| 2368 | 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", 2368); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2368); __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; } |
| 2369 | }; |
| 2370 | |
| 2371 | class MWasmLoadLaneSimd128 |
| 2372 | : public MVariadicInstruction, // memoryBase is nullptr on some platforms |
| 2373 | public NoTypePolicy::Data { |
| 2374 | wasm::MemoryAccessDesc access_; |
| 2375 | uint32_t laneSize_; |
| 2376 | uint32_t laneIndex_; |
| 2377 | uint32_t memoryBaseIndex_; |
| 2378 | |
| 2379 | MWasmLoadLaneSimd128(const wasm::MemoryAccessDesc& access, uint32_t laneSize, |
| 2380 | uint32_t laneIndex, uint32_t memoryBaseIndex) |
| 2381 | : MVariadicInstruction(classOpcode), |
| 2382 | access_(access), |
| 2383 | laneSize_(laneSize), |
| 2384 | laneIndex_(laneIndex), |
| 2385 | memoryBaseIndex_(memoryBaseIndex) { |
| 2386 | 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", 2386); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!access_.isAtomic()" ")"); do { MOZ_CrashSequence (__null, 2386); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2387 | setGuard(); |
| 2388 | setResultType(MIRType::Simd128); |
| 2389 | } |
| 2390 | |
| 2391 | public: |
| 2392 | INSTRUCTION_HEADER(WasmLoadLaneSimd128) |
| 2393 | 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); }; |
| 2394 | |
| 2395 | static MWasmLoadLaneSimd128* New(TempAllocator& alloc, |
| 2396 | MDefinition* memoryBase, MDefinition* base, |
| 2397 | const wasm::MemoryAccessDesc& access, |
| 2398 | uint32_t laneSize, uint32_t laneIndex, |
| 2399 | MDefinition* value) { |
| 2400 | uint32_t nextIndex = 2; |
| 2401 | uint32_t memoryBaseIndex = memoryBase ? nextIndex++ : UINT32_MAX(4294967295U); |
| 2402 | |
| 2403 | MWasmLoadLaneSimd128* load = new (alloc) |
| 2404 | MWasmLoadLaneSimd128(access, laneSize, laneIndex, memoryBaseIndex); |
| 2405 | if (!load->init(alloc, nextIndex)) { |
| 2406 | return nullptr; |
| 2407 | } |
| 2408 | |
| 2409 | load->initOperand(0, base); |
| 2410 | load->initOperand(1, value); |
| 2411 | if (memoryBase) { |
| 2412 | load->initOperand(memoryBaseIndex, memoryBase); |
| 2413 | } |
| 2414 | |
| 2415 | return load; |
| 2416 | } |
| 2417 | |
| 2418 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 2419 | uint32_t laneSize() const { return laneSize_; } |
| 2420 | uint32_t laneIndex() const { return laneIndex_; } |
| 2421 | bool hasMemoryBase() const { return memoryBaseIndex_ != UINT32_MAX(4294967295U); } |
| 2422 | MDefinition* memoryBase() const { |
| 2423 | 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", 2423); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "hasMemoryBase()" ")"); do { MOZ_CrashSequence (__null, 2423); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2424 | return getOperand(memoryBaseIndex_); |
| 2425 | } |
| 2426 | |
| 2427 | AliasSet getAliasSet() const override { |
| 2428 | return AliasSet::Load(AliasSet::WasmHeap); |
| 2429 | } |
| 2430 | }; |
| 2431 | |
| 2432 | class MWasmStoreLaneSimd128 : public MVariadicInstruction, |
| 2433 | public NoTypePolicy::Data { |
| 2434 | wasm::MemoryAccessDesc access_; |
| 2435 | uint32_t laneSize_; |
| 2436 | uint32_t laneIndex_; |
| 2437 | uint32_t memoryBaseIndex_; |
| 2438 | |
| 2439 | explicit MWasmStoreLaneSimd128(const wasm::MemoryAccessDesc& access, |
| 2440 | uint32_t laneSize, uint32_t laneIndex, |
| 2441 | uint32_t memoryBaseIndex) |
| 2442 | : MVariadicInstruction(classOpcode), |
| 2443 | access_(access), |
| 2444 | laneSize_(laneSize), |
| 2445 | laneIndex_(laneIndex), |
| 2446 | memoryBaseIndex_(memoryBaseIndex) { |
| 2447 | 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", 2447); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!access_.isAtomic()" ")"); do { MOZ_CrashSequence (__null, 2447); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2448 | setGuard(); |
| 2449 | setResultType(MIRType::Simd128); |
| 2450 | } |
| 2451 | |
| 2452 | public: |
| 2453 | INSTRUCTION_HEADER(WasmStoreLaneSimd128) |
| 2454 | 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); } |
| 2455 | |
| 2456 | static MWasmStoreLaneSimd128* New(TempAllocator& alloc, |
| 2457 | MDefinition* memoryBase, MDefinition* base, |
| 2458 | const wasm::MemoryAccessDesc& access, |
| 2459 | uint32_t laneSize, uint32_t laneIndex, |
| 2460 | MDefinition* value) { |
| 2461 | uint32_t nextIndex = 2; |
| 2462 | uint32_t memoryBaseIndex = memoryBase ? nextIndex++ : UINT32_MAX(4294967295U); |
| 2463 | |
| 2464 | MWasmStoreLaneSimd128* store = new (alloc) |
| 2465 | MWasmStoreLaneSimd128(access, laneSize, laneIndex, memoryBaseIndex); |
| 2466 | if (!store->init(alloc, nextIndex)) { |
| 2467 | return nullptr; |
| 2468 | } |
| 2469 | |
| 2470 | store->initOperand(0, base); |
| 2471 | store->initOperand(1, value); |
| 2472 | if (memoryBase) { |
| 2473 | store->initOperand(memoryBaseIndex, memoryBase); |
| 2474 | } |
| 2475 | |
| 2476 | return store; |
| 2477 | } |
| 2478 | |
| 2479 | const wasm::MemoryAccessDesc& access() const { return access_; } |
| 2480 | uint32_t laneSize() const { return laneSize_; } |
| 2481 | uint32_t laneIndex() const { return laneIndex_; } |
| 2482 | bool hasMemoryBase() const { return memoryBaseIndex_ != UINT32_MAX(4294967295U); } |
| 2483 | MDefinition* memoryBase() const { |
| 2484 | 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", 2484); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "hasMemoryBase()" ")"); do { MOZ_CrashSequence (__null, 2484); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2485 | return getOperand(memoryBaseIndex_); |
| 2486 | } |
| 2487 | |
| 2488 | AliasSet getAliasSet() const override { |
| 2489 | return AliasSet::Store(AliasSet::WasmHeap); |
| 2490 | } |
| 2491 | }; |
| 2492 | |
| 2493 | // End Wasm SIMD |
| 2494 | |
| 2495 | class MIonToWasmCall final : public MVariadicInstruction, |
| 2496 | public NoTypePolicy::Data { |
| 2497 | CompilerGCPointer<WasmInstanceObject*> instanceObj_; |
| 2498 | const wasm::FuncExport& funcExport_; |
| 2499 | |
| 2500 | MIonToWasmCall(WasmInstanceObject* instanceObj, MIRType resultType, |
| 2501 | const wasm::FuncExport& funcExport) |
| 2502 | : MVariadicInstruction(classOpcode), |
| 2503 | instanceObj_(instanceObj), |
| 2504 | funcExport_(funcExport) { |
| 2505 | setResultType(resultType); |
| 2506 | } |
| 2507 | |
| 2508 | public: |
| 2509 | INSTRUCTION_HEADER(IonToWasmCall); |
| 2510 | |
| 2511 | static MIonToWasmCall* New(TempAllocator& alloc, |
| 2512 | WasmInstanceObject* instanceObj, |
| 2513 | const wasm::FuncExport& funcExport); |
| 2514 | |
| 2515 | void initArg(size_t i, MDefinition* arg) { initOperand(i, arg); } |
| 2516 | |
| 2517 | WasmInstanceObject* instanceObject() const { return instanceObj_; } |
| 2518 | wasm::Instance* instance() const { return &instanceObj_->instance(); } |
| 2519 | const wasm::FuncExport& funcExport() const { return funcExport_; } |
| 2520 | bool possiblyCalls() const override { return true; } |
| 2521 | #ifdef DEBUG1 |
| 2522 | bool isConsistentFloat32Use(MUse* use) const override; |
| 2523 | #endif |
| 2524 | }; |
| 2525 | |
| 2526 | // For accesses to wasm object fields, we need to be able to describe 8- and |
| 2527 | // 16-bit accesses. But MIRType can't represent those. Hence these two |
| 2528 | // supplemental enums, used for reading and writing fields respectively. |
| 2529 | |
| 2530 | // Indicates how to widen an 8- or 16-bit value (when it is read from memory). |
| 2531 | enum class MWideningOp : uint8_t { None, FromU16, FromS16, FromU8, FromS8 }; |
| 2532 | |
| 2533 | #ifdef JS_JITSPEW1 |
| 2534 | static inline const char* StringFromMWideningOp(MWideningOp op) { |
| 2535 | switch (op) { |
| 2536 | case MWideningOp::None: |
| 2537 | return "None"; |
| 2538 | case MWideningOp::FromU16: |
| 2539 | return "FromU16"; |
| 2540 | case MWideningOp::FromS16: |
| 2541 | return "FromS16"; |
| 2542 | case MWideningOp::FromU8: |
| 2543 | return "FromU8"; |
| 2544 | case MWideningOp::FromS8: |
| 2545 | return "FromS8"; |
| 2546 | default: |
| 2547 | break; |
| 2548 | } |
| 2549 | MOZ_CRASH("Unknown MWideningOp")do { do { } while (false); MOZ_ReportCrash("" "Unknown MWideningOp" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2549); AnnotateMozCrashReason ("MOZ_CRASH(" "Unknown MWideningOp" ")"); do { MOZ_CrashSequence (__null, 2549); __attribute__((nomerge)) ::abort(); } while ( false); } while (false); |
| 2550 | } |
| 2551 | #endif |
| 2552 | |
| 2553 | // Indicates how to narrow a 32-bit value (when it is written to memory). The |
| 2554 | // operation is a simple truncate. |
| 2555 | enum class MNarrowingOp : uint8_t { None, To16, To8 }; |
| 2556 | |
| 2557 | #ifdef JS_JITSPEW1 |
| 2558 | static inline const char* StringFromMNarrowingOp(MNarrowingOp op) { |
| 2559 | switch (op) { |
| 2560 | case MNarrowingOp::None: |
| 2561 | return "None"; |
| 2562 | case MNarrowingOp::To16: |
| 2563 | return "To16"; |
| 2564 | case MNarrowingOp::To8: |
| 2565 | return "To8"; |
| 2566 | default: |
| 2567 | break; |
| 2568 | } |
| 2569 | MOZ_CRASH("Unknown MNarrowingOp")do { do { } while (false); MOZ_ReportCrash("" "Unknown MNarrowingOp" , "/root/firefox-clang/js/src/jit/MIR-wasm.h", 2569); AnnotateMozCrashReason ("MOZ_CRASH(" "Unknown MNarrowingOp" ")"); do { MOZ_CrashSequence (__null, 2569); __attribute__((nomerge)) ::abort(); } while ( false); } while (false); |
| 2570 | } |
| 2571 | #endif |
| 2572 | |
| 2573 | // Loads a value from a location, denoted as a fixed offset from a base |
| 2574 | // pointer. This field may be any value type, including references. No |
| 2575 | // barriers are performed. |
| 2576 | // |
| 2577 | // This instruction can extend the lifetime of an optional `keepAlive` |
| 2578 | // parameter to match the lifetime of this instruction. This is necessary if |
| 2579 | // the base pointer is owned by some GC'ed object, which means that the GC |
| 2580 | // object must have the same lifetime as all uses of it's owned pointers. |
| 2581 | // No code to access the keepAlive value is generated. |
| 2582 | // |
| 2583 | // `offset` must be representable as a 31-bit unsigned integer. |
| 2584 | // |
| 2585 | // An optional structFieldIndex can be given for struct accesses and used in |
| 2586 | // scalar replacement. |
| 2587 | class MWasmLoadField : public MBinaryInstruction, public NoTypePolicy::Data { |
| 2588 | uint32_t offset_; |
| 2589 | mozilla::Maybe<uint32_t> structFieldIndex_; |
| 2590 | MWideningOp wideningOp_; |
| 2591 | AliasSet aliases_; |
| 2592 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2593 | wasm::MaybeRefType maybeRefType_; |
| 2594 | |
| 2595 | MWasmLoadField(MDefinition* base, MDefinition* keepAlive, size_t offset, |
| 2596 | mozilla::Maybe<uint32_t> structFieldIndex, MIRType type, |
| 2597 | MWideningOp wideningOp, AliasSet aliases, |
| 2598 | wasm::MaybeTrapSiteDesc maybeTrap = mozilla::Nothing(), |
| 2599 | wasm::MaybeRefType maybeRefType = wasm::MaybeRefType()) |
| 2600 | : MBinaryInstruction(classOpcode, base, keepAlive ? keepAlive : base), |
| 2601 | offset_(uint32_t(offset)), |
| 2602 | structFieldIndex_(structFieldIndex), |
| 2603 | wideningOp_(wideningOp), |
| 2604 | aliases_(aliases), |
| 2605 | maybeTrap_(std::move(maybeTrap)), |
| 2606 | maybeRefType_(maybeRefType) { |
| 2607 | 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", 2607); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "offset <= (2147483647)" ")"); do { MOZ_CrashSequence (__null, 2607); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2608 | // "if you want to widen the value when it is loaded, the destination type |
| 2609 | // must be Int32". |
| 2610 | 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", 2610); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "type == MIRType::Int32" ")"); do { MOZ_CrashSequence (__null, 2610); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); } } while (false); |
| 2611 | // Check the alias set is one of the expected kinds. |
| 2612 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2613 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2614 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2615 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2616 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2617 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2618 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2619 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2620 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2621 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2622 | 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", 2625); 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, 2625); __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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2624 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2625 | 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", 2625); 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, 2625); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2626 | // Check the alias set is consistent with the result type. |
| 2627 | 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", 2630); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" ")"); do { MOZ_CrashSequence(__null, 2630); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2628 | (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", 2630); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" ")"); do { MOZ_CrashSequence(__null, 2630); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2629 | 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", 2630); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" ")"); do { MOZ_CrashSequence(__null, 2630); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2630 | (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", 2630); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmStructOutlineDataPointer).flags()) == (type == MIRType::WasmStructData)" ")"); do { MOZ_CrashSequence(__null, 2630); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2631 | 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", 2633); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) == (type == MIRType::WasmArrayData)" ")"); do { MOZ_CrashSequence(__null, 2633); __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::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", 2633); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) == (type == MIRType::WasmArrayData)" ")"); do { MOZ_CrashSequence(__null, 2633); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2633 | (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", 2633); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "(aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataPointer).flags()) == (type == MIRType::WasmArrayData)" ")"); do { MOZ_CrashSequence(__null, 2633); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2634 | setResultType(type); |
| 2635 | if (maybeTrap_) { |
| 2636 | // This is safe, but see bug 1992059 for associated details. |
| 2637 | setGuard(); |
| 2638 | } else { |
| 2639 | setMovable(); |
| 2640 | } |
| 2641 | setWasmRefType(maybeRefType); |
| 2642 | } |
| 2643 | |
| 2644 | public: |
| 2645 | INSTRUCTION_HEADER(WasmLoadField) |
| 2646 | 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)...); } |
| 2647 | 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); } |
| 2648 | |
| 2649 | uint32_t offset() const { return offset_; } |
| 2650 | mozilla::Maybe<uint32_t> structFieldIndex() const { |
| 2651 | return structFieldIndex_; |
| 2652 | } |
| 2653 | MWideningOp wideningOp() const { return wideningOp_; } |
| 2654 | AliasSet getAliasSet() const override { return aliases_; } |
| 2655 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2656 | wasm::MaybeRefType maybeRefType() const { return maybeRefType_; } |
| 2657 | |
| 2658 | bool congruentTo(const MDefinition* ins) const override { |
| 2659 | if (!ins->isWasmLoadField()) { |
| 2660 | return false; |
| 2661 | } |
| 2662 | const MWasmLoadField* other = ins->toWasmLoadField(); |
| 2663 | return congruentIfOperandsEqual(other) && offset() == other->offset() && |
| 2664 | structFieldIndex() == other->structFieldIndex() && |
| 2665 | wideningOp() == other->wideningOp() && |
| 2666 | getAliasSet().flags() == other->getAliasSet().flags() && |
| 2667 | maybeRefType() == other->maybeRefType(); |
| 2668 | } |
| 2669 | |
| 2670 | virtual AliasType mightAlias(const MDefinition* ins) const override; |
| 2671 | |
| 2672 | #ifdef JS_JITSPEW1 |
| 2673 | void getExtras(ExtrasCollector* extras) const override { |
| 2674 | char buf[96]; |
| 2675 | SprintfLiteral(buf, "(offs=%lld, wideningOp=%s)", (long long int)offset_, |
| 2676 | StringFromMWideningOp(wideningOp_)); |
| 2677 | extras->add(buf); |
| 2678 | } |
| 2679 | #endif |
| 2680 | |
| 2681 | 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", 2681); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2681); __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; } |
| 2682 | }; |
| 2683 | |
| 2684 | // Loads a value from base pointer, given an index and element size. This field |
| 2685 | // may be any value type, including references. No barriers are performed. |
| 2686 | // |
| 2687 | // The element size is implicitly defined by MIRType and MWideningOp. For |
| 2688 | // example, MIRType::Float32 indicates an element size of 32 bits, and |
| 2689 | // MIRType::Int32 and MWideningOp::FromU16 together indicate an element size of |
| 2690 | // 16 bits. |
| 2691 | // |
| 2692 | // This instruction takes an optional second object `keepAlive` that must be |
| 2693 | // kept alive, as described for MWasmLoadField above. |
| 2694 | class MWasmLoadElement : public MTernaryInstruction, public NoTypePolicy::Data { |
| 2695 | MWideningOp wideningOp_; |
| 2696 | Scale scale_; |
| 2697 | AliasSet aliases_; |
| 2698 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2699 | |
| 2700 | MWasmLoadElement(MDefinition* base, MDefinition* keepAlive, |
| 2701 | MDefinition* index, MIRType type, MWideningOp wideningOp, |
| 2702 | Scale scale, AliasSet aliases, |
| 2703 | wasm::MaybeTrapSiteDesc maybeTrap = mozilla::Nothing(), |
| 2704 | wasm::MaybeRefType maybeRefType = wasm::MaybeRefType()) |
| 2705 | : MTernaryInstruction(classOpcode, base, index, |
| 2706 | keepAlive ? keepAlive : base), |
| 2707 | wideningOp_(wideningOp), |
| 2708 | scale_(scale), |
| 2709 | aliases_(aliases), |
| 2710 | maybeTrap_(std::move(maybeTrap)) { |
| 2711 | 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", 2711); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2711); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2712 | 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", 2714); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2714); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2713 | 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", 2714); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2714); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2714 | 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", 2714); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Load(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Load(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2714); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2715 | setResultType(type); |
| 2716 | if (maybeTrap_) { |
| 2717 | setGuard(); |
| 2718 | } |
| 2719 | setWasmRefType(maybeRefType); |
| 2720 | } |
| 2721 | |
| 2722 | public: |
| 2723 | INSTRUCTION_HEADER(WasmLoadElement) |
| 2724 | 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)...); } |
| 2725 | 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); } |
| 2726 | |
| 2727 | MWideningOp wideningOp() const { return wideningOp_; } |
| 2728 | Scale scale() const { return scale_; } |
| 2729 | AliasSet getAliasSet() const override { return aliases_; } |
| 2730 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2731 | |
| 2732 | #ifdef JS_JITSPEW1 |
| 2733 | void getExtras(ExtrasCollector* extras) const override { |
| 2734 | char buf[96]; |
| 2735 | SprintfLiteral(buf, "(wideningOp=%s, scale=%s)", |
| 2736 | StringFromMWideningOp(wideningOp_), StringFromScale(scale_)); |
| 2737 | extras->add(buf); |
| 2738 | } |
| 2739 | #endif |
| 2740 | |
| 2741 | 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", 2741); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2741); __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; } |
| 2742 | }; |
| 2743 | |
| 2744 | // Stores a non-reference value to anlocation, denoted as a fixed offset from |
| 2745 | // a base pointer, which (it is assumed) is within a wasm object. This field |
| 2746 | // may be any value type, _excluding_ references. References _must_ use the |
| 2747 | // 'Ref' variant of this instruction. The offset must be representable as a |
| 2748 | // 31-bit unsigned integer. |
| 2749 | // |
| 2750 | // This instruction takes a second object `keepAlive` that must be kept alive, |
| 2751 | // as described for MWasmLoadField above. |
| 2752 | class MWasmStoreField : public MTernaryInstruction, public NoTypePolicy::Data { |
| 2753 | uint32_t offset_; |
| 2754 | mozilla::Maybe<uint32_t> structFieldIndex_; |
| 2755 | MNarrowingOp narrowingOp_; |
| 2756 | AliasSet aliases_; |
| 2757 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2758 | |
| 2759 | MWasmStoreField(MDefinition* base, MDefinition* keepAlive, size_t offset, |
| 2760 | mozilla::Maybe<uint32_t> structFieldIndex, MDefinition* value, |
| 2761 | MNarrowingOp narrowingOp, AliasSet aliases, |
| 2762 | wasm::MaybeTrapSiteDesc maybeTrap = mozilla::Nothing()) |
| 2763 | : MTernaryInstruction(classOpcode, base, value, |
| 2764 | keepAlive ? keepAlive : base), |
| 2765 | offset_(uint32_t(offset)), |
| 2766 | structFieldIndex_(structFieldIndex), |
| 2767 | narrowingOp_(narrowingOp), |
| 2768 | aliases_(aliases), |
| 2769 | maybeTrap_(std::move(maybeTrap)) { |
| 2770 | 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", 2770); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "offset <= (2147483647)" ")"); do { MOZ_CrashSequence (__null, 2770); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2771 | 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", 2771); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() != MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 2771); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2772 | // "if you want to narrow the value when it is stored, the source type |
| 2773 | // must be Int32". |
| 2774 | 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" , 2775); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 2775); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
| 2775 | 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" , 2775); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 2775); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
| 2776 | 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", 2783); 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, 2783); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2777 | 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", 2783); 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, 2783); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2778 | 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", 2783); 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, 2783); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2779 | 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", 2783); 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, 2783); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2780 | 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", 2783); 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, 2783); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2781 | 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", 2783); 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, 2783); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2782 | 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", 2783); 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, 2783); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2783 | 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", 2783); 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, 2783); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2784 | if (maybeTrap_) { |
| 2785 | setGuard(); |
| 2786 | } |
| 2787 | } |
| 2788 | |
| 2789 | public: |
| 2790 | INSTRUCTION_HEADER(WasmStoreField) |
| 2791 | 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)...); } |
| 2792 | 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); } |
| 2793 | |
| 2794 | uint32_t offset() const { return offset_; } |
| 2795 | mozilla::Maybe<uint32_t> structFieldIndex() const { |
| 2796 | return structFieldIndex_; |
| 2797 | } |
| 2798 | MNarrowingOp narrowingOp() const { return narrowingOp_; } |
| 2799 | AliasSet getAliasSet() const override { return aliases_; } |
| 2800 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2801 | |
| 2802 | #ifdef JS_JITSPEW1 |
| 2803 | void getExtras(ExtrasCollector* extras) const override { |
| 2804 | char buf[96]; |
| 2805 | SprintfLiteral(buf, "(offs=%lld, narrowingOp=%s)", (long long int)offset_, |
| 2806 | StringFromMNarrowingOp(narrowingOp_)); |
| 2807 | extras->add(buf); |
| 2808 | } |
| 2809 | #endif |
| 2810 | |
| 2811 | 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", 2811); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2811); __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; } |
| 2812 | }; |
| 2813 | |
| 2814 | // Stores a reference value to a location, denoted as a fixed offset from a |
| 2815 | // base pointer, which (it is assumed) is within a wasm object. This |
| 2816 | // instruction emits a pre-barrier. A post barrier _must_ be performed |
| 2817 | // separately. The offset must be representable as a 31-bit unsigned integer. |
| 2818 | // |
| 2819 | // This instruction takes a second object `keepAlive` that must be kept alive, |
| 2820 | // as described for MWasmLoadField above. |
| 2821 | class MWasmStoreFieldRef : public MAryInstruction<4>, |
| 2822 | public NoTypePolicy::Data { |
| 2823 | uint32_t offset_; |
| 2824 | mozilla::Maybe<uint32_t> structFieldIndex_; |
| 2825 | AliasSet aliases_; |
| 2826 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2827 | WasmPreBarrierKind preBarrierKind_; |
| 2828 | |
| 2829 | MWasmStoreFieldRef(MDefinition* instance, MDefinition* base, |
| 2830 | MDefinition* keepAlive, size_t offset, |
| 2831 | mozilla::Maybe<uint32_t> structFieldIndex, |
| 2832 | MDefinition* value, AliasSet aliases, |
| 2833 | wasm::MaybeTrapSiteDesc maybeTrap, |
| 2834 | WasmPreBarrierKind preBarrierKind) |
| 2835 | : MAryInstruction<4>(classOpcode), |
| 2836 | offset_(uint32_t(offset)), |
| 2837 | structFieldIndex_(structFieldIndex), |
| 2838 | aliases_(aliases), |
| 2839 | maybeTrap_(std::move(maybeTrap)), |
| 2840 | preBarrierKind_(preBarrierKind) { |
| 2841 | 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", 2845); 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, 2845); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2842 | 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", 2845); 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, 2845); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2843 | 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", 2845); 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, 2845); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2844 | 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", 2845); 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, 2845); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2845 | 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", 2845); 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, 2845); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2846 | 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", 2846); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "offset <= (2147483647)" ")"); do { MOZ_CrashSequence (__null, 2846); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 2847 | 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", 2847); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 2847); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2848 | 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", 2855); 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, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2849 | 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", 2855); 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, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2850 | 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", 2855); 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, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2851 | 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", 2855); 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, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2852 | 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", 2855); 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, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2853 | 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", 2855); 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, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2854 | 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", 2855); 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, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2855 | 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", 2855); 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, 2855); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2856 | initOperand(0, instance); |
| 2857 | initOperand(1, base); |
| 2858 | initOperand(2, value); |
| 2859 | initOperand(3, keepAlive ? keepAlive : base); |
| 2860 | if (maybeTrap_) { |
| 2861 | setGuard(); |
| 2862 | } |
| 2863 | } |
| 2864 | |
| 2865 | public: |
| 2866 | INSTRUCTION_HEADER(WasmStoreFieldRef) |
| 2867 | 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)...); } |
| 2868 | 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); } |
| 2869 | |
| 2870 | uint32_t offset() const { return offset_; } |
| 2871 | mozilla::Maybe<uint32_t> structFieldIndex() const { |
| 2872 | return structFieldIndex_; |
| 2873 | } |
| 2874 | AliasSet getAliasSet() const override { return aliases_; } |
| 2875 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2876 | WasmPreBarrierKind preBarrierKind() const { return preBarrierKind_; } |
| 2877 | |
| 2878 | #ifdef JS_JITSPEW1 |
| 2879 | void getExtras(ExtrasCollector* extras) const override { |
| 2880 | char buf[64]; |
| 2881 | SprintfLiteral(buf, "(offs=%lld)", (long long int)offset_); |
| 2882 | extras->add(buf); |
| 2883 | } |
| 2884 | #endif |
| 2885 | |
| 2886 | 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", 2886); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2886); __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; } |
| 2887 | }; |
| 2888 | |
| 2889 | // Stores a non-reference value to a base pointer, given an index and element |
| 2890 | // size. This field may be any value type, excluding references. References MUST |
| 2891 | // use the 'Ref' variant of this instruction. |
| 2892 | // |
| 2893 | // The element size is implicitly defined by MIRType and MNarrowingOp. For |
| 2894 | // example, MIRType::Float32 indicates an element size of 32 bits, and |
| 2895 | // MIRType::Int32 and MNarrowingOp::To16 together indicate an element size of 16 |
| 2896 | // bits. |
| 2897 | // |
| 2898 | // This instruction takes a second object `keepAlive` that must be kept alive, |
| 2899 | // as described for MWasmLoadField above. |
| 2900 | class MWasmStoreElement : public MQuaternaryInstruction, |
| 2901 | public NoTypePolicy::Data { |
| 2902 | MNarrowingOp narrowingOp_; |
| 2903 | Scale scale_; |
| 2904 | AliasSet aliases_; |
| 2905 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2906 | |
| 2907 | MWasmStoreElement(MDefinition* base, MDefinition* index, MDefinition* value, |
| 2908 | MDefinition* keepAlive, MNarrowingOp narrowingOp, |
| 2909 | Scale scale, AliasSet aliases, |
| 2910 | wasm::MaybeTrapSiteDesc maybeTrap = mozilla::Nothing()) |
| 2911 | : MQuaternaryInstruction(classOpcode, base, index, value, |
| 2912 | keepAlive ? keepAlive : base), |
| 2913 | narrowingOp_(narrowingOp), |
| 2914 | scale_(scale), |
| 2915 | aliases_(aliases), |
| 2916 | maybeTrap_(std::move(maybeTrap)) { |
| 2917 | 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", 2917); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2917); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2918 | 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", 2918); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() != MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 2918); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2919 | // "if you want to narrow the value when it is stored, the source type |
| 2920 | // must be Int32". |
| 2921 | 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" , 2922); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 2922); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
| 2922 | 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" , 2922); AnnotateMozCrashReason("MOZ_ASSERT" "(" "value->type() == MIRType::Int32" ")"); do { MOZ_CrashSequence(__null, 2922); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
| 2923 | 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", 2925); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2925); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2924 | 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", 2925); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2925); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2925 | 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", 2925); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2925); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2926 | if (maybeTrap_) { |
| 2927 | setGuard(); |
| 2928 | } |
| 2929 | } |
| 2930 | |
| 2931 | public: |
| 2932 | INSTRUCTION_HEADER(WasmStoreElement) |
| 2933 | 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)...); } |
| 2934 | 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); } |
| 2935 | |
| 2936 | MNarrowingOp narrowingOp() const { return narrowingOp_; } |
| 2937 | Scale scale() const { return scale_; } |
| 2938 | AliasSet getAliasSet() const override { return aliases_; } |
| 2939 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 2940 | |
| 2941 | #ifdef JS_JITSPEW1 |
| 2942 | void getExtras(ExtrasCollector* extras) const override { |
| 2943 | char buf[96]; |
| 2944 | SprintfLiteral(buf, "(narrowingOp=%s, scale=%s)", |
| 2945 | StringFromMNarrowingOp(narrowingOp_), |
| 2946 | StringFromScale(scale_)); |
| 2947 | extras->add(buf); |
| 2948 | } |
| 2949 | #endif |
| 2950 | |
| 2951 | 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", 2951); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 2951); __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; } |
| 2952 | }; |
| 2953 | |
| 2954 | // Stores a reference value to a base pointer, given an index and element size. |
| 2955 | // This instruction emits a pre-barrier. A post barrier MUST be performed |
| 2956 | // separately. |
| 2957 | // |
| 2958 | // The element size is implicitly defined by MIRType and MNarrowingOp, as |
| 2959 | // described for MWasmStoreElement above. |
| 2960 | // |
| 2961 | // This instruction takes a second object `ka` that must be kept alive, as |
| 2962 | // described for MWasmLoadField above. |
| 2963 | class MWasmStoreElementRef : public MAryInstruction<5>, |
| 2964 | public NoTypePolicy::Data { |
| 2965 | AliasSet aliases_; |
| 2966 | wasm::MaybeTrapSiteDesc maybeTrap_; |
| 2967 | WasmPreBarrierKind preBarrierKind_; |
| 2968 | |
| 2969 | MWasmStoreElementRef(MDefinition* instance, MDefinition* base, |
| 2970 | MDefinition* index, MDefinition* value, |
| 2971 | MDefinition* keepAlive, AliasSet aliases, |
| 2972 | wasm::MaybeTrapSiteDesc maybeTrap, |
| 2973 | WasmPreBarrierKind preBarrierKind) |
| 2974 | : MAryInstruction<5>(classOpcode), |
| 2975 | aliases_(aliases), |
| 2976 | maybeTrap_(std::move(maybeTrap)), |
| 2977 | preBarrierKind_(preBarrierKind) { |
| 2978 | 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", 2978); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "base->type() == MIRType::WasmArrayData" ")"); do { MOZ_CrashSequence(__null, 2978); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2979 | 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", 2979); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "value->type() == MIRType::WasmAnyRef" ")" ); do { MOZ_CrashSequence(__null, 2979); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2980 | 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", 2982); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2982); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2981 | 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", 2982); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2982); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 2982 | 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", 2982); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "aliases.flags() == AliasSet::Store(AliasSet::WasmArrayDataArea).flags() || aliases.flags() == AliasSet::Store(AliasSet::Any).flags()" ")"); do { MOZ_CrashSequence(__null, 2982); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 2983 | initOperand(0, instance); |
| 2984 | initOperand(1, base); |
| 2985 | initOperand(2, index); |
| 2986 | initOperand(3, value); |
| 2987 | initOperand(4, keepAlive ? keepAlive : base); |
| 2988 | if (maybeTrap_) { |
| 2989 | setGuard(); |
| 2990 | } |
| 2991 | } |
| 2992 | |
| 2993 | public: |
| 2994 | INSTRUCTION_HEADER(WasmStoreElementRef) |
| 2995 | 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)...); } |
| 2996 | 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); } |
| 2997 | (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); } |
| 2998 | |
| 2999 | AliasSet getAliasSet() const override { return aliases_; } |
| 3000 | wasm::MaybeTrapSiteDesc maybeTrap() const { return maybeTrap_; } |
| 3001 | WasmPreBarrierKind preBarrierKind() const { return preBarrierKind_; } |
| 3002 | |
| 3003 | 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", 3003); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3003); __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; } |
| 3004 | }; |
| 3005 | |
| 3006 | class MWasmRefAsNonNull : public MUnaryInstruction, public NoTypePolicy::Data { |
| 3007 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3008 | |
| 3009 | MWasmRefAsNonNull(MDefinition* ref, const wasm::TrapSiteDesc& trapSiteDesc) |
| 3010 | : MUnaryInstruction(classOpcode, ref), trapSiteDesc_(trapSiteDesc) { |
| 3011 | setResultType(MIRType::WasmAnyRef); |
| 3012 | setGuard(); |
| 3013 | } |
| 3014 | |
| 3015 | public: |
| 3016 | INSTRUCTION_HEADER(WasmRefAsNonNull) |
| 3017 | 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)...); } |
| 3018 | NAMED_OPERANDS((0, ref))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } |
| 3019 | |
| 3020 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3021 | |
| 3022 | bool congruentTo(const MDefinition* ins) const override { |
| 3023 | return congruentIfOperandsEqual(ins); |
| 3024 | } |
| 3025 | |
| 3026 | wasm::MaybeRefType computeWasmRefType() const override { |
| 3027 | if (ref()->wasmRefType().isNothing()) { |
| 3028 | return wasm::MaybeRefType(); |
| 3029 | } |
| 3030 | return wasm::MaybeRefType(ref()->wasmRefType().value().asNonNullable()); |
| 3031 | } |
| 3032 | |
| 3033 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3034 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3035 | |
| 3036 | 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", 3036); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3036); __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; } |
| 3037 | }; |
| 3038 | |
| 3039 | // Tests if the wasm ref `ref` is a subtype of `destType` and returns the |
| 3040 | // boolean representing the result. |
| 3041 | class MWasmRefTestAbstract : public MUnaryInstruction, |
| 3042 | public NoTypePolicy::Data { |
| 3043 | wasm::RefType destType_; |
| 3044 | |
| 3045 | MWasmRefTestAbstract(MDefinition* ref, wasm::RefType destType) |
| 3046 | : MUnaryInstruction(classOpcode, ref), destType_(destType) { |
| 3047 | 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", 3047); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!destType.isTypeRef()" ")"); do { MOZ_CrashSequence (__null, 3047); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3048 | setResultType(MIRType::Int32); |
| 3049 | setMovable(); |
| 3050 | } |
| 3051 | |
| 3052 | public: |
| 3053 | INSTRUCTION_HEADER(WasmRefTestAbstract) |
| 3054 | 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)...); } |
| 3055 | NAMED_OPERANDS((0, ref))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } |
| 3056 | |
| 3057 | wasm::RefType destType() const { return destType_; }; |
| 3058 | |
| 3059 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3060 | |
| 3061 | bool congruentTo(const MDefinition* ins) const override { |
| 3062 | return congruentIfOperandsEqual(ins) && |
| 3063 | destType() == ins->toWasmRefTestAbstract()->destType(); |
| 3064 | } |
| 3065 | |
| 3066 | HashNumber valueHash() const override { |
| 3067 | HashNumber hn = MUnaryInstruction::valueHash(); |
| 3068 | hn = addU64ToHash(hn, destType().packed().bits()); |
| 3069 | return hn; |
| 3070 | } |
| 3071 | |
| 3072 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3073 | |
| 3074 | 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", 3074); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3074); __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; } |
| 3075 | }; |
| 3076 | |
| 3077 | // Tests if the wasm ref `ref` is a subtype of `superSTV` and returns the |
| 3078 | // boolean representing the result. |
| 3079 | // |
| 3080 | // The actual super type definition must be known at compile time, so that the |
| 3081 | // subtyping depth of super type depth can be used. |
| 3082 | class MWasmRefTestConcrete : public MBinaryInstruction, |
| 3083 | public NoTypePolicy::Data { |
| 3084 | wasm::RefType destType_; |
| 3085 | |
| 3086 | MWasmRefTestConcrete(MDefinition* ref, MDefinition* superSTV, |
| 3087 | wasm::RefType destType) |
| 3088 | : MBinaryInstruction(classOpcode, ref, superSTV), destType_(destType) { |
| 3089 | 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", 3089); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "destType.isTypeRef()" ")"); do { MOZ_CrashSequence (__null, 3089); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3090 | setResultType(MIRType::Int32); |
| 3091 | setMovable(); |
| 3092 | } |
| 3093 | |
| 3094 | public: |
| 3095 | INSTRUCTION_HEADER(WasmRefTestConcrete) |
| 3096 | 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)...); } |
| 3097 | 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); } |
| 3098 | |
| 3099 | wasm::RefType destType() const { return destType_; }; |
| 3100 | |
| 3101 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3102 | |
| 3103 | bool congruentTo(const MDefinition* ins) const override { |
| 3104 | return congruentIfOperandsEqual(ins) && |
| 3105 | destType() == ins->toWasmRefTestConcrete()->destType(); |
| 3106 | } |
| 3107 | |
| 3108 | HashNumber valueHash() const override { |
| 3109 | HashNumber hn = MBinaryInstruction::valueHash(); |
| 3110 | hn = addU64ToHash(hn, destType().packed().bits()); |
| 3111 | return hn; |
| 3112 | } |
| 3113 | |
| 3114 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3115 | |
| 3116 | 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", 3116); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3116); __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; } |
| 3117 | }; |
| 3118 | |
| 3119 | // Tests if the wasm ref `ref` is a subtype of `destType` and if so returns the |
| 3120 | // ref, otherwise it does a wasm trap. |
| 3121 | class MWasmRefCastAbstract : public MUnaryInstruction, |
| 3122 | public NoTypePolicy::Data { |
| 3123 | wasm::RefType destType_; |
| 3124 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3125 | |
| 3126 | MWasmRefCastAbstract(MDefinition* ref, wasm::RefType destType, |
| 3127 | wasm::TrapSiteDesc&& trapSiteDesc) |
| 3128 | : MUnaryInstruction(classOpcode, ref), |
| 3129 | destType_(destType), |
| 3130 | trapSiteDesc_(std::move(trapSiteDesc)) { |
| 3131 | 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", 3131); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "!destType.isTypeRef()" ")"); do { MOZ_CrashSequence (__null, 3131); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3132 | setResultType(MIRType::WasmAnyRef); |
| 3133 | // This may trap, which requires this to be a guard. |
| 3134 | setGuard(); |
| 3135 | setWasmRefType(wasm::MaybeRefType(destType)); |
| 3136 | } |
| 3137 | |
| 3138 | public: |
| 3139 | INSTRUCTION_HEADER(WasmRefCastAbstract) |
| 3140 | 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)...); } |
| 3141 | NAMED_OPERANDS((0, ref))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } |
| 3142 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3143 | |
| 3144 | wasm::RefType destType() const { return destType_; }; |
| 3145 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3146 | |
| 3147 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3148 | }; |
| 3149 | |
| 3150 | // Tests if the wasm ref `ref` is a subtype of `superSTV`, if so return the |
| 3151 | // ref, otherwise do a wasm trap. |
| 3152 | // |
| 3153 | // The actual super type definition must be known at compile time, so that the |
| 3154 | // subtyping depth of super type depth can be used. |
| 3155 | class MWasmRefCastConcrete : public MBinaryInstruction, |
| 3156 | public NoTypePolicy::Data { |
| 3157 | wasm::RefType destType_; |
| 3158 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3159 | |
| 3160 | MWasmRefCastConcrete(MDefinition* ref, MDefinition* superSTV, |
| 3161 | wasm::RefType destType, |
| 3162 | wasm::TrapSiteDesc&& trapSiteDesc) |
| 3163 | : MBinaryInstruction(classOpcode, ref, superSTV), |
| 3164 | destType_(destType), |
| 3165 | trapSiteDesc_(std::move(trapSiteDesc)) { |
| 3166 | 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", 3166); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "destType.isTypeRef()" ")"); do { MOZ_CrashSequence (__null, 3166); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3167 | setResultType(MIRType::WasmAnyRef); |
| 3168 | // This may trap, which requires this to be a guard. |
| 3169 | setGuard(); |
| 3170 | setWasmRefType(wasm::MaybeRefType(destType)); |
| 3171 | } |
| 3172 | |
| 3173 | public: |
| 3174 | INSTRUCTION_HEADER(WasmRefCastConcrete) |
| 3175 | 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)...); } |
| 3176 | 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); } |
| 3177 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3178 | |
| 3179 | wasm::RefType destType() const { return destType_; }; |
| 3180 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3181 | |
| 3182 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3183 | }; |
| 3184 | |
| 3185 | class MWasmRefConvertAnyExtern : public MUnaryInstruction, |
| 3186 | public NoTypePolicy::Data { |
| 3187 | wasm::RefType::Kind destTypeKind_; |
| 3188 | |
| 3189 | MWasmRefConvertAnyExtern(MDefinition* ref, wasm::RefType::Kind destTypeKind) |
| 3190 | : MUnaryInstruction(classOpcode, ref), destTypeKind_(destTypeKind) { |
| 3191 | 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", 3192); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "destTypeKind_ == wasm::RefType::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern" ")"); do { MOZ_CrashSequence(__null, 3192); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 3192 | 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", 3192); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "destTypeKind_ == wasm::RefType::Kind::Any || destTypeKind_ == wasm::RefType::Kind::Extern" ")"); do { MOZ_CrashSequence(__null, 3192); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3193 | setResultType(MIRType::WasmAnyRef); |
| 3194 | setMovable(); |
| 3195 | } |
| 3196 | |
| 3197 | public: |
| 3198 | INSTRUCTION_HEADER(WasmRefConvertAnyExtern) |
| 3199 | 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)...); } |
| 3200 | NAMED_OPERANDS((0, ref))static constexpr size_t refOperand = 0; MDefinition* ref() const { return getOperand(0); } |
| 3201 | |
| 3202 | wasm::RefType::Kind destTypeKind() const { return destTypeKind_; } |
| 3203 | |
| 3204 | wasm::MaybeRefType computeWasmRefType() const override { |
| 3205 | bool nullable = true; |
| 3206 | if (ref()->wasmRefType().isSome()) { |
| 3207 | nullable = ref()->wasmRefType().value().isNullable(); |
| 3208 | }; |
| 3209 | return wasm::MaybeRefType(wasm::RefType::fromKind(destTypeKind_, nullable)); |
| 3210 | } |
| 3211 | |
| 3212 | bool congruentTo(const MDefinition* ins) const override { |
| 3213 | return congruentIfOperandsEqual(ins) && |
| 3214 | destTypeKind() == ins->toWasmRefConvertAnyExtern()->destTypeKind(); |
| 3215 | } |
| 3216 | |
| 3217 | HashNumber valueHash() const override { |
| 3218 | HashNumber hn = MUnaryInstruction::valueHash(); |
| 3219 | hn = addU32ToHash(hn, destTypeKind()); |
| 3220 | return hn; |
| 3221 | } |
| 3222 | |
| 3223 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3224 | }; |
| 3225 | |
| 3226 | class MWasmNewStructObject : public MBinaryInstruction, |
| 3227 | public NoTypePolicy::Data { |
| 3228 | private: |
| 3229 | const wasm::TypeDef* typeDef_; |
| 3230 | bool zeroFields_; |
| 3231 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3232 | |
| 3233 | MWasmNewStructObject(MDefinition* instance, MDefinition* allocSite, |
| 3234 | const wasm::TypeDef* typeDef, bool zeroFields, |
| 3235 | const wasm::TrapSiteDesc& trapSiteDesc) |
| 3236 | : MBinaryInstruction(classOpcode, instance, allocSite), |
| 3237 | typeDef_(typeDef), |
| 3238 | zeroFields_(zeroFields), |
| 3239 | trapSiteDesc_(trapSiteDesc) { |
| 3240 | 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", 3240); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "typeDef->isStructType()" ")"); do { MOZ_CrashSequence (__null, 3240); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3241 | setResultType(MIRType::WasmAnyRef); |
| 3242 | setWasmRefType( |
| 3243 | wasm::MaybeRefType(wasm::RefType::fromTypeDef(typeDef_, false))); |
| 3244 | } |
| 3245 | |
| 3246 | public: |
| 3247 | INSTRUCTION_HEADER(WasmNewStructObject) |
| 3248 | 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)...); } |
| 3249 | 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); } |
| 3250 | |
| 3251 | AliasSet getAliasSet() const override { |
| 3252 | if (js::SupportDifferentialTesting()) { |
| 3253 | // Consider allocations effectful for differential testing. |
| 3254 | return MDefinition::getAliasSet(); |
| 3255 | } |
| 3256 | return AliasSet::None(); |
| 3257 | } |
| 3258 | const wasm::TypeDef& typeDef() { return *typeDef_; } |
| 3259 | const wasm::StructType& structType() const { return typeDef_->structType(); } |
| 3260 | bool isOutline() const { return typeDef_->structType().hasOOL(); } |
| 3261 | bool zeroFields() const { return zeroFields_; } |
| 3262 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3263 | gc::AllocKind allocKind() const { return typeDef_->structType().allocKind_; } |
| 3264 | }; |
| 3265 | |
| 3266 | // Represents the contents of all fields of a wasm struct. |
| 3267 | // This class will be used for scalar replacement of wasm structs. |
| 3268 | class MWasmStructState : public TempObject { |
| 3269 | private: |
| 3270 | MWasmNewStructObject* wasmStruct_; |
| 3271 | // Represents the fields of this struct. |
| 3272 | Vector<MDefinition*, 0, JitAllocPolicy> fields_; |
| 3273 | |
| 3274 | explicit MWasmStructState(TempAllocator& alloc, |
| 3275 | MWasmNewStructObject* structObject) |
| 3276 | : wasmStruct_(structObject), fields_(alloc) {} |
| 3277 | |
| 3278 | // Init the fields_ vector. |
| 3279 | [[nodiscard]] bool init(TempAllocator& alloc); |
| 3280 | |
| 3281 | public: |
| 3282 | static MWasmStructState* New(TempAllocator& alloc, |
| 3283 | MWasmNewStructObject* structObject); |
| 3284 | static MWasmStructState* Copy(TempAllocator& alloc, MWasmStructState* state); |
| 3285 | |
| 3286 | size_t numFields() const { return fields_.length(); } |
| 3287 | MWasmNewStructObject* wasmStruct() const { return wasmStruct_; } |
| 3288 | |
| 3289 | // Get the field value based on the position of the field in the struct. |
| 3290 | MDefinition* getField(uint32_t index) const { return fields_[index]; } |
| 3291 | // Set the field offset based on the position of the field in the struct. |
| 3292 | void setField(uint32_t index, MDefinition* def) { fields_[index] = def; } |
| 3293 | }; |
| 3294 | |
| 3295 | class MWasmNewArrayObject : public MTernaryInstruction, |
| 3296 | public NoTypePolicy::Data { |
| 3297 | private: |
| 3298 | const wasm::TypeDef* typeDef_; |
| 3299 | bool zeroFields_; |
| 3300 | wasm::TrapSiteDesc trapSiteDesc_; |
| 3301 | |
| 3302 | MWasmNewArrayObject(MDefinition* instance, MDefinition* numElements, |
| 3303 | MDefinition* allocSite, const wasm::TypeDef* typeDef, |
| 3304 | bool zeroFields, const wasm::TrapSiteDesc& trapSiteDesc) |
| 3305 | : MTernaryInstruction(classOpcode, instance, numElements, allocSite), |
| 3306 | typeDef_(typeDef), |
| 3307 | zeroFields_(zeroFields), |
| 3308 | trapSiteDesc_(trapSiteDesc) { |
| 3309 | 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", 3309); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "typeDef->isArrayType()" ")"); do { MOZ_CrashSequence (__null, 3309); __attribute__((nomerge)) ::abort(); } while ( false); } } while (false); |
| 3310 | setResultType(MIRType::WasmAnyRef); |
| 3311 | setWasmRefType( |
| 3312 | wasm::MaybeRefType(wasm::RefType::fromTypeDef(typeDef_, false))); |
| 3313 | } |
| 3314 | |
| 3315 | public: |
| 3316 | INSTRUCTION_HEADER(WasmNewArrayObject) |
| 3317 | 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)...); } |
| 3318 | 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); } |
| 3319 | |
| 3320 | AliasSet getAliasSet() const override { |
| 3321 | if (js::SupportDifferentialTesting()) { |
| 3322 | // Consider allocations effectful for differential testing. |
| 3323 | return MDefinition::getAliasSet(); |
| 3324 | } |
| 3325 | return AliasSet::None(); |
| 3326 | } |
| 3327 | const wasm::TypeDef& typeDef() { return *typeDef_; } |
| 3328 | const wasm::ArrayType& arrayType() const { return typeDef_->arrayType(); } |
| 3329 | uint32_t elemSize() const { |
| 3330 | return typeDef_->arrayType().elementType().size(); |
| 3331 | } |
| 3332 | bool zeroFields() const { return zeroFields_; } |
| 3333 | const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; } |
| 3334 | }; |
| 3335 | |
| 3336 | // High 64 bits of I128 add/sub |
| 3337 | class MWasmAddSubI128HI64 : public MQuaternaryInstruction, |
| 3338 | public NoTypePolicy::Data { |
| 3339 | bool isAdd_; |
| 3340 | |
| 3341 | MWasmAddSubI128HI64(MDefinition* lhsLo, MDefinition* lhsHi, |
| 3342 | MDefinition* rhsLo, MDefinition* rhsHi, bool isAdd) |
| 3343 | : MQuaternaryInstruction(classOpcode, lhsLo, lhsHi, rhsLo, rhsHi), |
| 3344 | isAdd_(isAdd) { |
| 3345 | 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" , 3345); AnnotateMozCrashReason("MOZ_ASSERT" "(" "lhsLo->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3345); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3346 | 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" , 3346); AnnotateMozCrashReason("MOZ_ASSERT" "(" "lhsHi->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3346); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3347 | 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" , 3347); AnnotateMozCrashReason("MOZ_ASSERT" "(" "rhsLo->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3347); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3348 | 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" , 3348); AnnotateMozCrashReason("MOZ_ASSERT" "(" "rhsHi->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3348); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3349 | setMovable(); |
| 3350 | setResultType(MIRType::Int64); |
| 3351 | } |
| 3352 | |
| 3353 | public: |
| 3354 | INSTRUCTION_HEADER(WasmAddSubI128HI64) |
| 3355 | 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)...); } |
| 3356 | 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); } |
| 3357 | |
| 3358 | bool isAdd() const { return isAdd_; } |
| 3359 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3360 | bool congruentTo(const MDefinition* ins) const override { |
| 3361 | return ins->isWasmAddSubI128HI64() && congruentIfOperandsEqual(ins) && |
| 3362 | ins->toWasmAddSubI128HI64()->isAdd() == isAdd(); |
| 3363 | } |
| 3364 | MDefinition* foldsTo(TempAllocator& alloc) override; |
| 3365 | |
| 3366 | #ifdef JS_JITSPEW1 |
| 3367 | void getExtras(ExtrasCollector* extras) const override { |
| 3368 | char buf[96]; |
| 3369 | SprintfLiteral(buf, "(operation=%s)", isAdd_ ? "ADD" : "SUB"); |
| 3370 | extras->add(buf); |
| 3371 | } |
| 3372 | #endif |
| 3373 | |
| 3374 | 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", 3374); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3374); __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; } |
| 3375 | }; |
| 3376 | |
| 3377 | // High 64 bits of widening I64 x I64 -> I128 multiply |
| 3378 | class MWasmMulI64WideHI64 : public MBinaryInstruction, |
| 3379 | public NoTypePolicy::Data { |
| 3380 | bool isSigned_; |
| 3381 | |
| 3382 | MWasmMulI64WideHI64(MDefinition* lhs, MDefinition* rhs, bool isSigned) |
| 3383 | : MBinaryInstruction(classOpcode, lhs, rhs), isSigned_(isSigned) { |
| 3384 | 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" , 3384); AnnotateMozCrashReason("MOZ_ASSERT" "(" "lhs->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3384); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3385 | 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" , 3385); AnnotateMozCrashReason("MOZ_ASSERT" "(" "rhs->type() == MIRType::Int64" ")"); do { MOZ_CrashSequence(__null, 3385); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 3386 | setMovable(); |
| 3387 | setCommutative(); |
| 3388 | setResultType(MIRType::Int64); |
| 3389 | } |
| 3390 | |
| 3391 | public: |
| 3392 | INSTRUCTION_HEADER(WasmMulI64WideHI64) |
| 3393 | 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)...); } |
| 3394 | 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); } |
| 3395 | |
| 3396 | bool isSigned() const { return isSigned_; } |
| 3397 | AliasSet getAliasSet() const override { return AliasSet::None(); } |
| 3398 | bool congruentTo(const MDefinition* ins) const override { |
| 3399 | return ins->isWasmMulI64WideHI64() && congruentIfOperandsEqual(ins) && |
| 3400 | ins->toWasmMulI64WideHI64()->isSigned() == isSigned(); |
| 3401 | } |
| 3402 | |
| 3403 | #ifdef JS_JITSPEW1 |
| 3404 | void getExtras(ExtrasCollector* extras) const override { |
| 3405 | char buf[96]; |
| 3406 | SprintfLiteral(buf, "(mode=%s)", isSigned_ ? "SIGNED" : "UNSIGNED"); |
| 3407 | extras->add(buf); |
| 3408 | } |
| 3409 | #endif |
| 3410 | |
| 3411 | 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", 3411); AnnotateMozCrashReason ("MOZ_ASSERT" "(" "numOperands() == inputs.length()" ")"); do { MOZ_CrashSequence(__null, 3411); __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; } |
| 3412 | }; |
| 3413 | |
| 3414 | #undef INSTRUCTION_HEADER |
| 3415 | |
| 3416 | #ifdef ENABLE_JIT_SIMD1 |
| 3417 | MWasmShuffleSimd128* BuildWasmShuffleSimd128(TempAllocator& alloc, |
| 3418 | const int8_t* control, |
| 3419 | MDefinition* lhs, |
| 3420 | MDefinition* rhs); |
| 3421 | #endif // ENABLE_JIT_SIMD |
| 3422 | |
| 3423 | } // namespace jit |
| 3424 | } // namespace js |
| 3425 | |
| 3426 | #endif /* jit_MIR_wasm_h */ |