Revision: 19245
Author:   [email protected]
Date:     Tue Feb 11 01:28:08 2014 UTC
Log: Introduce Jump and Call operand macro assembler instructions for x64

[email protected]

Review URL: https://codereview.chromium.org/157303002
http://code.google.com/p/v8/source/detail?r=19245

Modified:
 /branches/bleeding_edge/src/x64/assembler-x64.h
 /branches/bleeding_edge/src/x64/debug-x64.cc
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.h

=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.h Fri Feb 7 02:21:18 2014 UTC +++ /branches/bleeding_edge/src/x64/assembler-x64.h Tue Feb 11 01:28:08 2014 UTC
@@ -1260,9 +1260,6 @@
   // 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 @@
   // 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,
@@ -1498,6 +1492,13 @@

   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; }
=======================================
--- /branches/bleeding_edge/src/x64/debug-x64.cc Mon Feb 10 21:38:17 2014 UTC +++ /branches/bleeding_edge/src/x64/debug-x64.cc Tue Feb 11 01:28:08 2014 UTC
@@ -173,7 +173,7 @@
   ExternalReference after_break_target =
ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate());
   __ Move(kScratchRegister, after_break_target);
-  __ jmp(Operand(kScratchRegister, 0));
+  __ Jump(Operand(kScratchRegister, 0));
 }


=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Sat Feb 8 02:16:25 2014 UTC +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Feb 11 01:28:08 2014 UTC
@@ -3312,7 +3312,7 @@
     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 @@
   } else {
     Operand target = FieldOperand(rdi, JSFunction::kCodeEntryOffset);
     generator.BeforeCall(__ CallSize(target));
-    __ call(target);
+    __ Call(target);
   }
   generator.AfterCall();
 }
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Tue Jan 28 11:53:11 2014 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Tue Feb 11 01:28:08 2014 UTC
@@ -984,12 +984,17 @@
 }


-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)));
   }
 }

@@ -2590,6 +2595,17 @@
   LoadAddress(kScratchRegister, ext);
   jmp(kScratchRegister);
 }
+
+
+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) {
@@ -2621,6 +2637,17 @@
   CHECK_EQ(end_position, pc_offset());
 #endif
 }
+
+
+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) {
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.h Sat Feb 8 02:16:25 2014 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.h Tue Feb 11 01:28:08 2014 UTC
@@ -802,7 +802,7 @@

   // 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 @@
   // 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());

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to