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

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

Issue 1311013005: Version 4.6.85.7 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.6
Patch Set: 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 | « include/v8-version.h ('k') | src/compiler/ppc/instruction-selector-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ppc/code-generator-ppc.cc
diff --git a/src/compiler/ppc/code-generator-ppc.cc b/src/compiler/ppc/code-generator-ppc.cc
index beb0c7669e2b34c77b499aa71e39629229fa0a16..2acea2f1d5925a17fa4f674188b6239953a8b4e6 100644
--- a/src/compiler/ppc/code-generator-ppc.cc
+++ b/src/compiler/ppc/code-generator-ppc.cc
@@ -7,6 +7,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/ppc/macro-assembler-ppc.h"
#include "src/scopes.h"
@@ -981,7 +982,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
break;
case kPPC_PushFrame: {
int num_slots = i.InputInt32(1);
- __ StorePU(i.InputRegister(0), MemOperand(sp, -num_slots * kPointerSize));
+ if (instr->InputAt(0)->IsDoubleRegister()) {
+ __ stfdu(i.InputDoubleRegister(0),
+ MemOperand(sp, -num_slots * kPointerSize));
+ } else {
+ __ StorePU(i.InputRegister(0),
+ MemOperand(sp, -num_slots * kPointerSize));
+ }
break;
}
case kPPC_StoreToStackSlot: {
@@ -1298,48 +1305,28 @@ void CodeGenerator::AssembleDeoptimizerCall(
void CodeGenerator::AssemblePrologue() {
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
- int stack_slots = frame()->GetSpillSlotCount();
+
if (descriptor->kind() == CallDescriptor::kCallAddress) {
__ function_descriptor();
- RegList frame_saves = 0;
__ mflr(r0);
if (FLAG_enable_embedded_constant_pool) {
__ Push(r0, fp, kConstantPoolRegister);
// Adjust FP to point to saved FP.
__ subi(fp, sp, Operand(StandardFrameConstants::kConstantPoolOffset));
- frame_saves |= kConstantPoolRegister.bit();
} else {
__ Push(r0, fp);
__ mr(fp, sp);
}
-
- // Save callee-saved registers.
- const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves;
- __ MultiPush(saves);
- // register save area does not include the fp.
- DCHECK(kNumCalleeSaved - 1 ==
- base::bits::CountPopulation32(saves | frame_saves));
- int register_save_area_size = (kNumCalleeSaved - 1) * kPointerSize;
-
- // Save callee-saved Double registers.
- const RegList double_saves = descriptor->CalleeSavedFPRegisters();
- __ MultiPushDoubles(double_saves);
- DCHECK(kNumCalleeSavedDoubles ==
- base::bits::CountPopulation32(double_saves));
- register_save_area_size += kNumCalleeSavedDoubles * kDoubleSize;
-
- frame()->SetRegisterSaveAreaSize(register_save_area_size);
} else if (descriptor->IsJSFunctionCall()) {
CompilationInfo* info = this->info();
__ Prologue(info->IsCodePreAgingActive());
- frame()->SetRegisterSaveAreaSize(
- StandardFrameConstants::kFixedFrameSizeFromFp);
} else if (needs_frame_) {
__ StubPrologue();
- frame()->SetRegisterSaveAreaSize(
- StandardFrameConstants::kFixedFrameSizeFromFp);
+ } else {
+ frame()->SetElidedFrameSizeInSlots(0);
}
+ int stack_shrink_slots = frame()->GetSpillSlotCount();
if (info()->is_osr()) {
// TurboFan OSR-compiled functions cannot be entered directly.
__ Abort(kShouldNotDirectlyEnterOsrFunction);
@@ -1352,38 +1339,63 @@ void CodeGenerator::AssemblePrologue() {
osr_pc_offset_ = __ pc_offset();
// TODO(titzer): cannot address target function == local #-1
__ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
- DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
- stack_slots -= frame()->GetOsrStackSlotCount();
+ stack_shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots();
+ }
+
+ const RegList double_saves = descriptor->CalleeSavedFPRegisters();
+ if (double_saves != 0) {
+ stack_shrink_slots += frame()->AlignSavedCalleeRegisterSlots();
+ }
+ if (stack_shrink_slots > 0) {
+ __ Add(sp, sp, -stack_shrink_slots * kPointerSize, r0);
}
- if (stack_slots > 0) {
- __ Add(sp, sp, -stack_slots * kPointerSize, r0);
+ // Save callee-saved Double registers.
+ if (double_saves != 0) {
+ __ MultiPushDoubles(double_saves);
+ DCHECK(kNumCalleeSavedDoubles ==
+ base::bits::CountPopulation32(double_saves));
+ frame()->AllocateSavedCalleeRegisterSlots(kNumCalleeSavedDoubles *
+ (kDoubleSize / kPointerSize));
+ }
+
+ // Save callee-saved registers.
+ const RegList saves =
+ FLAG_enable_embedded_constant_pool
+ ? descriptor->CalleeSavedRegisters() & ~kConstantPoolRegister.bit()
+ : descriptor->CalleeSavedRegisters();
+ if (saves != 0) {
+ __ MultiPush(saves);
+ // register save area does not include the fp or constant pool pointer.
+ const int num_saves =
+ kNumCalleeSaved - 1 - (FLAG_enable_embedded_constant_pool ? 1 : 0);
+ DCHECK(num_saves == base::bits::CountPopulation32(saves));
+ frame()->AllocateSavedCalleeRegisterSlots(num_saves);
}
}
void CodeGenerator::AssembleReturn() {
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
- int stack_slots = frame()->GetSpillSlotCount();
int pop_count = static_cast<int>(descriptor->StackParameterCount());
+
+ // Restore registers.
+ const RegList saves =
+ FLAG_enable_embedded_constant_pool
+ ? descriptor->CalleeSavedRegisters() & ~kConstantPoolRegister.bit()
+ : descriptor->CalleeSavedRegisters();
+ if (saves != 0) {
+ __ MultiPop(saves);
+ }
+
+ // Restore double registers.
+ const RegList double_saves = descriptor->CalleeSavedFPRegisters();
+ if (double_saves != 0) {
+ __ MultiPopDoubles(double_saves);
+ }
+
if (descriptor->kind() == CallDescriptor::kCallAddress) {
- if (frame()->GetRegisterSaveAreaSize() > 0) {
- // Remove this frame's spill slots first.
- if (stack_slots > 0) {
- __ Add(sp, sp, stack_slots * kPointerSize, r0);
- }
- // Restore double registers.
- const RegList double_saves = descriptor->CalleeSavedFPRegisters();
- __ MultiPopDoubles(double_saves);
-
- // Restore registers.
- RegList frame_saves = 0;
- if (FLAG_enable_embedded_constant_pool) {
- frame_saves |= kConstantPoolRegister.bit();
- }
- const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves;
- __ MultiPop(saves);
- }
+ __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
} else if (descriptor->IsJSFunctionCall() || needs_frame_) {
// Canonicalize JSFunction return sites for now.
if (return_label_.is_bound()) {
@@ -1391,9 +1403,11 @@ void CodeGenerator::AssembleReturn() {
return;
} else {
__ bind(&return_label_);
+ __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
}
+ } else {
+ __ Drop(pop_count);
}
- __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
__ Ret();
}
« no previous file with comments | « include/v8-version.h ('k') | src/compiler/ppc/instruction-selector-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698