Commit 8b489532 authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Introduce PushQuad and PopQuad for x64 port.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/238253013

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21080 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 48ef7850
...@@ -207,7 +207,7 @@ void Deoptimizer::EntryGenerator::Generate() { ...@@ -207,7 +207,7 @@ void Deoptimizer::EntryGenerator::Generate() {
// Fill in the input registers. // Fill in the input registers.
for (int i = kNumberOfRegisters -1; i >= 0; i--) { for (int i = kNumberOfRegisters -1; i >= 0; i--) {
int offset = (i * kPointerSize) + FrameDescription::registers_offset(); int offset = (i * kPointerSize) + FrameDescription::registers_offset();
__ Pop(Operand(rbx, offset)); __ PopQuad(Operand(rbx, offset));
} }
// Fill in the double input registers. // Fill in the double input registers.
...@@ -284,13 +284,13 @@ void Deoptimizer::EntryGenerator::Generate() { ...@@ -284,13 +284,13 @@ void Deoptimizer::EntryGenerator::Generate() {
// Push state, pc, and continuation from the last output frame. // Push state, pc, and continuation from the last output frame.
__ Push(Operand(rbx, FrameDescription::state_offset())); __ Push(Operand(rbx, FrameDescription::state_offset()));
__ Push(Operand(rbx, FrameDescription::pc_offset())); __ PushQuad(Operand(rbx, FrameDescription::pc_offset()));
__ Push(Operand(rbx, FrameDescription::continuation_offset())); __ PushQuad(Operand(rbx, FrameDescription::continuation_offset()));
// Push the registers from the last output frame. // Push the registers from the last output frame.
for (int i = 0; i < kNumberOfRegisters; i++) { for (int i = 0; i < kNumberOfRegisters; i++) {
int offset = (i * kPointerSize) + FrameDescription::registers_offset(); int offset = (i * kPointerSize) + FrameDescription::registers_offset();
__ Push(Operand(rbx, offset)); __ PushQuad(Operand(rbx, offset));
} }
// Restore the registers from the stack. // Restore the registers from the stack.
...@@ -329,11 +329,19 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() { ...@@ -329,11 +329,19 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
if (kPCOnStackSize == 2 * kPointerSize) {
// Zero out the high-32 bit of PC for x32 port.
SetFrameSlot(offset + kPointerSize, 0);
}
SetFrameSlot(offset, value); SetFrameSlot(offset, value);
} }
void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) {
if (kFPOnStackSize == 2 * kPointerSize) {
// Zero out the high-32 bit of FP for x32 port.
SetFrameSlot(offset + kPointerSize, 0);
}
SetFrameSlot(offset, value); SetFrameSlot(offset, value);
} }
......
...@@ -110,6 +110,10 @@ inline Object* JavaScriptFrame::function_slot_object() const { ...@@ -110,6 +110,10 @@ inline Object* JavaScriptFrame::function_slot_object() const {
inline void StackHandler::SetFp(Address slot, Address fp) { inline void StackHandler::SetFp(Address slot, Address fp) {
if (kFPOnStackSize == 2 * kPointerSize) {
// Zero out the high-32 bit of FP for x32 port.
Memory::Address_at(slot + kPointerSize) = 0;
}
Memory::Address_at(slot) = fp; Memory::Address_at(slot) = fp;
} }
......
...@@ -962,7 +962,6 @@ void MacroAssembler::Set(const Operand& dst, intptr_t x) { ...@@ -962,7 +962,6 @@ void MacroAssembler::Set(const Operand& dst, intptr_t x) {
movp(dst, kScratchRegister); movp(dst, kScratchRegister);
} }
} else { } else {
ASSERT(kPointerSize == kInt32Size);
movp(dst, Immediate(static_cast<int32_t>(x))); movp(dst, Immediate(static_cast<int32_t>(x)));
} }
} }
...@@ -2690,7 +2689,6 @@ void MacroAssembler::Push(Register src) { ...@@ -2690,7 +2689,6 @@ void MacroAssembler::Push(Register src) {
if (kPointerSize == kInt64Size) { if (kPointerSize == kInt64Size) {
pushq(src); pushq(src);
} else { } else {
ASSERT(kPointerSize == kInt32Size);
// x32 uses 64-bit push for rbp in the prologue. // x32 uses 64-bit push for rbp in the prologue.
ASSERT(src.code() != rbp.code()); ASSERT(src.code() != rbp.code());
leal(rsp, Operand(rsp, -4)); leal(rsp, Operand(rsp, -4));
...@@ -2703,7 +2701,6 @@ void MacroAssembler::Push(const Operand& src) { ...@@ -2703,7 +2701,6 @@ void MacroAssembler::Push(const Operand& src) {
if (kPointerSize == kInt64Size) { if (kPointerSize == kInt64Size) {
pushq(src); pushq(src);
} else { } else {
ASSERT(kPointerSize == kInt32Size);
movp(kScratchRegister, src); movp(kScratchRegister, src);
leal(rsp, Operand(rsp, -4)); leal(rsp, Operand(rsp, -4));
movp(Operand(rsp, 0), kScratchRegister); movp(Operand(rsp, 0), kScratchRegister);
...@@ -2711,11 +2708,20 @@ void MacroAssembler::Push(const Operand& src) { ...@@ -2711,11 +2708,20 @@ void MacroAssembler::Push(const Operand& src) {
} }
void MacroAssembler::PushQuad(const Operand& src) {
if (kPointerSize == kInt64Size) {
pushq(src);
} else {
movp(kScratchRegister, src);
pushq(kScratchRegister);
}
}
void MacroAssembler::Push(Immediate value) { void MacroAssembler::Push(Immediate value) {
if (kPointerSize == kInt64Size) { if (kPointerSize == kInt64Size) {
pushq(value); pushq(value);
} else { } else {
ASSERT(kPointerSize == kInt32Size);
leal(rsp, Operand(rsp, -4)); leal(rsp, Operand(rsp, -4));
movp(Operand(rsp, 0), value); movp(Operand(rsp, 0), value);
} }
...@@ -2726,7 +2732,6 @@ void MacroAssembler::PushImm32(int32_t imm32) { ...@@ -2726,7 +2732,6 @@ void MacroAssembler::PushImm32(int32_t imm32) {
if (kPointerSize == kInt64Size) { if (kPointerSize == kInt64Size) {
pushq_imm32(imm32); pushq_imm32(imm32);
} else { } else {
ASSERT(kPointerSize == kInt32Size);
leal(rsp, Operand(rsp, -4)); leal(rsp, Operand(rsp, -4));
movp(Operand(rsp, 0), Immediate(imm32)); movp(Operand(rsp, 0), Immediate(imm32));
} }
...@@ -2737,7 +2742,6 @@ void MacroAssembler::Pop(Register dst) { ...@@ -2737,7 +2742,6 @@ void MacroAssembler::Pop(Register dst) {
if (kPointerSize == kInt64Size) { if (kPointerSize == kInt64Size) {
popq(dst); popq(dst);
} else { } else {
ASSERT(kPointerSize == kInt32Size);
// x32 uses 64-bit pop for rbp in the epilogue. // x32 uses 64-bit pop for rbp in the epilogue.
ASSERT(dst.code() != rbp.code()); ASSERT(dst.code() != rbp.code());
movp(dst, Operand(rsp, 0)); movp(dst, Operand(rsp, 0));
...@@ -2750,7 +2754,6 @@ void MacroAssembler::Pop(const Operand& dst) { ...@@ -2750,7 +2754,6 @@ void MacroAssembler::Pop(const Operand& dst) {
if (kPointerSize == kInt64Size) { if (kPointerSize == kInt64Size) {
popq(dst); popq(dst);
} else { } else {
ASSERT(kPointerSize == kInt32Size);
Register scratch = dst.AddressUsesRegister(kScratchRegister) Register scratch = dst.AddressUsesRegister(kScratchRegister)
? kSmiConstantRegister : kScratchRegister; ? kSmiConstantRegister : kScratchRegister;
movp(scratch, Operand(rsp, 0)); movp(scratch, Operand(rsp, 0));
...@@ -2766,6 +2769,16 @@ void MacroAssembler::Pop(const Operand& dst) { ...@@ -2766,6 +2769,16 @@ void MacroAssembler::Pop(const Operand& dst) {
} }
void MacroAssembler::PopQuad(const Operand& dst) {
if (kPointerSize == kInt64Size) {
popq(dst);
} else {
popq(kScratchRegister);
movp(dst, kScratchRegister);
}
}
void MacroAssembler::LoadSharedFunctionInfoSpecialField(Register dst, void MacroAssembler::LoadSharedFunctionInfoSpecialField(Register dst,
Register base, Register base,
int offset) { int offset) {
...@@ -2807,7 +2820,6 @@ void MacroAssembler::Jump(const Operand& op) { ...@@ -2807,7 +2820,6 @@ void MacroAssembler::Jump(const Operand& op) {
if (kPointerSize == kInt64Size) { if (kPointerSize == kInt64Size) {
jmp(op); jmp(op);
} else { } else {
ASSERT(kPointerSize == kInt32Size);
movp(kScratchRegister, op); movp(kScratchRegister, op);
jmp(kScratchRegister); jmp(kScratchRegister);
} }
...@@ -2849,7 +2861,6 @@ void MacroAssembler::Call(const Operand& op) { ...@@ -2849,7 +2861,6 @@ void MacroAssembler::Call(const Operand& op) {
if (kPointerSize == kInt64Size) { if (kPointerSize == kInt64Size) {
call(op); call(op);
} else { } else {
ASSERT(kPointerSize == kInt32Size);
movp(kScratchRegister, op); movp(kScratchRegister, op);
call(kScratchRegister); call(kScratchRegister);
} }
......
...@@ -819,10 +819,12 @@ class MacroAssembler: public Assembler { ...@@ -819,10 +819,12 @@ class MacroAssembler: public Assembler {
void Call(Label* target) { call(target); } void Call(Label* target) { call(target); }
void Push(Register src); void Push(Register src);
void Push(const Operand& src); void Push(const Operand& src);
void PushQuad(const Operand& src);
void Push(Immediate value); void Push(Immediate value);
void PushImm32(int32_t imm32); void PushImm32(int32_t imm32);
void Pop(Register dst); void Pop(Register dst);
void Pop(const Operand& dst); void Pop(const Operand& dst);
void PopQuad(const Operand& dst);
void PushReturnAddressFrom(Register src) { pushq(src); } void PushReturnAddressFrom(Register src) { pushq(src); }
void PopReturnAddressTo(Register dst) { popq(dst); } void PopReturnAddressTo(Register dst) { popq(dst); }
void Move(Register dst, ExternalReference ext) { void Move(Register dst, ExternalReference ext) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment