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
This commit is contained in:
haitao.feng@intel.com 2014-02-11 01:28:08 +00:00
parent 516ed9fa90
commit 32682df265
5 changed files with 45 additions and 15 deletions

View File

@ -1260,9 +1260,6 @@ class Assembler : public AssemblerBase {
// Call near absolute indirect, address in register // Call near absolute indirect, address in register
void call(Register adr); void call(Register adr);
// Call near indirect
void call(const Operand& operand);
// Jumps // Jumps
// Jump short or near relative. // Jump short or near relative.
// Use a 32-bit signed displacement. // Use a 32-bit signed displacement.
@ -1274,9 +1271,6 @@ class Assembler : public AssemblerBase {
// Jump near absolute indirect (r64) // Jump near absolute indirect (r64)
void jmp(Register adr); void jmp(Register adr);
// Jump near absolute indirect (m64)
void jmp(const Operand& src);
// Conditional jumps // Conditional jumps
void j(Condition cc, void j(Condition cc,
Label* L, Label* L,
@ -1499,6 +1493,13 @@ class Assembler : public AssemblerBase {
byte byte_at(int pos) { return buffer_[pos]; } byte byte_at(int pos) { return buffer_[pos]; }
void set_byte_at(int pos, byte value) { buffer_[pos] = value; } 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: private:
byte* addr_at(int pos) { return buffer_ + pos; } byte* addr_at(int pos) { return buffer_ + pos; }
uint32_t long_at(int pos) { uint32_t long_at(int pos) {

View File

@ -173,7 +173,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
ExternalReference after_break_target = ExternalReference after_break_target =
ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate()); ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate());
__ Move(kScratchRegister, after_break_target); __ Move(kScratchRegister, after_break_target);
__ jmp(Operand(kScratchRegister, 0)); __ Jump(Operand(kScratchRegister, 0));
} }

View File

@ -3312,7 +3312,7 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
if (function.is_identical_to(info()->closure())) { if (function.is_identical_to(info()->closure())) {
__ CallSelf(); __ CallSelf();
} else { } else {
__ call(FieldOperand(rdi, JSFunction::kCodeEntryOffset)); __ Call(FieldOperand(rdi, JSFunction::kCodeEntryOffset));
} }
// Set up deoptimization. // Set up deoptimization.
@ -3377,7 +3377,7 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
} else { } else {
Operand target = FieldOperand(rdi, JSFunction::kCodeEntryOffset); Operand target = FieldOperand(rdi, JSFunction::kCodeEntryOffset);
generator.BeforeCall(__ CallSize(target)); generator.BeforeCall(__ CallSize(target));
__ call(target); __ Call(target);
} }
generator.AfterCall(); generator.AfterCall();
} }

View File

@ -984,12 +984,17 @@ void MacroAssembler::Set(Register dst, int64_t x) {
} }
void MacroAssembler::Set(const Operand& dst, int64_t x) { void MacroAssembler::Set(const Operand& dst, intptr_t x) {
if (kPointerSize == kInt64Size) {
if (is_int32(x)) { if (is_int32(x)) {
movq(dst, Immediate(static_cast<int32_t>(x))); movp(dst, Immediate(static_cast<int32_t>(x)));
} else { } else {
Set(kScratchRegister, x); Set(kScratchRegister, x);
movq(dst, kScratchRegister); movp(dst, kScratchRegister);
}
} else {
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) { void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) {
Move(kScratchRegister, destination, rmode); Move(kScratchRegister, destination, rmode);
jmp(kScratchRegister); 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) { void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) {
#ifdef DEBUG #ifdef DEBUG
int end_position = pc_offset() + CallSize(destination); int end_position = pc_offset() + CallSize(destination);

View File

@ -802,7 +802,7 @@ class MacroAssembler: public Assembler {
// Load a register with a long value as efficiently as possible. // Load a register with a long value as efficiently as possible.
void Set(Register dst, int64_t x); 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 // cvtsi2sd instruction only writes to the low 64-bit of dst register, which
// hinders register renaming and makes dependence chains longer. So we use // hinders register renaming and makes dependence chains longer. So we use
@ -865,10 +865,12 @@ class MacroAssembler: public Assembler {
// Control Flow // Control Flow
void Jump(Address destination, RelocInfo::Mode rmode); void Jump(Address destination, RelocInfo::Mode rmode);
void Jump(ExternalReference ext); void Jump(ExternalReference ext);
void Jump(const Operand& op);
void Jump(Handle<Code> code_object, RelocInfo::Mode rmode); void Jump(Handle<Code> code_object, RelocInfo::Mode rmode);
void Call(Address destination, RelocInfo::Mode rmode); void Call(Address destination, RelocInfo::Mode rmode);
void Call(ExternalReference ext); void Call(ExternalReference ext);
void Call(const Operand& op);
void Call(Handle<Code> code_object, void Call(Handle<Code> code_object,
RelocInfo::Mode rmode, RelocInfo::Mode rmode,
TypeFeedbackId ast_id = TypeFeedbackId::None()); TypeFeedbackId ast_id = TypeFeedbackId::None());