From bb202665ba8381a1be17fa6a5b26ba129e622c6f Mon Sep 17 00:00:00 2001 From: "haitao.feng@intel.com" Date: Thu, 24 Oct 2013 01:27:47 +0000 Subject: [PATCH] Use the correct version of movq for ExternalReference in X64 R=danno@chromium.org Review URL: https://codereview.chromium.org/26410004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17351 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x64/assembler-x64-inl.h | 5 +---- src/x64/assembler-x64.cc | 24 +++++++++++------------- src/x64/assembler-x64.h | 3 +-- src/x64/macro-assembler-x64.cc | 2 +- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/x64/assembler-x64-inl.h b/src/x64/assembler-x64-inl.h index 4887899..afac886 100644 --- a/src/x64/assembler-x64-inl.h +++ b/src/x64/assembler-x64-inl.h @@ -62,11 +62,8 @@ void Assembler::emitp(void* x, RelocInfo::Mode rmode) { } -void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) { +void Assembler::emitq(uint64_t x) { Memory::uint64_at(pc_) = x; - if (!RelocInfo::IsNone(rmode)) { - RecordRelocInfo(rmode, x); - } pc_ += sizeof(uint64_t); } diff --git a/src/x64/assembler-x64.cc b/src/x64/assembler-x64.cc index 4989c1e..135117d 100644 --- a/src/x64/assembler-x64.cc +++ b/src/x64/assembler-x64.cc @@ -1465,26 +1465,24 @@ void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) { void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { // Non-relocatable values might not need a 64-bit representation. - if (RelocInfo::IsNone(rmode)) { - if (is_uint32(value)) { - movl(dst, Immediate(static_cast(value))); - return; - } else if (is_int32(value)) { - movq(dst, Immediate(static_cast(value))); - return; - } + ASSERT(RelocInfo::IsNone(rmode)); + if (is_uint32(value)) { + movl(dst, Immediate(static_cast(value))); + } else if (is_int32(value)) { + movq(dst, Immediate(static_cast(value))); + } else { // Value cannot be represented by 32 bits, so do a full 64 bit immediate // value. + EnsureSpace ensure_space(this); + emit_rex_64(dst); + emit(0xB8 | dst.low_bits()); + emitq(value); } - EnsureSpace ensure_space(this); - emit_rex_64(dst); - emit(0xB8 | dst.low_bits()); - emitq(value, rmode); } void Assembler::movq(Register dst, ExternalReference ref) { - int64_t value = reinterpret_cast(ref.address()); + Address value = reinterpret_cast
(ref.address()); movq(dst, value, RelocInfo::EXTERNAL_REFERENCE); } diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h index fd1e1e7..f462b7e 100644 --- a/src/x64/assembler-x64.h +++ b/src/x64/assembler-x64.h @@ -723,7 +723,6 @@ class Assembler : public AssemblerBase { // All 64-bit immediates must have a relocation mode. void movq(Register dst, void* ptr, RelocInfo::Mode rmode); void movq(Register dst, int64_t value, RelocInfo::Mode rmode); - void movq(Register dst, const char* s, RelocInfo::Mode rmode); // Moves the address of the external reference into the register. void movq(Register dst, ExternalReference ext); void movq(Register dst, Handle handle, RelocInfo::Mode rmode); @@ -1474,7 +1473,7 @@ class Assembler : public AssemblerBase { void emit(byte x) { *pc_++ = x; } inline void emitl(uint32_t x); inline void emitp(void* x, RelocInfo::Mode rmode); - inline void emitq(uint64_t x, RelocInfo::Mode rmode); + inline void emitq(uint64_t x); inline void emitw(uint16_t x); inline void emit_code_target(Handle target, RelocInfo::Mode rmode, diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index c4d0ffa..075f07c 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -740,7 +740,7 @@ void MacroAssembler::CallApiFunctionAndReturn( bind(&profiler_disabled); // Call the api function! - movq(rax, reinterpret_cast(function_address), + movq(rax, reinterpret_cast
(function_address), RelocInfo::EXTERNAL_REFERENCE); bind(&end_profiler_check); -- 2.7.4