Revert "[compiler][linkage] No allocation of slots after aligning a frame"

This reverts commit b18bc2217b.

Reason for revert: Rolling back to previous greedy slot allocator.

tbr=jgruber@chromium.org

Original change's description:
> [compiler][linkage] No allocation of slots after aligning a frame
>
> - Adds DCHECKs to make sure no stack slots are allocated after
>   aligning a frame.
> - Changes Arm64 CodeGenerator::FinishFrame to align the frame after
>   allocating callee-saved registers, and relaxes the constraints on
>   the number of callee-saved registers.
>
> Bug: v8:9198
> Change-Id: Iacb0518b57fa3ea2ff801eda69719f4c32733850
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2694104
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Commit-Queue: Bill Budge <bbudge@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#72781}

Bug: v8:9198
Change-Id: I53f415b7b0f73b57db24859d1199c6a44f911035
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2713204
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72930}
This commit is contained in:
Bill Budge 2021-02-22 21:01:26 +00:00 committed by Commit Bot
parent 4f38417d72
commit e6bc2e5de7
3 changed files with 3 additions and 8 deletions

View File

@ -3051,6 +3051,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
void CodeGenerator::FinishFrame(Frame* frame) {
frame->AlignFrame(16);
auto call_descriptor = linkage()->GetIncomingDescriptor();
// Save FP registers.
@ -3059,6 +3060,7 @@ void CodeGenerator::FinishFrame(Frame* frame) {
int saved_count = saves_fp.Count();
if (saved_count != 0) {
DCHECK(saves_fp.list() == CPURegList::GetCalleeSavedV().list());
DCHECK_EQ(saved_count % 2, 0);
frame->AllocateSavedCalleeRegisterSlots(saved_count *
(kDoubleSize / kSystemPointerSize));
}
@ -3067,9 +3069,9 @@ void CodeGenerator::FinishFrame(Frame* frame) {
call_descriptor->CalleeSavedRegisters());
saved_count = saves.Count();
if (saved_count != 0) {
DCHECK_EQ(saved_count % 2, 0);
frame->AllocateSavedCalleeRegisterSlots(saved_count);
}
frame->AlignFrame(16);
}
void CodeGenerator::AssembleConstructFrame() {

View File

@ -20,7 +20,6 @@ Frame::Frame(int fixed_frame_size_in_slots)
void Frame::AlignFrame(int alignment) {
#if DEBUG
spill_slots_finished_ = true;
frame_aligned_ = true;
#endif
// In the calculations below we assume that alignment is a power of 2.
DCHECK(base::bits::IsPowerOfTwo(alignment));

View File

@ -116,7 +116,6 @@ class V8_EXPORT_PRIVATE Frame : public ZoneObject {
}
void AlignSavedCalleeRegisterSlots(int alignment = kDoubleSize) {
DCHECK(!frame_aligned_);
#if DEBUG
spill_slots_finished_ = true;
#endif
@ -128,7 +127,6 @@ class V8_EXPORT_PRIVATE Frame : public ZoneObject {
}
void AllocateSavedCalleeRegisterSlots(int count) {
DCHECK(!frame_aligned_);
#if DEBUG
spill_slots_finished_ = true;
#endif
@ -140,7 +138,6 @@ class V8_EXPORT_PRIVATE Frame : public ZoneObject {
fixed_slot_count_ + spill_slot_count_ + return_slot_count_);
// Never allocate spill slots after the callee-saved slots are defined.
DCHECK(!spill_slots_finished_);
DCHECK(!frame_aligned_);
int actual_width = std::max({width, AlignedSlotAllocator::kSlotSize});
int actual_alignment =
std::max({alignment, AlignedSlotAllocator::kSlotSize});
@ -167,7 +164,6 @@ class V8_EXPORT_PRIVATE Frame : public ZoneObject {
}
void EnsureReturnSlots(int count) {
DCHECK(!frame_aligned_);
return_slot_count_ = std::max(return_slot_count_, count);
}
@ -175,7 +171,6 @@ class V8_EXPORT_PRIVATE Frame : public ZoneObject {
int ReserveSpillSlots(size_t slot_count) {
DCHECK_EQ(0, spill_slot_count_);
DCHECK(!frame_aligned_);
spill_slot_count_ += static_cast<int>(slot_count);
slot_allocator_.AllocateUnaligned(static_cast<int>(slot_count));
return slot_allocator_.Size() - 1;
@ -192,7 +187,6 @@ class V8_EXPORT_PRIVATE Frame : public ZoneObject {
BitVector* allocated_double_registers_;
#if DEBUG
bool spill_slots_finished_ = false;
bool frame_aligned_ = false;
#endif
};