diff --git a/js/src/jit/LiveRangeAllocator.h b/js/src/jit/LiveRangeAllocator.h index 3c0ffdc6a03d..331ebeaae26b 100644 --- a/js/src/jit/LiveRangeAllocator.h +++ b/js/src/jit/LiveRangeAllocator.h @@ -505,44 +505,37 @@ template class VirtualRegisterMap { private: - VREG *vregs_; - uint32_t numVregs_; + FixedList 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(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(); } }; diff --git a/js/src/jit/RegisterAllocator.h b/js/src/jit/RegisterAllocator.h index 5677ae53ba1e..a22b9ecf4b3a 100644 --- a/js/src/jit/RegisterAllocator.h +++ b/js/src/jit/RegisterAllocator.h @@ -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 insData_; public: InstructionDataMap() - : insData_(nullptr), - numIns_(0) + : insData_() { } bool init(MIRGenerator *gen, uint32_t numInstructions) { - insData_ = gen->allocate(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]; } };