PPC: More simplification and unification of frame handling

Port 55071954bc

Original commit message:
    Frame slots indexes numbers are used more consistently for
    computation in both TurboFan and Crankshaft. Specifically,
    Crankshaft now uses frame slot indexes in LChunk, removing
    the need for some special-case maths when building the
    deoptimization translation table.

R=danno@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1710073002

Cr-Commit-Position: refs/heads/master@{#34126}
This commit is contained in:
mbrandy 2016-02-18 10:34:34 -08:00 committed by Commit bot
parent 63efda35b3
commit 6cd74a7efe
3 changed files with 15 additions and 14 deletions

View File

@ -60,7 +60,7 @@ bool LCodeGen::GenerateCode() {
void LCodeGen::FinishCode(Handle<Code> code) {
DCHECK(is_done());
code->set_stack_slots(GetStackSlotCount());
code->set_stack_slots(GetTotalFrameSlotCount());
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
PopulateDeoptimizationData(code);
}
@ -365,7 +365,7 @@ bool LCodeGen::GenerateJumpTable() {
bool LCodeGen::GenerateSafepointTable() {
DCHECK(is_done());
safepoints_.Emit(masm(), GetStackSlotCount());
safepoints_.Emit(masm(), GetTotalFrameSlotCount());
return !is_aborted();
}
@ -517,7 +517,7 @@ MemOperand LCodeGen::ToMemOperand(LOperand* op) const {
DCHECK(!op->IsDoubleRegister());
DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
if (NeedsEagerFrame()) {
return MemOperand(fp, StackSlotOffset(op->index()));
return MemOperand(fp, FrameSlotToFPOffset(op->index()));
} else {
// Retrieve parameter without eager stack-frame relative to the
// stack-pointer.
@ -529,7 +529,7 @@ MemOperand LCodeGen::ToMemOperand(LOperand* op) const {
MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const {
DCHECK(op->IsDoubleStackSlot());
if (NeedsEagerFrame()) {
return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize);
return MemOperand(fp, FrameSlotToFPOffset(op->index()) + kPointerSize);
} else {
// Retrieve parameter without eager stack-frame relative to the
// stack-pointer.
@ -593,9 +593,6 @@ void LCodeGen::AddToTranslation(LEnvironment* environment,
if (op->IsStackSlot()) {
int index = op->index();
if (index >= 0) {
index += StandardFrameConstants::kFixedFrameSize / kPointerSize;
}
if (is_tagged) {
translation->StoreStackSlot(index);
} else if (is_uint32) {
@ -605,9 +602,6 @@ void LCodeGen::AddToTranslation(LEnvironment* environment,
}
} else if (op->IsDoubleStackSlot()) {
int index = op->index();
if (index >= 0) {
index += StandardFrameConstants::kFixedFrameSize / kPointerSize;
}
translation->StoreDoubleStackSlot(index);
} else if (op->IsRegister()) {
Register reg = ToRegister(op);

View File

@ -44,7 +44,7 @@ class LCodeGen : public LCodeGenBase {
}
bool NeedsEagerFrame() const {
return GetStackSlotCount() > 0 || info()->is_non_deferred_calling() ||
return HasAllocatedStackSlots() || info()->is_non_deferred_calling() ||
!info()->IsStub() || info()->requires_frame();
}
bool NeedsDeferredFrame() const {
@ -141,7 +141,13 @@ class LCodeGen : public LCodeGenBase {
Handle<String> class_name, Register input,
Register temporary, Register temporary2);
int GetStackSlotCount() const { return chunk()->spill_slot_count(); }
bool HasAllocatedStackSlots() const {
return chunk()->HasAllocatedStackSlots();
}
int GetStackSlotCount() const { return chunk()->GetSpillSlotCount(); }
int GetTotalFrameSlotCount() const {
return chunk()->GetTotalFrameSlotCount();
}
void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); }

View File

@ -396,8 +396,8 @@ void LTransitionElementsKind::PrintDataTo(StringStream* stream) {
int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) {
// Skip a slot if for a double-width slot.
if (kind == DOUBLE_REGISTERS) spill_slot_count_++;
return spill_slot_count_++;
if (kind == DOUBLE_REGISTERS) current_frame_slots_++;
return current_frame_slots_++;
}
@ -2409,6 +2409,7 @@ LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
Retry(kTooManySpillSlotsNeededForOSR);
spill_index = 0;
}
spill_index += StandardFrameConstants::kFixedSlotCount;
}
return DefineAsSpilled(new (zone()) LUnknownOSRValue, spill_index);
}