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

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

Issue 1460183002: [turbofan] Add general support for sp-based frame access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Last comment addressed Created 5 years, 1 month 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.h » ('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 01bb31a87553b5886398584723fdb1b114da1b78..2174019e25ba8444d159c5b82c012aeeae217302 100644
--- a/src/compiler/arm64/code-generator-arm64.cc
+++ b/src/compiler/arm64/code-generator-arm64.cc
@@ -205,11 +205,13 @@ class Arm64OperandConverter final : public InstructionOperandConverter {
MemOperand ToMemOperand(InstructionOperand* op, MacroAssembler* masm) const {
DCHECK(op != NULL);
DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
- FrameOffset offset =
- linkage()->GetFrameOffset(AllocatedOperand::cast(op)->index(), frame());
+ FrameOffset offset = frame_access_state()->GetFrameOffset(
+ AllocatedOperand::cast(op)->index());
if (offset.from_frame_pointer()) {
int from_sp =
- offset.offset() + (frame()->GetSpToFpSlotCount() * kPointerSize);
+ offset.offset() +
+ ((frame()->GetSpToFpSlotCount() + frame_access_state()->sp_delta()) *
+ kPointerSize);
// Convert FP-offsets to SP-offsets if it results in better code.
if (Assembler::IsImmLSUnscaled(from_sp) ||
Assembler::IsImmLSScaled(from_sp, LSDoubleWord)) {
@@ -462,12 +464,10 @@ void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) {
if (sp_slot_delta > 0) {
__ Add(jssp, jssp, Operand(sp_slot_delta * kPointerSize));
}
- CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
- int spill_slots = frame()->GetSpillSlotCount();
- bool has_frame = descriptor->IsJSFunctionCall() || spill_slots > 0;
- if (has_frame) {
+ if (frame()->needs_frame()) {
__ Pop(fp, lr);
}
+ frame_access_state()->SetFrameAccessToDefault();
}
@@ -475,8 +475,9 @@ void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) {
int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
if (sp_slot_delta < 0) {
__ Sub(jssp, jssp, Operand(-sp_slot_delta * kPointerSize));
- frame()->AllocateOutgoingParameterSlots(-sp_slot_delta);
+ frame_access_state()->IncreaseSPDelta(-sp_slot_delta);
}
+ frame_access_state()->SetFrameAccessToSP();
}
@@ -495,7 +496,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ Add(target, target, Code::kHeaderSize - kHeapObjectTag);
__ Call(target);
}
- frame()->ClearOutgoingParameterSlots();
+ frame_access_state()->ClearSPDelta();
RecordCallPosition(instr);
break;
}
@@ -510,7 +511,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ Add(target, target, Code::kHeaderSize - kHeapObjectTag);
__ Jump(target);
}
- frame()->ClearOutgoingParameterSlots();
+ frame_access_state()->ClearSPDelta();
break;
}
case kArchCallJSFunction: {
@@ -526,7 +527,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
}
__ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
__ Call(x10);
- frame()->ClearOutgoingParameterSlots();
+ frame_access_state()->ClearSPDelta();
RecordCallPosition(instr);
break;
}
@@ -544,7 +545,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
AssembleDeconstructActivationRecord(stack_param_delta);
__ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
__ Jump(x10);
- frame()->ClearOutgoingParameterSlots();
+ frame_access_state()->ClearSPDelta();
break;
}
case kArchLazyBailout: {
@@ -572,7 +573,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
}
// CallCFunction only supports register arguments so we never need to call
// frame()->ClearOutgoingParameterSlots() here.
- DCHECK(frame()->GetOutgoingParameterSlotCount() == 0);
+ DCHECK(frame_access_state()->sp_delta() == 0);
break;
}
case kArchJmp:
@@ -858,7 +859,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
break;
case kArm64ClaimForCallArguments: {
__ Claim(i.InputInt32(0));
- frame()->AllocateOutgoingParameterSlots(i.InputInt32(0));
+ frame_access_state()->IncreaseSPDelta(i.InputInt32(0));
break;
}
case kArm64Poke: {
@@ -1263,7 +1264,7 @@ void CodeGenerator::AssembleDeoptimizerCall(
void CodeGenerator::AssemblePrologue() {
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
- if (descriptor->kind() == CallDescriptor::kCallAddress) {
+ if (descriptor->IsCFunctionCall()) {
__ SetStackPointer(csp);
__ Push(lr, fp);
__ Mov(fp, csp);
@@ -1271,12 +1272,13 @@ void CodeGenerator::AssemblePrologue() {
CompilationInfo* info = this->info();
__ SetStackPointer(jssp);
__ Prologue(info->IsCodePreAgingActive());
- } else if (needs_frame_) {
+ } else if (frame()->needs_frame()) {
__ SetStackPointer(jssp);
__ StubPrologue();
} else {
frame()->SetElidedFrameSizeInSlots(0);
}
+ frame_access_state()->SetFrameAccessToDefault();
int stack_shrink_slots = frame()->GetSpillSlotCount();
if (info()->is_osr()) {
@@ -1343,10 +1345,10 @@ void CodeGenerator::AssembleReturn() {
}
int pop_count = static_cast<int>(descriptor->StackParameterCount());
- if (descriptor->kind() == CallDescriptor::kCallAddress) {
+ if (descriptor->IsCFunctionCall()) {
__ Mov(csp, fp);
__ Pop(fp, lr);
- } else if (descriptor->IsJSFunctionCall() || needs_frame_) {
+ } else if (frame()->needs_frame()) {
// Canonicalize JSFunction return sites for now.
if (return_label_.is_bound()) {
__ B(&return_label_);
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/code-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698