зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1425580 part 3 - Devirtualize LNode::numDefs. r=bbouvier
--HG-- extra : rebase_source : f833d4bbeb12802b1675487b05294ecd05c6dcdc
This commit is contained in:
Родитель
f20cc72147
Коммит
a24f067417
|
@ -666,16 +666,19 @@ class LNode
|
|||
protected:
|
||||
// Bitfields below are all uint32_t to make sure MSVC packs them correctly.
|
||||
uint32_t isCall_ : 1;
|
||||
uint32_t numDefs_ : 4;
|
||||
uint32_t numTemps_ : 4;
|
||||
|
||||
public:
|
||||
explicit LNode(uint32_t numTemps)
|
||||
LNode(uint32_t numDefs, uint32_t numTemps)
|
||||
: mir_(nullptr),
|
||||
block_(nullptr),
|
||||
id_(0),
|
||||
isCall_(false),
|
||||
numDefs_(numDefs),
|
||||
numTemps_(numTemps)
|
||||
{
|
||||
MOZ_ASSERT(numDefs_ == numDefs, "numDefs must fit in bitfield");
|
||||
MOZ_ASSERT(numTemps_ == numTemps, "numTemps must fit in bitfield");
|
||||
}
|
||||
|
||||
|
@ -713,7 +716,9 @@ class LNode
|
|||
|
||||
// Returns the number of outputs of this instruction. If an output is
|
||||
// unallocated, it is an LDefinition, defining a virtual register.
|
||||
virtual size_t numDefs() const = 0;
|
||||
size_t numDefs() const {
|
||||
return numDefs_;
|
||||
}
|
||||
virtual LDefinition* getDef(size_t index) = 0;
|
||||
virtual void setDef(size_t index, const LDefinition& def) = 0;
|
||||
|
||||
|
@ -822,8 +827,8 @@ class LInstruction
|
|||
LMoveGroup* movesAfter_;
|
||||
|
||||
protected:
|
||||
explicit LInstruction(uint32_t numTemps)
|
||||
: LNode(numTemps),
|
||||
LInstruction(uint32_t numDefs, uint32_t numTemps)
|
||||
: LNode(numDefs, numTemps),
|
||||
snapshot_(nullptr),
|
||||
safepoint_(nullptr),
|
||||
inputMoves_(nullptr),
|
||||
|
@ -932,15 +937,12 @@ class LPhi final : public LNode
|
|||
LIR_HEADER(Phi)
|
||||
|
||||
LPhi(MPhi* ins, LAllocation* inputs)
|
||||
: LNode(/* numTemps = */ 0),
|
||||
: LNode(/* numDefs = */ 1, /* numTemps = */ 0),
|
||||
inputs_(inputs)
|
||||
{
|
||||
setMir(ins);
|
||||
}
|
||||
|
||||
size_t numDefs() const override {
|
||||
return 1;
|
||||
}
|
||||
LDefinition* getDef(size_t index) override {
|
||||
MOZ_ASSERT(index == 0);
|
||||
return &def_;
|
||||
|
@ -1083,13 +1085,10 @@ namespace details {
|
|||
|
||||
protected:
|
||||
LInstructionFixedDefsTempsHelper()
|
||||
: LInstruction(Temps)
|
||||
: LInstruction(Defs, Temps)
|
||||
{}
|
||||
|
||||
public:
|
||||
size_t numDefs() const final override {
|
||||
return Defs;
|
||||
}
|
||||
LDefinition* getDef(size_t index) final override {
|
||||
return &defs_[index];
|
||||
}
|
||||
|
|
|
@ -4665,10 +4665,12 @@ LIRGenerator::visitWasmCall(MWasmCall* ins)
|
|||
}
|
||||
|
||||
LInstruction* lir;
|
||||
if (ins->type() == MIRType::Int64)
|
||||
if (ins->type() == MIRType::Int64) {
|
||||
lir = new(alloc()) LWasmCallI64(args, ins->numOperands(), needsBoundsCheck);
|
||||
else
|
||||
lir = new(alloc()) LWasmCall(args, ins->numOperands(), needsBoundsCheck);
|
||||
} else {
|
||||
uint32_t numDefs = (ins->type() != MIRType::None) ? 1 : 0;
|
||||
lir = new(alloc()) LWasmCall(args, ins->numOperands(), numDefs, needsBoundsCheck);
|
||||
}
|
||||
|
||||
if (ins->type() == MIRType::None)
|
||||
add(lir, ins);
|
||||
|
|
|
@ -8994,8 +8994,9 @@ class LWasmCallBase : public LInstruction
|
|||
|
||||
public:
|
||||
|
||||
LWasmCallBase(LAllocation* operands, uint32_t numOperands, bool needsBoundsCheck)
|
||||
: LInstruction(/* numTemps = */ 0),
|
||||
LWasmCallBase(LAllocation* operands, uint32_t numOperands, uint32_t numDefs,
|
||||
bool needsBoundsCheck)
|
||||
: LInstruction(numDefs, /* numTemps = */ 0),
|
||||
operands_(operands),
|
||||
numOperands_(numOperands),
|
||||
needsBoundsCheck_(needsBoundsCheck)
|
||||
|
@ -9055,15 +9056,12 @@ class LWasmCall : public LWasmCallBase
|
|||
public:
|
||||
LIR_HEADER(WasmCall);
|
||||
|
||||
LWasmCall(LAllocation* operands, uint32_t numOperands, bool needsBoundsCheck)
|
||||
: LWasmCallBase(operands, numOperands, needsBoundsCheck),
|
||||
LWasmCall(LAllocation* operands, uint32_t numOperands, uint32_t numDefs, bool needsBoundsCheck)
|
||||
: LWasmCallBase(operands, numOperands, numDefs, needsBoundsCheck),
|
||||
def_(LDefinition::BogusTemp())
|
||||
{}
|
||||
|
||||
// LInstruction interface
|
||||
size_t numDefs() const override {
|
||||
return def_.isBogusTemp() ? 0 : 1;
|
||||
}
|
||||
LDefinition* getDef(size_t index) override {
|
||||
MOZ_ASSERT(numDefs() == 1);
|
||||
MOZ_ASSERT(index == 0);
|
||||
|
@ -9083,16 +9081,13 @@ class LWasmCallI64 : public LWasmCallBase
|
|||
LIR_HEADER(WasmCallI64);
|
||||
|
||||
LWasmCallI64(LAllocation* operands, uint32_t numOperands, bool needsBoundsCheck)
|
||||
: LWasmCallBase(operands, numOperands, needsBoundsCheck)
|
||||
: LWasmCallBase(operands, numOperands, INT64_PIECES, needsBoundsCheck)
|
||||
{
|
||||
for (size_t i = 0; i < numDefs(); i++)
|
||||
defs_[i] = LDefinition::BogusTemp();
|
||||
}
|
||||
|
||||
// LInstruction interface
|
||||
size_t numDefs() const override {
|
||||
return INT64_PIECES;
|
||||
}
|
||||
LDefinition* getDef(size_t index) override {
|
||||
MOZ_ASSERT(index < numDefs());
|
||||
return &defs_[index];
|
||||
|
|
Загрузка…
Ссылка в новой задаче