From dcd25643bdf319318cba8aef895c9cf52a58d739 Mon Sep 17 00:00:00 2001 From: "whesse@chromium.org" Date: Mon, 22 Jun 2009 14:46:33 +0000 Subject: [PATCH] X64 implementation: Correct kTargetAddrToReturnAddrDist value for x64. Review URL: http://codereview.chromium.org/140063 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2240 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x64/assembler-x64.h | 4 ++-- src/x64/macro-assembler-x64.cc | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h index 2399491b7..d49ba9f8a 100644 --- a/src/x64/assembler-x64.h +++ b/src/x64/assembler-x64.h @@ -413,8 +413,8 @@ class Assembler : public Malloced { static inline void set_target_address_at(Address pc, Address target); // Distance between the address of the code target in the call instruction - // and the return address - static const int kTargetAddrToReturnAddrDist = kPointerSize; + // and the return address. Checked in the debug build. + static const int kTargetAddrToReturnAddrDist = 3 + kPointerSize; // --------------------------------------------------------------------------- diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index af6587cba..0c4d43c35 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -337,7 +337,15 @@ void MacroAssembler::Call(Handle code_object, RelocInfo::Mode rmode) { WriteRecordedPositions(); ASSERT(RelocInfo::IsCodeTarget(rmode)); movq(kScratchRegister, code_object, rmode); +#ifdef DEBUG + Label target; + bind(&target); +#endif call(kScratchRegister); +#ifdef DEBUG + ASSERT_EQ(kTargetAddrToReturnAddrDist, + SizeOfCodeGeneratedSince(&target) + kPointerSize); +#endif } -- 2.34.1