зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1027897 - IonMonkey: Use FixedList for a few things. r=bhackett
This commit is contained in:
Родитель
7086f3a7bd
Коммит
8a69102407
|
@ -505,44 +505,37 @@ template <typename VREG>
|
|||
class VirtualRegisterMap
|
||||
{
|
||||
private:
|
||||
VREG *vregs_;
|
||||
uint32_t numVregs_;
|
||||
FixedList<VREG> vregs_;
|
||||
|
||||
void operator=(const VirtualRegisterMap &) MOZ_DELETE;
|
||||
VirtualRegisterMap(const VirtualRegisterMap &) MOZ_DELETE;
|
||||
|
||||
public:
|
||||
VirtualRegisterMap()
|
||||
: vregs_(nullptr),
|
||||
numVregs_(0)
|
||||
: vregs_()
|
||||
{ }
|
||||
|
||||
bool init(MIRGenerator *gen, uint32_t numVregs) {
|
||||
vregs_ = gen->allocate<VREG>(numVregs);
|
||||
numVregs_ = numVregs;
|
||||
if (!vregs_)
|
||||
if (!vregs_.init(gen->alloc(), numVregs))
|
||||
return false;
|
||||
memset(vregs_, 0, sizeof(VREG) * numVregs);
|
||||
memset(&vregs_[0], 0, sizeof(VREG) * numVregs);
|
||||
TempAllocator &alloc = gen->alloc();
|
||||
for (uint32_t i = 0; i < numVregs; i++)
|
||||
new(&vregs_[i]) VREG(alloc);
|
||||
return true;
|
||||
}
|
||||
VREG &operator[](unsigned int index) {
|
||||
JS_ASSERT(index < numVregs_);
|
||||
return vregs_[index];
|
||||
}
|
||||
VREG &operator[](const LAllocation *alloc) {
|
||||
JS_ASSERT(alloc->isUse());
|
||||
JS_ASSERT(alloc->toUse()->virtualRegister() < numVregs_);
|
||||
return vregs_[alloc->toUse()->virtualRegister()];
|
||||
}
|
||||
VREG &operator[](const LDefinition *def) {
|
||||
JS_ASSERT(def->virtualRegister() < numVregs_);
|
||||
return vregs_[def->virtualRegister()];
|
||||
}
|
||||
uint32_t numVirtualRegisters() const {
|
||||
return numVregs_;
|
||||
return vregs_.length();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -255,21 +255,17 @@ class InstructionData
|
|||
// Structure to track all moves inserted next to instructions in a graph.
|
||||
class InstructionDataMap
|
||||
{
|
||||
InstructionData *insData_;
|
||||
uint32_t numIns_;
|
||||
FixedList<InstructionData> insData_;
|
||||
|
||||
public:
|
||||
InstructionDataMap()
|
||||
: insData_(nullptr),
|
||||
numIns_(0)
|
||||
: insData_()
|
||||
{ }
|
||||
|
||||
bool init(MIRGenerator *gen, uint32_t numInstructions) {
|
||||
insData_ = gen->allocate<InstructionData>(numInstructions);
|
||||
numIns_ = numInstructions;
|
||||
if (!insData_)
|
||||
if (!insData_.init(gen->alloc(), numInstructions))
|
||||
return false;
|
||||
memset(insData_, 0, sizeof(InstructionData) * numInstructions);
|
||||
memset(&insData_[0], 0, sizeof(InstructionData) * numInstructions);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -286,11 +282,9 @@ class InstructionDataMap
|
|||
return operator[](ins->id());
|
||||
}
|
||||
InstructionData &operator[](uint32_t ins) {
|
||||
JS_ASSERT(ins < numIns_);
|
||||
return insData_[ins];
|
||||
}
|
||||
const InstructionData &operator[](uint32_t ins) const {
|
||||
JS_ASSERT(ins < numIns_);
|
||||
return insData_[ins];
|
||||
}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче