X87: More simplification and unification of frame handling.
port 55071954bc
(r34114)
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.
BUG=
Review URL: https://codereview.chromium.org/1714763002
Cr-Commit-Position: refs/heads/master@{#34134}
This commit is contained in:
parent
a238a30d08
commit
b5dc3dd2c1
@ -9,6 +9,7 @@
|
||||
#include "src/compiler/gap-resolver.h"
|
||||
#include "src/compiler/node-matchers.h"
|
||||
#include "src/compiler/osr.h"
|
||||
#include "src/frames.h"
|
||||
#include "src/x87/assembler-x87.h"
|
||||
#include "src/x87/frames-x87.h"
|
||||
#include "src/x87/macro-assembler-x87.h"
|
||||
@ -50,7 +51,7 @@ class X87OperandConverter : public InstructionOperandConverter {
|
||||
|
||||
Operand ToMaterializableOperand(int materializable_offset) {
|
||||
FrameOffset offset = frame_access_state()->GetFrameOffset(
|
||||
Frame::FPOffsetToSlot(materializable_offset));
|
||||
FPOffsetToFrameSlot(materializable_offset));
|
||||
return Operand(offset.from_stack_pointer() ? esp : ebp, offset.offset());
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
|
||||
// When invoking builtins, we need to record the safepoint in the middle of
|
||||
// the invoke instruction sequence generated by the macro assembler.
|
||||
class SafepointGenerator final : public CallWrapper {
|
||||
@ -75,7 +74,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);
|
||||
if (info()->ShouldEnsureSpaceForLazyDeopt()) {
|
||||
@ -486,7 +485,7 @@ bool LCodeGen::GenerateSafepointTable() {
|
||||
masm()->nop();
|
||||
}
|
||||
}
|
||||
safepoints_.Emit(masm(), GetStackSlotCount());
|
||||
safepoints_.Emit(masm(), GetTotalFrameSlotCount());
|
||||
return !is_aborted();
|
||||
}
|
||||
|
||||
@ -839,7 +838,7 @@ Operand LCodeGen::ToOperand(LOperand* op) const {
|
||||
DCHECK(!op->IsDoubleRegister());
|
||||
DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
|
||||
if (NeedsEagerFrame()) {
|
||||
return Operand(ebp, StackSlotOffset(op->index()));
|
||||
return Operand(ebp, FrameSlotToFPOffset(op->index()));
|
||||
} else {
|
||||
// Retrieve parameter without eager stack-frame relative to the
|
||||
// stack-pointer.
|
||||
@ -851,7 +850,7 @@ Operand LCodeGen::ToOperand(LOperand* op) const {
|
||||
Operand LCodeGen::HighOperand(LOperand* op) {
|
||||
DCHECK(op->IsDoubleStackSlot());
|
||||
if (NeedsEagerFrame()) {
|
||||
return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize);
|
||||
return Operand(ebp, FrameSlotToFPOffset(op->index()) + kPointerSize);
|
||||
} else {
|
||||
// Retrieve parameter without eager stack-frame relative to the
|
||||
// stack-pointer.
|
||||
@ -924,9 +923,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) {
|
||||
@ -936,9 +932,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);
|
||||
|
@ -50,10 +50,8 @@ class LCodeGen: public LCodeGenBase {
|
||||
}
|
||||
|
||||
bool NeedsEagerFrame() const {
|
||||
return GetStackSlotCount() > 0 ||
|
||||
info()->is_non_deferred_calling() ||
|
||||
!info()->IsStub() ||
|
||||
info()->requires_frame();
|
||||
return HasAllocatedStackSlots() || info()->is_non_deferred_calling() ||
|
||||
!info()->IsStub() || info()->requires_frame();
|
||||
}
|
||||
bool NeedsDeferredFrame() const {
|
||||
return !NeedsEagerFrame() && info()->is_deferred_calling();
|
||||
@ -165,7 +163,13 @@ class LCodeGen: public LCodeGenBase {
|
||||
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()); }
|
||||
|
||||
|
@ -355,11 +355,11 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
|
||||
int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) {
|
||||
// Skip a slot if for a double-width slot.
|
||||
if (kind == DOUBLE_REGISTERS) {
|
||||
spill_slot_count_++;
|
||||
spill_slot_count_ |= 1;
|
||||
current_frame_slots_++;
|
||||
current_frame_slots_ |= 1;
|
||||
num_double_slots_++;
|
||||
}
|
||||
return spill_slot_count_++;
|
||||
return current_frame_slots_++;
|
||||
}
|
||||
|
||||
|
||||
@ -448,7 +448,7 @@ LPlatformChunk* LChunkBuilder::Build() {
|
||||
// Reserve the first spill slot for the state of dynamic alignment.
|
||||
if (info()->IsOptimizing()) {
|
||||
int alignment_state_index = chunk_->GetNextSpillIndex(GENERAL_REGISTERS);
|
||||
DCHECK_EQ(alignment_state_index, 0);
|
||||
DCHECK_EQ(alignment_state_index, 4);
|
||||
USE(alignment_state_index);
|
||||
}
|
||||
|
||||
@ -2517,6 +2517,7 @@ LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
|
||||
// The first local is saved at the end of the unoptimized frame.
|
||||
spill_index = graph()->osr()->UnoptimizedFrameSlots();
|
||||
}
|
||||
spill_index += StandardFrameConstants::kFixedSlotCount;
|
||||
}
|
||||
return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user