Commit 33bc6282 authored by danno's avatar danno Committed by Commit bot

Small cleanup refactoring of sp-to-fp offset and slot conversions

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

Cr-Commit-Position: refs/heads/master@{#34709}
parent 28634e57
......@@ -210,10 +210,7 @@ class Arm64OperandConverter final : public InstructionOperandConverter {
FrameOffset offset = frame_access_state()->GetFrameOffset(
AllocatedOperand::cast(op)->index());
if (offset.from_frame_pointer()) {
int from_sp =
offset.offset() +
((frame()->GetSpToFpSlotCount() + frame_access_state()->sp_delta()) *
kPointerSize);
int from_sp = offset.offset() + frame_access_state()->GetSPToFPOffset();
// Convert FP-offsets to SP-offsets if it results in better code.
if (Assembler::IsImmLSUnscaled(from_sp) ||
Assembler::IsImmLSScaled(from_sp, LSDoubleWord)) {
......
......@@ -44,16 +44,13 @@ void FrameAccessState::SetFrameAccessToDefault() {
FrameOffset FrameAccessState::GetFrameOffset(int spill_slot) const {
const int offset =
(StandardFrameConstants::kFixedSlotCountAboveFp - spill_slot - 1) *
kPointerSize;
const int frame_offset = FrameSlotToFPOffset(spill_slot);
if (access_frame_with_fp()) {
DCHECK(frame()->needs_frame());
return FrameOffset::FromFramePointer(offset);
return FrameOffset::FromFramePointer(frame_offset);
} else {
// No frame. Retrieve all parameters relative to stack pointer.
int sp_offset =
offset + ((frame()->GetSpToFpSlotCount() + sp_delta()) * kPointerSize);
int sp_offset = frame_offset + GetSPToFPOffset();
return FrameOffset::FromStackPointer(sp_offset);
}
}
......
......@@ -86,7 +86,7 @@ class Frame : public ZoneObject {
inline int GetTotalFrameSlotCount() const { return frame_slot_count_; }
inline int GetSpToFpSlotCount() const {
inline int GetSPToFPSlotCount() const {
return GetTotalFrameSlotCount() -
StandardFrameConstants::kFixedSlotCountAboveFp;
}
......@@ -225,6 +225,11 @@ class FrameAccessState : public ZoneObject {
void SetFrameAccessToFP() { access_frame_with_fp_ = true; }
void SetFrameAccessToSP() { access_frame_with_fp_ = false; }
int GetSPToFPSlotCount() const {
return frame_->GetSPToFPSlotCount() + sp_delta();
}
int GetSPToFPOffset() const { return GetSPToFPSlotCount() * kPointerSize; }
// Get the frame offset for a given spill slot. The location depends on the
// calling convention and the specific frame layout, and may thus be
// architecture-specific. Negative spill slots indicate arguments on the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment