Commit 32682df2 authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Introduce Jump and Call operand macro assembler instructions for x64

R=verwaest@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19245 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 516ed9fa
......@@ -1260,9 +1260,6 @@ class Assembler : public AssemblerBase {
// Call near absolute indirect, address in register
void call(Register adr);
// Call near indirect
void call(const Operand& operand);
// Jumps
// Jump short or near relative.
// Use a 32-bit signed displacement.
......@@ -1274,9 +1271,6 @@ class Assembler : public AssemblerBase {
// Jump near absolute indirect (r64)
void jmp(Register adr);
// Jump near absolute indirect (m64)
void jmp(const Operand& src);
// Conditional jumps
void j(Condition cc,
Label* L,
......@@ -1499,6 +1493,13 @@ class Assembler : public AssemblerBase {
byte byte_at(int pos) { return buffer_[pos]; }
void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
protected:
// Call near indirect
void call(const Operand& operand);
// Jump near absolute indirect (m64)
void jmp(const Operand& src);
private:
byte* addr_at(int pos) { return buffer_ + pos; }
uint32_t long_at(int pos) {
......
......@@ -173,7 +173,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
ExternalReference after_break_target =
ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate());
__ Move(kScratchRegister, after_break_target);
__ jmp(Operand(kScratchRegister, 0));
__ Jump(Operand(kScratchRegister, 0));
}
......
......@@ -3312,7 +3312,7 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
if (function.is_identical_to(info()->closure())) {
__ CallSelf();
} else {
__ call(FieldOperand(rdi, JSFunction::kCodeEntryOffset));
__ Call(FieldOperand(rdi, JSFunction::kCodeEntryOffset));
}
// Set up deoptimization.
......@@ -3377,7 +3377,7 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
} else {
Operand target = FieldOperand(rdi, JSFunction::kCodeEntryOffset);
generator.BeforeCall(__ CallSize(target));
__ call(target);
__ Call(target);
}
generator.AfterCall();
}
......
......@@ -984,12 +984,17 @@ void MacroAssembler::Set(Register dst, int64_t x) {
}
void MacroAssembler::Set(const Operand& dst, int64_t x) {
if (is_int32(x)) {
movq(dst, Immediate(static_cast<int32_t>(x)));
void MacroAssembler::Set(const Operand& dst, intptr_t x) {
if (kPointerSize == kInt64Size) {
if (is_int32(x)) {
movp(dst, Immediate(static_cast<int32_t>(x)));
} else {
Set(kScratchRegister, x);
movp(dst, kScratchRegister);
}
} else {
Set(kScratchRegister, x);
movq(dst, kScratchRegister);
ASSERT(kPointerSize == kInt32Size);
movp(dst, Immediate(static_cast<int32_t>(x)));
}
}
......@@ -2592,6 +2597,17 @@ void MacroAssembler::Jump(ExternalReference ext) {
}
void MacroAssembler::Jump(const Operand& op) {
if (kPointerSize == kInt64Size) {
jmp(op);
} else {
ASSERT(kPointerSize == kInt32Size);
movp(kScratchRegister, op);
jmp(kScratchRegister);
}
}
void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) {
Move(kScratchRegister, destination, rmode);
jmp(kScratchRegister);
......@@ -2623,6 +2639,17 @@ void MacroAssembler::Call(ExternalReference ext) {
}
void MacroAssembler::Call(const Operand& op) {
if (kPointerSize == kInt64Size) {
call(op);
} else {
ASSERT(kPointerSize == kInt32Size);
movp(kScratchRegister, op);
call(kScratchRegister);
}
}
void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) {
#ifdef DEBUG
int end_position = pc_offset() + CallSize(destination);
......
......@@ -802,7 +802,7 @@ class MacroAssembler: public Assembler {
// Load a register with a long value as efficiently as possible.
void Set(Register dst, int64_t x);
void Set(const Operand& dst, int64_t x);
void Set(const Operand& dst, intptr_t x);
// cvtsi2sd instruction only writes to the low 64-bit of dst register, which
// hinders register renaming and makes dependence chains longer. So we use
......@@ -865,10 +865,12 @@ class MacroAssembler: public Assembler {
// Control Flow
void Jump(Address destination, RelocInfo::Mode rmode);
void Jump(ExternalReference ext);
void Jump(const Operand& op);
void Jump(Handle<Code> code_object, RelocInfo::Mode rmode);
void Call(Address destination, RelocInfo::Mode rmode);
void Call(ExternalReference ext);
void Call(const Operand& op);
void Call(Handle<Code> code_object,
RelocInfo::Mode rmode,
TypeFeedbackId ast_id = TypeFeedbackId::None());
......
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