Index: src/compiler/arm/code-generator-arm.cc |
diff --git a/src/compiler/arm/code-generator-arm.cc b/src/compiler/arm/code-generator-arm.cc |
index 9e06b601ae1b360f6d9909c7249b3ee86a4415d0..8d7df3d7195fa36db4619e6dcdaef9f054734ca4 100644 |
--- a/src/compiler/arm/code-generator-arm.cc |
+++ b/src/compiler/arm/code-generator-arm.cc |
@@ -149,8 +149,8 @@ class ArmOperandConverter final : public InstructionOperandConverter { |
MemOperand ToMemOperand(InstructionOperand* op) 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()); |
return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); |
} |
}; |
@@ -359,16 +359,14 @@ void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
if (sp_slot_delta > 0) { |
__ add(sp, sp, 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()) { |
if (FLAG_enable_embedded_constant_pool) { |
__ ldm(ia_w, sp, pp.bit() | fp.bit() | lr.bit()); |
} else { |
__ ldm(ia_w, sp, fp.bit() | lr.bit()); |
} |
} |
+ frame_access_state()->SetFrameAccessToDefault(); |
} |
@@ -376,7 +374,9 @@ void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) { |
int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
if (sp_slot_delta < 0) { |
__ sub(sp, sp, Operand(-sp_slot_delta * kPointerSize)); |
+ frame_access_state()->IncreaseSPDelta(-sp_slot_delta); |
} |
+ frame_access_state()->SetFrameAccessToSP(); |
} |
@@ -399,6 +399,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
} |
RecordCallPosition(instr); |
DCHECK_EQ(LeaveCC, i.OutputSBit()); |
+ frame_access_state()->ClearSPDelta(); |
break; |
} |
case kArchTailCallCodeObject: { |
@@ -413,6 +414,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
__ Jump(ip); |
} |
DCHECK_EQ(LeaveCC, i.OutputSBit()); |
+ frame_access_state()->ClearSPDelta(); |
break; |
} |
case kArchCallJSFunction: { |
@@ -428,6 +430,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
__ Call(ip); |
RecordCallPosition(instr); |
DCHECK_EQ(LeaveCC, i.OutputSBit()); |
+ frame_access_state()->ClearSPDelta(); |
break; |
} |
case kArchTailCallJSFunction: { |
@@ -443,6 +446,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
__ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
__ Jump(ip); |
DCHECK_EQ(LeaveCC, i.OutputSBit()); |
+ frame_access_state()->ClearSPDelta(); |
break; |
} |
case kArchLazyBailout: { |
@@ -453,6 +457,8 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
case kArchPrepareCallCFunction: { |
int const num_parameters = MiscField::decode(instr->opcode()); |
__ PrepareCallCFunction(num_parameters, kScratchReg); |
+ // Frame alignment requires using FP-relative frame addressing. |
+ frame_access_state()->SetFrameAccessToFP(); |
break; |
} |
case kArchPrepareTailCall: |
@@ -467,6 +473,8 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
Register func = i.InputRegister(0); |
__ CallCFunction(func, num_parameters); |
} |
+ frame_access_state()->SetFrameAccessToDefault(); |
+ frame_access_state()->ClearSPDelta(); |
break; |
} |
case kArchJmp: |
@@ -921,8 +929,10 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
case kArmPush: |
if (instr->InputAt(0)->IsDoubleRegister()) { |
__ vpush(i.InputDoubleRegister(0)); |
+ frame_access_state()->IncreaseSPDelta(kDoubleSize / kPointerSize); |
} else { |
__ push(i.InputRegister(0)); |
+ frame_access_state()->IncreaseSPDelta(1); |
} |
DCHECK_EQ(LeaveCC, i.OutputSBit()); |
break; |
@@ -1044,7 +1054,7 @@ void CodeGenerator::AssembleDeoptimizerCall( |
void CodeGenerator::AssemblePrologue() { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
- if (descriptor->kind() == CallDescriptor::kCallAddress) { |
+ if (descriptor->IsCFunctionCall()) { |
if (FLAG_enable_embedded_constant_pool) { |
__ Push(lr, fp, pp); |
// Adjust FP to point to saved FP. |
@@ -1056,11 +1066,12 @@ void CodeGenerator::AssemblePrologue() { |
} else if (descriptor->IsJSFunctionCall()) { |
CompilationInfo* info = this->info(); |
__ Prologue(info->IsCodePreAgingActive()); |
- } else if (needs_frame_) { |
+ } else if (frame()->needs_frame()) { |
__ StubPrologue(); |
} else { |
frame()->SetElidedFrameSizeInSlots(0); |
} |
+ frame_access_state()->SetFrameAccessToDefault(); |
int stack_shrink_slots = frame()->GetSpillSlotCount(); |
if (info()->is_osr()) { |
@@ -1131,9 +1142,9 @@ void CodeGenerator::AssembleReturn() { |
DwVfpRegister::from_code(last)); |
} |
- if (descriptor->kind() == CallDescriptor::kCallAddress) { |
+ if (descriptor->IsCFunctionCall()) { |
__ LeaveFrame(StackFrame::MANUAL); |
- } 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_); |