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

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

Issue 1284893002: Reland: [turbofan] Various fixes to allow unboxed doubles as arguments in registers and on the stac… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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 | « src/compiler/register-allocator-verifier.cc ('k') | src/compiler/x87/code-generator-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/x64/code-generator-x64.cc
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
index 38c7f2a31c90724b3fd39767c07b3801fde1cbc6..413fe635ac211779adc334516e81021a3b73922a 100644
--- a/src/compiler/x64/code-generator-x64.cc
+++ b/src/compiler/x64/code-generator-x64.cc
@@ -48,10 +48,10 @@ class X64OperandConverter : public InstructionOperandConverter {
Operand ToOperand(InstructionOperand* op, int extra = 0) {
DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
- // The linkage computes where all spill slots are located.
- FrameOffset offset = linkage()->GetFrameOffset(
- AllocatedOperand::cast(op)->index(), frame(), extra);
- return Operand(offset.from_stack_pointer() ? rsp : rbp, offset.offset());
+ FrameOffset offset =
+ linkage()->GetFrameOffset(AllocatedOperand::cast(op)->index(), frame());
+ return Operand(offset.from_stack_pointer() ? rsp : rbp,
+ offset.offset() + extra);
}
static size_t NextOffset(size_t* offset) {
@@ -1219,6 +1219,10 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
} else {
if (instr->InputAt(0)->IsRegister()) {
__ pushq(i.InputRegister(0));
+ } else if (instr->InputAt(0)->IsDoubleRegister()) {
+ // TODO(titzer): use another machine instruction?
+ __ subq(rsp, Immediate(kDoubleSize));
+ __ movsd(Operand(rsp, 0), i.InputDoubleRegister(0));
} else {
__ pushq(i.InputOperand(0));
}
@@ -1554,31 +1558,26 @@ void CodeGenerator::AssembleReturn() {
}
}
__ popq(rbp); // Pop caller's frame pointer.
- __ ret(0);
} else {
// No saved registers.
__ movq(rsp, rbp); // Move stack pointer back to frame pointer.
__ popq(rbp); // Pop caller's frame pointer.
- __ ret(0);
}
} else if (descriptor->IsJSFunctionCall() || needs_frame_) {
// Canonicalize JSFunction return sites for now.
if (return_label_.is_bound()) {
__ jmp(&return_label_);
+ return;
} else {
__ bind(&return_label_);
__ movq(rsp, rbp); // Move stack pointer back to frame pointer.
__ popq(rbp); // Pop caller's frame pointer.
- int pop_count = static_cast<int>(descriptor->StackParameterCount());
- if (pop_count == 0) {
- __ Ret();
- } else {
- __ Ret(pop_count * kPointerSize, rbx);
- }
}
- } else {
- __ Ret();
}
+ size_t pop_size = descriptor->StackParameterCount() * kPointerSize;
+ // Might need rcx for scratch if pop_size is too big.
+ DCHECK_EQ(0, descriptor->CalleeSavedRegisters() & rcx.bit());
+ __ Ret(static_cast<int>(pop_size), rcx);
}
« no previous file with comments | « src/compiler/register-allocator-verifier.cc ('k') | src/compiler/x87/code-generator-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698