Add the emitp function for X64 assembler

R=danno@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15861 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
haitao.feng@intel.com 2013-07-24 13:50:45 +00:00
parent 323f15c5a9
commit 2f4b0e31bd
3 changed files with 15 additions and 4 deletions

View File

@ -51,6 +51,16 @@ void Assembler::emitl(uint32_t x) {
} }
void Assembler::emitp(void* x, RelocInfo::Mode rmode) {
uintptr_t value = reinterpret_cast<uintptr_t>(x);
Memory::uintptr_at(pc_) = value;
if (!RelocInfo::IsNone(rmode)) {
RecordRelocInfo(rmode, value);
}
pc_ += sizeof(uintptr_t);
}
void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) { void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) {
Memory::uint64_at(pc_) = x; Memory::uint64_at(pc_) = x;
if (!RelocInfo::IsNone(rmode)) { if (!RelocInfo::IsNone(rmode)) {

View File

@ -1377,7 +1377,7 @@ void Assembler::load_rax(void* value, RelocInfo::Mode mode) {
EnsureSpace ensure_space(this); EnsureSpace ensure_space(this);
emit(0x48); // REX.W emit(0x48); // REX.W
emit(0xA1); emit(0xA1);
emitq(reinterpret_cast<uintptr_t>(value), mode); emitp(value, mode);
} }
@ -1529,7 +1529,7 @@ void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) {
EnsureSpace ensure_space(this); EnsureSpace ensure_space(this);
emit_rex_64(dst); emit_rex_64(dst);
emit(0xB8 | dst.low_bits()); emit(0xB8 | dst.low_bits());
emitq(reinterpret_cast<uintptr_t>(value), rmode); emitp(value, rmode);
} }
@ -1606,7 +1606,7 @@ void Assembler::movq(Register dst, Handle<Object> value, RelocInfo::Mode mode) {
ASSERT(!HEAP->InNewSpace(*value)); ASSERT(!HEAP->InNewSpace(*value));
emit_rex_64(dst); emit_rex_64(dst);
emit(0xB8 | dst.low_bits()); emit(0xB8 | dst.low_bits());
emitq(reinterpret_cast<uintptr_t>(value.location()), mode); emitp(value.location(), mode);
} }
} }
@ -1998,7 +1998,7 @@ void Assembler::store_rax(void* dst, RelocInfo::Mode mode) {
EnsureSpace ensure_space(this); EnsureSpace ensure_space(this);
emit(0x48); // REX.W emit(0x48); // REX.W
emit(0xA3); emit(0xA3);
emitq(reinterpret_cast<uintptr_t>(dst), mode); emitp(dst, mode);
} }

View File

@ -1444,6 +1444,7 @@ class Assembler : public AssemblerBase {
void emit(byte x) { *pc_++ = x; } void emit(byte x) { *pc_++ = x; }
inline void emitl(uint32_t 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, RelocInfo::Mode rmode);
inline void emitw(uint16_t x); inline void emitw(uint16_t x);
inline void emit_code_target(Handle<Code> target, inline void emit_code_target(Handle<Code> target,