From 8e44a04ea9855870c54d70803f01f107d2355763 Mon Sep 17 00:00:00 2001 From: "haitao.feng@intel.com" Date: Fri, 11 Apr 2014 02:02:56 +0000 Subject: [PATCH] Rename PushInt64AsTwoSmis to PushRegisterAsTwoSmis and support x32 as well. R=verwaest@chromium.org Review URL: https://codereview.chromium.org/232533002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20662 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x64/debug-x64.cc | 4 ++-- src/x64/macro-assembler-x64.cc | 10 ++++++---- src/x64/macro-assembler-x64.h | 10 +++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/x64/debug-x64.cc b/src/x64/debug-x64.cc index 36d5df6..a65dd29 100644 --- a/src/x64/debug-x64.cc +++ b/src/x64/debug-x64.cc @@ -124,7 +124,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm, __ Push(reg); } if ((non_object_regs & (1 << r)) != 0) { - __ PushInt64AsTwoSmis(reg); + __ PushRegisterAsTwoSmis(reg); } } @@ -149,7 +149,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm, } // Reconstruct the 64-bit value from two smis. if ((non_object_regs & (1 << r)) != 0) { - __ PopInt64AsTwoSmis(reg); + __ PopRegisterAsTwoSmis(reg); } } diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 693a5c6..80f61db 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -2283,10 +2283,11 @@ void MacroAssembler::Push(Smi* source) { } -void MacroAssembler::PushInt64AsTwoSmis(Register src, Register scratch) { +void MacroAssembler::PushRegisterAsTwoSmis(Register src, Register scratch) { + ASSERT(!src.is(scratch)); movp(scratch, src); // High bits. - shrp(src, Immediate(64 - kSmiShift)); + shrp(src, Immediate(kPointerSize * kBitsPerByte - kSmiShift)); shlp(src, Immediate(kSmiShift)); Push(src); // Low bits. @@ -2295,14 +2296,15 @@ void MacroAssembler::PushInt64AsTwoSmis(Register src, Register scratch) { } -void MacroAssembler::PopInt64AsTwoSmis(Register dst, Register scratch) { +void MacroAssembler::PopRegisterAsTwoSmis(Register dst, Register scratch) { + ASSERT(!dst.is(scratch)); Pop(scratch); // Low bits. shrp(scratch, Immediate(kSmiShift)); Pop(dst); shrp(dst, Immediate(kSmiShift)); // High bits. - shlp(dst, Immediate(64 - kSmiShift)); + shlp(dst, Immediate(kPointerSize * kBitsPerByte - kSmiShift)); orp(dst, scratch); } diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h index ee4fb85..4a2fa8e 100644 --- a/src/x64/macro-assembler-x64.h +++ b/src/x64/macro-assembler-x64.h @@ -726,12 +726,12 @@ class MacroAssembler: public Assembler { void Push(Smi* smi); - // Save away a 64-bit integer on the stack as two 32-bit integers + // Save away a raw integer with pointer size on the stack as two 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 PushRegisterAsTwoSmis(Register src, Register scratch = kScratchRegister); + // Reconstruct a raw integer with pointer size from two integers masquerading + // as smis on the top of stack. + void PopRegisterAsTwoSmis(Register dst, Register scratch = kScratchRegister); void Test(const Operand& dst, Smi* source); -- 2.7.4