Bug 937540 part 2 - Use placement new for BitSet and LoopAliasInfo. r=sstangl

This commit is contained in:
Jan de Mooij 2013-11-16 10:15:30 +01:00
parent 35a0fbec2b
commit 386698f8bf
8 changed files with 16 additions and 16 deletions

View File

@ -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++) {

View File

@ -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_;

View File

@ -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;

View File

@ -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_;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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.