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 { ...@@ -210,10 +210,7 @@ class Arm64OperandConverter final : public InstructionOperandConverter {
FrameOffset offset = frame_access_state()->GetFrameOffset( FrameOffset offset = frame_access_state()->GetFrameOffset(
AllocatedOperand::cast(op)->index()); AllocatedOperand::cast(op)->index());
if (offset.from_frame_pointer()) { if (offset.from_frame_pointer()) {
int from_sp = int from_sp = offset.offset() + frame_access_state()->GetSPToFPOffset();
offset.offset() +
((frame()->GetSpToFpSlotCount() + frame_access_state()->sp_delta()) *
kPointerSize);
// Convert FP-offsets to SP-offsets if it results in better code. // Convert FP-offsets to SP-offsets if it results in better code.
if (Assembler::IsImmLSUnscaled(from_sp) || if (Assembler::IsImmLSUnscaled(from_sp) ||
Assembler::IsImmLSScaled(from_sp, LSDoubleWord)) { Assembler::IsImmLSScaled(from_sp, LSDoubleWord)) {
......
...@@ -44,16 +44,13 @@ void FrameAccessState::SetFrameAccessToDefault() { ...@@ -44,16 +44,13 @@ void FrameAccessState::SetFrameAccessToDefault() {
FrameOffset FrameAccessState::GetFrameOffset(int spill_slot) const { FrameOffset FrameAccessState::GetFrameOffset(int spill_slot) const {
const int offset = const int frame_offset = FrameSlotToFPOffset(spill_slot);
(StandardFrameConstants::kFixedSlotCountAboveFp - spill_slot - 1) *
kPointerSize;
if (access_frame_with_fp()) { if (access_frame_with_fp()) {
DCHECK(frame()->needs_frame()); DCHECK(frame()->needs_frame());
return FrameOffset::FromFramePointer(offset); return FrameOffset::FromFramePointer(frame_offset);
} else { } else {
// No frame. Retrieve all parameters relative to stack pointer. // No frame. Retrieve all parameters relative to stack pointer.
int sp_offset = int sp_offset = frame_offset + GetSPToFPOffset();
offset + ((frame()->GetSpToFpSlotCount() + sp_delta()) * kPointerSize);
return FrameOffset::FromStackPointer(sp_offset); return FrameOffset::FromStackPointer(sp_offset);
} }
} }
......
...@@ -86,7 +86,7 @@ class Frame : public ZoneObject { ...@@ -86,7 +86,7 @@ class Frame : public ZoneObject {
inline int GetTotalFrameSlotCount() const { return frame_slot_count_; } inline int GetTotalFrameSlotCount() const { return frame_slot_count_; }
inline int GetSpToFpSlotCount() const { inline int GetSPToFPSlotCount() const {
return GetTotalFrameSlotCount() - return GetTotalFrameSlotCount() -
StandardFrameConstants::kFixedSlotCountAboveFp; StandardFrameConstants::kFixedSlotCountAboveFp;
} }
...@@ -225,6 +225,11 @@ class FrameAccessState : public ZoneObject { ...@@ -225,6 +225,11 @@ class FrameAccessState : public ZoneObject {
void SetFrameAccessToFP() { access_frame_with_fp_ = true; } void SetFrameAccessToFP() { access_frame_with_fp_ = true; }
void SetFrameAccessToSP() { access_frame_with_fp_ = false; } 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 // 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 // calling convention and the specific frame layout, and may thus be
// architecture-specific. Negative spill slots indicate arguments on the // 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