Commit 1e4f4077 authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Introduce PushInt64AsTwoSmis and PopInt64AsTwoSmis macro instructions for X64

R=danno@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16376 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6d1f0cc2
......@@ -123,14 +123,8 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
if ((object_regs & (1 << r)) != 0) {
__ push(reg);
}
// Store the 64-bit value as two smis.
if ((non_object_regs & (1 << r)) != 0) {
__ movq(kScratchRegister, reg);
__ Integer32ToSmi(reg, reg);
__ push(reg);
__ sar(kScratchRegister, Immediate(32));
__ Integer32ToSmi(kScratchRegister, kScratchRegister);
__ push(kScratchRegister);
__ PushInt64AsTwoSmis(reg);
}
}
......@@ -155,12 +149,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
}
// Reconstruct the 64-bit value from two smis.
if ((non_object_regs & (1 << r)) != 0) {
__ pop(kScratchRegister);
__ SmiToInteger32(kScratchRegister, kScratchRegister);
__ shl(kScratchRegister, Immediate(32));
__ pop(reg);
__ SmiToInteger32(reg, reg);
__ or_(reg, kScratchRegister);
__ PopInt64AsTwoSmis(reg);
}
}
......
......@@ -2196,6 +2196,30 @@ void MacroAssembler::AddSmiField(Register dst, const Operand& src) {
}
void MacroAssembler::PushInt64AsTwoSmis(Register src, Register scratch) {
movq(scratch, src);
// High bits.
shr(src, Immediate(64 - kSmiShift));
shl(src, Immediate(kSmiShift));
push(src);
// Low bits.
shl(scratch, Immediate(kSmiShift));
push(scratch);
}
void MacroAssembler::PopInt64AsTwoSmis(Register dst, Register scratch) {
pop(scratch);
// Low bits.
shr(scratch, Immediate(kSmiShift));
pop(dst);
shr(dst, Immediate(kSmiShift));
// High bits.
shl(dst, Immediate(64 - kSmiShift));
or_(dst, scratch);
}
void MacroAssembler::JumpIfNotString(Register object,
Register object_map,
Label* not_string,
......
......@@ -720,6 +720,14 @@ class MacroAssembler: public Assembler {
}
void Push(Smi* smi);
// Save away a 64-bit integer on the stack as two 32-bit integers
// masquerading as smis so that the garbage collector skips visiting them.
void PushInt64AsTwoSmis(Register src, Register scratch = kScratchRegister);
// Reconstruct a 64-bit integer from two 32-bit integers masquerading as
// smis on the top of stack.
void PopInt64AsTwoSmis(Register dst, Register scratch = kScratchRegister);
void Test(const Operand& dst, Smi* source);
......
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