mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 937540 part 2 - Use placement new for BitSet and LoopAliasInfo. r=sstangl
This commit is contained in:
parent
35a0fbec2b
commit
386698f8bf
@ -148,7 +148,7 @@ AliasAnalysis::analyze()
|
||||
|
||||
if (block->isLoopHeader()) {
|
||||
IonSpew(IonSpew_Alias, "Processing loop header %d", block->id());
|
||||
loop_ = new LoopAliasInfo(loop_, *block);
|
||||
loop_ = new(mir->temp()) LoopAliasInfo(loop_, *block);
|
||||
}
|
||||
|
||||
for (MDefinitionIterator def(*block); def; def++) {
|
||||
|
@ -17,7 +17,8 @@ class MIRGraph;
|
||||
|
||||
typedef Vector<MDefinition *, 4, IonAllocPolicy> InstructionVector;
|
||||
|
||||
class LoopAliasInfo : public TempObject {
|
||||
class LoopAliasInfo : public TempObject
|
||||
{
|
||||
private:
|
||||
LoopAliasInfo *outer_;
|
||||
MBasicBlock *loopHeader_;
|
||||
|
@ -10,21 +10,20 @@ using namespace js;
|
||||
using namespace js::jit;
|
||||
|
||||
BitSet *
|
||||
BitSet::New(unsigned int max)
|
||||
BitSet::New(TempAllocator &alloc, unsigned int max)
|
||||
{
|
||||
BitSet *result = new BitSet(max);
|
||||
if (!result->init())
|
||||
BitSet *result = new(alloc) BitSet(max);
|
||||
if (!result->init(alloc))
|
||||
return nullptr;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
BitSet::init()
|
||||
BitSet::init(TempAllocator &alloc)
|
||||
{
|
||||
size_t sizeRequired = numWords() * sizeof(*bits_);
|
||||
|
||||
TempAllocator *alloc = GetIonContext()->temp;
|
||||
bits_ = (uint32_t *)alloc->allocate(sizeRequired);
|
||||
bits_ = (uint32_t *)alloc.allocate(sizeRequired);
|
||||
if (!bits_)
|
||||
return false;
|
||||
|
||||
|
@ -44,12 +44,12 @@ class BitSet : private TempObject
|
||||
return RawLengthForBits(max_);
|
||||
}
|
||||
|
||||
bool init();
|
||||
bool init(TempAllocator &alloc);
|
||||
|
||||
public:
|
||||
class Iterator;
|
||||
|
||||
static BitSet *New(unsigned int max);
|
||||
static BitSet *New(TempAllocator &alloc, unsigned int max);
|
||||
|
||||
unsigned int getMax() const {
|
||||
return max_;
|
||||
|
@ -5700,7 +5700,7 @@ CodeGenerator::generate()
|
||||
gen->info().script()->filename(),
|
||||
gen->info().script()->lineno);
|
||||
|
||||
if (!safepoints_.init(graph.totalSlotCount()))
|
||||
if (!safepoints_.init(gen->temp(), graph.totalSlotCount()))
|
||||
return false;
|
||||
|
||||
#if JS_TRACE_LOGGING
|
||||
|
@ -491,7 +491,7 @@ LiveRangeAllocator<VREG>::buildLivenessInfo()
|
||||
return false;
|
||||
|
||||
Vector<MBasicBlock *, 1, SystemAllocPolicy> loopWorkList;
|
||||
BitSet *loopDone = BitSet::New(graph.numBlockIds());
|
||||
BitSet *loopDone = BitSet::New(alloc(), graph.numBlockIds());
|
||||
if (!loopDone)
|
||||
return false;
|
||||
|
||||
@ -502,7 +502,7 @@ LiveRangeAllocator<VREG>::buildLivenessInfo()
|
||||
LBlock *block = graph.getBlock(i - 1);
|
||||
MBasicBlock *mblock = block->mir();
|
||||
|
||||
BitSet *live = BitSet::New(graph.numVirtualRegisters());
|
||||
BitSet *live = BitSet::New(alloc(), graph.numVirtualRegisters());
|
||||
if (!live)
|
||||
return false;
|
||||
liveIn[mblock->id()] = live;
|
||||
|
@ -18,9 +18,9 @@ using namespace jit;
|
||||
using mozilla::FloorLog2;
|
||||
|
||||
bool
|
||||
SafepointWriter::init(uint32_t slotCount)
|
||||
SafepointWriter::init(TempAllocator &alloc, uint32_t slotCount)
|
||||
{
|
||||
frameSlots_ = BitSet::New(slotCount);
|
||||
frameSlots_ = BitSet::New(alloc, slotCount);
|
||||
if (!frameSlots_)
|
||||
return false;
|
||||
|
||||
|
@ -26,7 +26,7 @@ class SafepointWriter
|
||||
BitSet *frameSlots_;
|
||||
|
||||
public:
|
||||
bool init(uint32_t slotCount);
|
||||
bool init(TempAllocator &alloc, uint32_t slotCount);
|
||||
|
||||
private:
|
||||
// A safepoint entry is written in the order these functions appear.
|
||||
|
Loading…
Reference in New Issue
Block a user