Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: src/compiler/arm64/code-generator-arm64.cc

Issue 1261923007: [turbofan] Unify referencing of stack slots (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/arm64/code-generator-arm64.cc
diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc
index 59c61ba2918a8c36ea5ae776a14751a8a0f72500..1b68577772f9164dca0ff62d8694e922b1c40214 100644
--- a/src/compiler/arm64/code-generator-arm64.cc
+++ b/src/compiler/arm64/code-generator-arm64.cc
@@ -9,6 +9,7 @@
#include "src/compiler/code-generator-impl.h"
#include "src/compiler/gap-resolver.h"
#include "src/compiler/node-matchers.h"
+#include "src/compiler/osr.h"
#include "src/scopes.h"
namespace v8 {
@@ -1083,43 +1084,22 @@ static int AlignedStackSlots(int stack_slots) {
void CodeGenerator::AssemblePrologue() {
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
- int stack_slots = frame()->GetSpillSlotCount();
if (descriptor->kind() == CallDescriptor::kCallAddress) {
__ SetStackPointer(csp);
__ Push(lr, fp);
__ Mov(fp, csp);
-
- // Save FP registers.
- CPURegList saves_fp = CPURegList(CPURegister::kFPRegister, kDRegSizeInBits,
- descriptor->CalleeSavedFPRegisters());
- DCHECK(saves_fp.list() == CPURegList::GetCalleeSavedFP().list());
- int saved_count = saves_fp.Count();
- __ PushCPURegList(saves_fp);
- // Save registers.
- CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits,
- descriptor->CalleeSavedRegisters());
- // TODO(palfia): TF save list is not in sync with
- // CPURegList::GetCalleeSaved(): x30 is missing.
- // DCHECK(saves.list() == CPURegList::GetCalleeSaved().list());
- saved_count += saves.Count();
- __ PushCPURegList(saves);
-
- frame()->SetRegisterSaveAreaSize(saved_count * kPointerSize);
} else if (descriptor->IsJSFunctionCall()) {
CompilationInfo* info = this->info();
__ SetStackPointer(jssp);
__ Prologue(info->IsCodePreAgingActive());
- frame()->SetRegisterSaveAreaSize(
- StandardFrameConstants::kFixedFrameSizeFromFp);
} else if (needs_frame_) {
__ SetStackPointer(jssp);
__ StubPrologue();
- frame()->SetRegisterSaveAreaSize(
- StandardFrameConstants::kFixedFrameSizeFromFp);
} else {
- frame()->SetPCOnStack(false);
+ frame()->SetElidedFrameSizeInSlots(0);
}
+ int stack_shrink_slots = frame()->GetSpillSlotCount();
if (info()->is_osr()) {
// TurboFan OSR-compiled functions cannot be entered directly.
__ Abort(kShouldNotDirectlyEnterOsrFunction);
@@ -1132,42 +1112,60 @@ void CodeGenerator::AssemblePrologue() {
osr_pc_offset_ = __ pc_offset();
// TODO(titzer): cannot address target function == local #-1
__ ldr(x1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
- DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
- stack_slots -= frame()->GetOsrStackSlotCount();
+ stack_shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots();
}
- if (stack_slots > 0) {
+ if (stack_shrink_slots > 0) {
Register sp = __ StackPointer();
if (!sp.Is(csp)) {
- __ Sub(sp, sp, stack_slots * kPointerSize);
+ __ Sub(sp, sp, stack_shrink_slots * kPointerSize);
}
- __ Sub(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize);
+ __ Sub(csp, csp, AlignedStackSlots(stack_shrink_slots) * kPointerSize);
+ }
+
+ // Save FP registers.
+ CPURegList saves_fp = CPURegList(CPURegister::kFPRegister, kDRegSizeInBits,
+ descriptor->CalleeSavedFPRegisters());
+ int saved_count = saves_fp.Count();
+ if (saved_count != 0) {
+ DCHECK(saves_fp.list() == CPURegList::GetCalleeSavedFP().list());
+ __ PushCPURegList(saves_fp);
+ frame()->AllocateSavedCalleeRegisterSlots(saved_count *
+ (kDoubleSize / kPointerSize));
+ }
+ // Save registers.
+ // TODO(palfia): TF save list is not in sync with
+ // CPURegList::GetCalleeSaved(): x30 is missing.
+ // DCHECK(saves.list() == CPURegList::GetCalleeSaved().list());
+ CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits,
+ descriptor->CalleeSavedRegisters());
+ saved_count = saves.Count();
+ if (saved_count != 0) {
+ __ PushCPURegList(saves);
+ frame()->AllocateSavedCalleeRegisterSlots(saved_count);
}
}
void CodeGenerator::AssembleReturn() {
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
- int stack_slots = frame()->GetSpillSlotCount();
- int pop_count = static_cast<int>(descriptor->StackParameterCount());
- if (descriptor->kind() == CallDescriptor::kCallAddress) {
- if (frame()->GetRegisterSaveAreaSize() > 0) {
- // Remove this frame's spill slots first.
- if (stack_slots > 0) {
- __ Add(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize);
- }
- // Restore registers.
- CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits,
- descriptor->CalleeSavedRegisters());
- __ PopCPURegList(saves);
+ // Restore registers.
+ CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits,
+ descriptor->CalleeSavedRegisters());
+ if (saves.Count() != 0) {
+ __ PopCPURegList(saves);
+ }
- CPURegList saves_fp =
- CPURegList(CPURegister::kFPRegister, kDRegSizeInBits,
- descriptor->CalleeSavedFPRegisters());
- __ PopCPURegList(saves_fp);
- }
+ // Restore fp registers.
+ CPURegList saves_fp = CPURegList(CPURegister::kFPRegister, kDRegSizeInBits,
+ descriptor->CalleeSavedFPRegisters());
+ if (saves_fp.Count() != 0) {
+ __ PopCPURegList(saves_fp);
+ }
+ int pop_count = static_cast<int>(descriptor->StackParameterCount());
+ if (descriptor->kind() == CallDescriptor::kCallAddress) {
__ Mov(csp, fp);
__ Pop(fp, lr);
} else if (descriptor->IsJSFunctionCall() || needs_frame_) {
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698