Bug 1047529 - Move caller field from MResumePoint to MBasicBlock. r=nbp

This commit is contained in:
Ulrich Schoepp 2015-02-24 14:30:02 -05:00
parent 5ce7838926
commit 8c99391bc6
5 changed files with 30 additions and 29 deletions

View File

@ -4432,7 +4432,7 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
callInfo.pushFormals(current);
MResumePoint *outerResumePoint =
MResumePoint::New(alloc(), current, pc, callerResumePoint_, MResumePoint::Outer);
MResumePoint::New(alloc(), current, pc, MResumePoint::Outer);
if (!outerResumePoint)
return false;
current->setOuterResumePoint(outerResumePoint);
@ -5089,7 +5089,7 @@ IonBuilder::inlineObjectGroupFallback(CallInfo &callInfo, MBasicBlock *dispatchB
// Capture stack prior to the call operation. This captures the function.
MResumePoint *preCallResumePoint =
MResumePoint::New(alloc(), dispatchBlock, pc, callerResumePoint_, MResumePoint::ResumeAt);
MResumePoint::New(alloc(), dispatchBlock, pc, MResumePoint::ResumeAt);
if (!preCallResumePoint)
return false;
@ -6771,7 +6771,7 @@ IonBuilder::resume(MInstruction *ins, jsbytecode *pc, MResumePoint::Mode mode)
{
MOZ_ASSERT(ins->isEffectful() || !ins->isMovable());
MResumePoint *resumePoint = MResumePoint::New(alloc(), ins->block(), pc, callerResumePoint_,
MResumePoint *resumePoint = MResumePoint::New(alloc(), ins->block(), pc,
mode);
if (!resumePoint)
return false;
@ -9589,7 +9589,7 @@ IonBuilder::annotateGetPropertyCache(MDefinition *obj, MGetPropertyCache *getPro
if (inlinePropTable->numEntries() > 0) {
// Push the object back onto the stack temporarily to capture the resume point.
current->push(obj);
MResumePoint *resumePoint = MResumePoint::New(alloc(), current, pc, callerResumePoint_,
MResumePoint *resumePoint = MResumePoint::New(alloc(), current, pc,
MResumePoint::ResumeAt);
if (!resumePoint)
return false;

View File

@ -2931,10 +2931,10 @@ MUrsh::NewAsmJS(TempAllocator &alloc, MDefinition *left, MDefinition *right)
}
MResumePoint *
MResumePoint::New(TempAllocator &alloc, MBasicBlock *block, jsbytecode *pc, MResumePoint *parent,
MResumePoint::New(TempAllocator &alloc, MBasicBlock *block, jsbytecode *pc,
Mode mode)
{
MResumePoint *resume = new(alloc) MResumePoint(block, pc, parent, mode);
MResumePoint *resume = new(alloc) MResumePoint(block, pc, mode);
if (!resume->init(alloc))
return nullptr;
resume->inherit(block);
@ -2945,7 +2945,7 @@ MResumePoint *
MResumePoint::New(TempAllocator &alloc, MBasicBlock *block, MResumePoint *model,
const MDefinitionVector &operands)
{
MResumePoint *resume = new(alloc) MResumePoint(block, model->pc(), model->caller(), model->mode());
MResumePoint *resume = new(alloc) MResumePoint(block, model->pc(), model->mode());
// Allocate the same number of operands as the original resume point, and
// copy operands from the operands vector and not the not from the current
@ -2964,7 +2964,7 @@ MResumePoint *
MResumePoint::Copy(TempAllocator &alloc, MResumePoint *src)
{
MResumePoint *resume = new(alloc) MResumePoint(src->block(), src->pc(),
src->caller(), src->mode());
src->mode());
// Copy the operands from the original resume point, and not from the
// current block stack.
if (!resume->operands_.init(alloc, src->numAllocatedOperands()))
@ -2976,11 +2976,9 @@ MResumePoint::Copy(TempAllocator &alloc, MResumePoint *src)
return resume;
}
MResumePoint::MResumePoint(MBasicBlock *block, jsbytecode *pc, MResumePoint *caller,
Mode mode)
MResumePoint::MResumePoint(MBasicBlock *block, jsbytecode *pc, Mode mode)
: MNode(block),
pc_(pc),
caller_(caller),
instruction_(nullptr),
mode_(mode)
{
@ -2993,6 +2991,12 @@ MResumePoint::init(TempAllocator &alloc)
return operands_.init(alloc, block()->stackDepth());
}
MResumePoint*
MResumePoint::caller() const
{
return block_->callerResumePoint();
}
void
MResumePoint::inherit(MBasicBlock *block)
{

View File

@ -246,6 +246,7 @@ class MNode : public TempObject
MBasicBlock *block() const {
return block_;
}
MBasicBlock *caller() const;
// Sets an already set operand, updating use information. If you're looking
// for setOperand, this is probably what you want.
@ -11716,11 +11717,10 @@ class MResumePoint MOZ_FINAL :
MStoresToRecoverList stores_;
jsbytecode *pc_;
MResumePoint *caller_;
MInstruction *instruction_;
Mode mode_;
MResumePoint(MBasicBlock *block, jsbytecode *pc, MResumePoint *parent, Mode mode);
MResumePoint(MBasicBlock *block, jsbytecode *pc, Mode mode);
void inherit(MBasicBlock *state);
protected:
@ -11742,7 +11742,7 @@ class MResumePoint MOZ_FINAL :
public:
static MResumePoint *New(TempAllocator &alloc, MBasicBlock *block, jsbytecode *pc,
MResumePoint *parent, Mode mode);
Mode mode);
static MResumePoint *New(TempAllocator &alloc, MBasicBlock *block, MResumePoint *model,
const MDefinitionVector &operands);
static MResumePoint *Copy(TempAllocator &alloc, MResumePoint *src);
@ -11782,15 +11782,10 @@ class MResumePoint MOZ_FINAL :
jsbytecode *pc() const {
return pc_;
}
MResumePoint *caller() const {
return caller_;
}
void setCaller(MResumePoint *caller) {
caller_ = caller;
}
MResumePoint *caller() const;
uint32_t frameCount() const {
uint32_t count = 1;
for (MResumePoint *it = caller_; it; it = it->caller_)
for (MResumePoint *it = caller(); it; it = it->caller())
count++;
return count;
}

View File

@ -409,11 +409,10 @@ MBasicBlock::inherit(TempAllocator &alloc, BytecodeAnalysis *analysis, MBasicBlo
MOZ_ASSERT(!entryResumePoint_);
// Propagate the caller resume point from the inherited block.
MResumePoint *callerResumePoint = pred ? pred->callerResumePoint() : nullptr;
callerResumePoint_ = pred ? pred->callerResumePoint() : nullptr;
// Create a resume point using our initial stack state.
entryResumePoint_ = new(alloc) MResumePoint(this, pc(), callerResumePoint,
MResumePoint::ResumeAt);
entryResumePoint_ = new(alloc) MResumePoint(this, pc(), MResumePoint::ResumeAt);
if (!entryResumePoint_->init(alloc))
return false;
@ -478,6 +477,8 @@ MBasicBlock::inheritResumePoint(MBasicBlock *pred)
MOZ_ASSERT(kind_ != PENDING_LOOP_HEADER);
MOZ_ASSERT(pred != nullptr);
callerResumePoint_ = pred->callerResumePoint();
if (!predecessors_.append(pred))
return false;
@ -498,8 +499,7 @@ MBasicBlock::initEntrySlots(TempAllocator &alloc)
discardResumePoint(entryResumePoint_);
// Create a resume point using our initial stack state.
entryResumePoint_ = MResumePoint::New(alloc, this, pc(), callerResumePoint(),
MResumePoint::ResumeAt);
entryResumePoint_ = MResumePoint::New(alloc, this, pc(), MResumePoint::ResumeAt);
if (!entryResumePoint_)
return false;
return true;

View File

@ -57,6 +57,8 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
// This block cannot be reached by any means.
bool unreachable_;
MResumePoint *callerResumePoint_;
// Pushes a copy of a local variable or argument.
void pushVariable(uint32_t slot);
@ -545,11 +547,11 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
discardResumePoint(outerResumePoint_);
outerResumePoint_ = nullptr;
}
MResumePoint *callerResumePoint() {
return entryResumePoint() ? entryResumePoint()->caller() : nullptr;
MResumePoint *callerResumePoint() const {
return callerResumePoint_;
}
void setCallerResumePoint(MResumePoint *caller) {
entryResumePoint()->setCaller(caller);
callerResumePoint_ = caller;
}
size_t numEntrySlots() const {
return entryResumePoint()->stackDepth();