Skip to content

Commit

Permalink
Bug 1944011 - Part 43: Generate boilerplate for LBoxFloatingPoint. r=…
Browse files Browse the repository at this point in the history
  • Loading branch information
anba committed Jan 31, 2025
1 parent e938cad commit eb91f70
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 59 deletions.
24 changes: 21 additions & 3 deletions js/src/jit/LIROps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4927,7 +4927,13 @@

#ifdef JS_CODEGEN_X86
- name: BoxFloatingPoint
gen_boilerplate: false
result_type: BoxedValue
operands:
input: WordSized
arguments:
type: MIRType
num_temps: 2
extra_name: true

- name: DivOrModI64
gen_boilerplate: false
Expand Down Expand Up @@ -5036,7 +5042,13 @@

#ifdef JS_CODEGEN_ARM
- name: BoxFloatingPoint
gen_boilerplate: false
result_type: BoxedValue
operands:
input: WordSized
arguments:
type: MIRType
num_temps: 1
extra_name: true

- name: DivOrModI64
gen_boilerplate: false
Expand Down Expand Up @@ -5206,7 +5218,13 @@

#ifdef JS_CODEGEN_MIPS32
- name: BoxFloatingPoint
gen_boilerplate: false
result_type: BoxedValue
operands:
input: WordSized
arguments:
type: MIRType
num_temps: 1
extra_name: true

- name: DivOrModI64
gen_boilerplate: false
Expand Down
25 changes: 8 additions & 17 deletions js/src/jit/arm/LIR-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@
namespace js {
namespace jit {

class LBoxFloatingPoint : public LInstructionHelper<2, 1, 1> {
MIRType type_;

public:
LIR_HEADER(BoxFloatingPoint);

LBoxFloatingPoint(const LAllocation& in, const LDefinition& temp,
MIRType type)
: LInstructionHelper(classOpcode), type_(type) {
setOperand(0, in);
setTemp(0, temp);
}

MIRType type() const { return type_; }
const char* extraName() const { return StringFromMIRType(type_); }
};

class LUnbox : public LInstructionHelper<1, 2, 0> {
public:
LIR_HEADER(Unbox);
Expand Down Expand Up @@ -202,6 +185,14 @@ class LSoftUDivOrMod : public LBinaryCallInstructionHelper<1, 0> {
MInstruction* mir() { return mir_->toInstruction(); }
};

// Definitions for `extraName` methods of generated LIR instructions.

#ifdef JS_JITSPEW
const char* LBoxFloatingPoint::extraName() const {
return StringFromMIRType(type_);
}
#endif

} // namespace jit
} // namespace js

Expand Down
25 changes: 8 additions & 17 deletions js/src/jit/mips32/LIR-mips32.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@
namespace js {
namespace jit {

class LBoxFloatingPoint : public LInstructionHelper<2, 1, 1> {
MIRType type_;

public:
LIR_HEADER(BoxFloatingPoint);

LBoxFloatingPoint(const LAllocation& in, const LDefinition& temp,
MIRType type)
: LInstructionHelper(classOpcode), type_(type) {
setOperand(0, in);
setTemp(0, temp);
}

MIRType type() const { return type_; }
const char* extraName() const { return StringFromMIRType(type_); }
};

class LUnbox : public LInstructionHelper<1, 2, 0> {
public:
LIR_HEADER(Unbox);
Expand Down Expand Up @@ -125,6 +108,14 @@ class LUDivOrModI64
}
};

// Definitions for `extraName` methods of generated LIR instructions.

#ifdef JS_JITSPEW
const char* LBoxFloatingPoint::extraName() const {
return StringFromMIRType(type_);
}
#endif

} // namespace jit
} // namespace js

Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/x86/CodeGenerator-x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void CodeGenerator::visitBoxFloatingPoint(LBoxFloatingPoint* box) {
masm.moveValue(TypedOrValueRegister(box->type(), in), out);

if (JitOptions.spectreValueMasking) {
Register scratch = ToRegister(box->spectreTemp());
Register scratch = ToRegister(box->temp1());
masm.move32(Imm32(JSVAL_TAG_CLEAR), scratch);
masm.cmp32Move32(Assembler::Below, scratch, out.typeReg(), scratch,
out.typeReg());
Expand Down
29 changes: 8 additions & 21 deletions js/src/jit/x86/LIR-x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,6 @@
namespace js {
namespace jit {

class LBoxFloatingPoint : public LInstructionHelper<2, 1, 2> {
MIRType type_;

public:
LIR_HEADER(BoxFloatingPoint);

LBoxFloatingPoint(const LAllocation& in, const LDefinition& temp,
const LDefinition& spectreTemp, MIRType type)
: LInstructionHelper(classOpcode), type_(type) {
MOZ_ASSERT(IsFloatingPointType(type));
setOperand(0, in);
setTemp(0, temp);
setTemp(1, spectreTemp);
}

const LDefinition* spectreTemp() { return getTemp(1); }

MIRType type() const { return type_; }
const char* extraName() const { return StringFromMIRType(type_); }
};

class LUnbox : public LInstructionHelper<1, 2, 0> {
public:
LIR_HEADER(Unbox);
Expand Down Expand Up @@ -135,6 +114,14 @@ class LUDivOrModI64
}
};

// Definitions for `extraName` methods of generated LIR instructions.

#ifdef JS_JITSPEW
const char* LBoxFloatingPoint::extraName() const {
return StringFromMIRType(type_);
}
#endif

} // namespace jit
} // namespace js

Expand Down

0 comments on commit eb91f70

Please sign in to comment.