Loading js/src/jit/CodeGenerator.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -16616,6 +16616,17 @@ void CodeGenerator::visitWasmTrap(LWasmTrap* lir) { masm.wasmTrap(mir->trap(), mir->bytecodeOffset()); } void CodeGenerator::visitWasmTrapIfNull(LWasmTrapIfNull* lir) { MOZ_ASSERT(gen->compilingWasm()); const MWasmTrapIfNull* mir = lir->mir(); Label nonNull; Register input = ToRegister(lir->object()); masm.branchTestPtr(Assembler::NonZero, input, input, &nonNull); masm.wasmTrap(mir->trap(), mir->bytecodeOffset()); masm.bind(&nonNull); } void CodeGenerator::visitWasmGcObjectIsSubtypeOf( LWasmGcObjectIsSubtypeOf* ins) { MOZ_ASSERT(gen->compilingWasm()); js/src/jit/LIROps.yaml +5 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,11 @@ - name: WasmTrap mir_op: true - name: WasmTrapIfNull operands: object: WordSized mir_op: true - name: WasmGcObjectIsSubtypeOf mir_op: true operands: Loading js/src/jit/Lowering.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -3354,6 +3354,11 @@ void LIRGenerator::visitWasmTrap(MWasmTrap* ins) { add(new (alloc()) LWasmTrap, ins); } void LIRGenerator::visitWasmTrapIfNull(MWasmTrapIfNull* ins) { auto* lir = new (alloc()) LWasmTrapIfNull(useRegister(ins->value())); add(lir, ins); } void LIRGenerator::visitWasmReinterpret(MWasmReinterpret* ins) { if (ins->type() == MIRType::Int64) { defineInt64(new (alloc()) Loading js/src/jit/MIROps.yaml +11 −0 Original line number Diff line number Diff line Loading @@ -1028,6 +1028,17 @@ - name: WasmTrap gen_boilerplate: false # Trap if the given value is null - name: WasmTrapIfNull operands: value: RefOrNull arguments: trap: wasm::Trap bytecodeOffset: wasm::BytecodeOffset guard: true type_policy: none result_type: None - name: LexicalCheck gen_boilerplate: false Loading js/src/wasm/WasmIonCompile.cpp +3 −22 Original line number Diff line number Diff line Loading @@ -848,29 +848,10 @@ class FunctionCompiler { return true; } MBasicBlock* joinBlock = nullptr; if (!newBlock(curBlock_, &joinBlock)) { return false; } MBasicBlock* trapBlock = nullptr; if (!newBlock(curBlock_, &trapBlock)) { return false; } auto* ins = MWasmTrap::New(alloc(), wasm::Trap::NullPointerDereference, bytecodeOffset()); trapBlock->end(ins); auto* ins = MWasmTrapIfNull::New( alloc(), value, wasm::Trap::NullPointerDereference, bytecodeOffset()); MDefinition* check = compareIsNull(value, JSOp::Ne); if (!check) { return false; } MTest* test = MTest::New(alloc(), check, joinBlock, trapBlock); if (!test) { return false; } curBlock_->end(test); curBlock_ = joinBlock; curBlock_->add(ins); return true; } Loading Loading
js/src/jit/CodeGenerator.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -16616,6 +16616,17 @@ void CodeGenerator::visitWasmTrap(LWasmTrap* lir) { masm.wasmTrap(mir->trap(), mir->bytecodeOffset()); } void CodeGenerator::visitWasmTrapIfNull(LWasmTrapIfNull* lir) { MOZ_ASSERT(gen->compilingWasm()); const MWasmTrapIfNull* mir = lir->mir(); Label nonNull; Register input = ToRegister(lir->object()); masm.branchTestPtr(Assembler::NonZero, input, input, &nonNull); masm.wasmTrap(mir->trap(), mir->bytecodeOffset()); masm.bind(&nonNull); } void CodeGenerator::visitWasmGcObjectIsSubtypeOf( LWasmGcObjectIsSubtypeOf* ins) { MOZ_ASSERT(gen->compilingWasm());
js/src/jit/LIROps.yaml +5 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,11 @@ - name: WasmTrap mir_op: true - name: WasmTrapIfNull operands: object: WordSized mir_op: true - name: WasmGcObjectIsSubtypeOf mir_op: true operands: Loading
js/src/jit/Lowering.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -3354,6 +3354,11 @@ void LIRGenerator::visitWasmTrap(MWasmTrap* ins) { add(new (alloc()) LWasmTrap, ins); } void LIRGenerator::visitWasmTrapIfNull(MWasmTrapIfNull* ins) { auto* lir = new (alloc()) LWasmTrapIfNull(useRegister(ins->value())); add(lir, ins); } void LIRGenerator::visitWasmReinterpret(MWasmReinterpret* ins) { if (ins->type() == MIRType::Int64) { defineInt64(new (alloc()) Loading
js/src/jit/MIROps.yaml +11 −0 Original line number Diff line number Diff line Loading @@ -1028,6 +1028,17 @@ - name: WasmTrap gen_boilerplate: false # Trap if the given value is null - name: WasmTrapIfNull operands: value: RefOrNull arguments: trap: wasm::Trap bytecodeOffset: wasm::BytecodeOffset guard: true type_policy: none result_type: None - name: LexicalCheck gen_boilerplate: false Loading
js/src/wasm/WasmIonCompile.cpp +3 −22 Original line number Diff line number Diff line Loading @@ -848,29 +848,10 @@ class FunctionCompiler { return true; } MBasicBlock* joinBlock = nullptr; if (!newBlock(curBlock_, &joinBlock)) { return false; } MBasicBlock* trapBlock = nullptr; if (!newBlock(curBlock_, &trapBlock)) { return false; } auto* ins = MWasmTrap::New(alloc(), wasm::Trap::NullPointerDereference, bytecodeOffset()); trapBlock->end(ins); auto* ins = MWasmTrapIfNull::New( alloc(), value, wasm::Trap::NullPointerDereference, bytecodeOffset()); MDefinition* check = compareIsNull(value, JSOp::Ne); if (!check) { return false; } MTest* test = MTest::New(alloc(), check, joinBlock, trapBlock); if (!test) { return false; } curBlock_->end(test); curBlock_ = joinBlock; curBlock_->add(ins); return true; } Loading