Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Unified Diff: src/x64/assembler-x64.h

Issue 18014003: Add X32 port into V8 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/x64/assembler-x64.h
===================================================================
--- src/x64/assembler-x64.h (revision 15486)
+++ src/x64/assembler-x64.h (working copy)
@@ -378,6 +378,11 @@
class Immediate BASE_EMBEDDED {
public:
explicit Immediate(int32_t value) : value_(value) {}
+#ifdef V8_TARGET_ARCH_X32
+ explicit Immediate(Smi* value) {
+ value_ = reinterpret_cast<intptr_t>(value);
+ }
+#endif
private:
int32_t value_;
@@ -395,7 +400,11 @@
times_4 = 2,
times_8 = 3,
times_int_size = times_4,
+#ifndef V8_TARGET_ARCH_X32
times_pointer_size = times_8
danno 2013/07/17 13:33:21 Make this cross platform with: times_pointer_size
+#else
+ times_pointer_size = times_4
+#endif
};
@@ -583,20 +592,33 @@
// 32-bit displacement of a near call would be, relative to the pushed
// return address. TODO: Use return sequence length instead.
// Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset;
+#ifndef V8_TARGET_ARCH_X32
static const int kPatchReturnSequenceAddressOffset = 13 - 4;
+#else
+ static const int kPatchReturnSequenceAddressOffset = 9 - 4;
danno 2013/07/17 13:33:21 In these constants and below, you can use kRegiste
+#endif
// Distance between start of patched debug break slot and where the
// 32-bit displacement of a near call would be, relative to the pushed
// return address. TODO: Use return sequence length instead.
// Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset;
+#ifndef V8_TARGET_ARCH_X32
static const int kPatchDebugBreakSlotAddressOffset = 13 - 4;
+#else
+ static const int kPatchDebugBreakSlotAddressOffset = 9 - 4;
+#endif
// TODO(X64): Rename this, removing the "Real", after changing the above.
static const int kRealPatchReturnSequenceAddressOffset = 2;
// Some x64 JS code is padded with int3 to make it large
// enough to hold an instruction when the debugger patches it.
static const int kJumpInstructionLength = 13;
+#ifndef V8_TARGET_ARCH_X32
static const int kCallInstructionLength = 13;
static const int kJSReturnSequenceLength = 13;
+#else
+ static const int kCallInstructionLength = 9;
+ static const int kJSReturnSequenceLength = 9;
+#endif
static const int kShortCallInstructionLength = 5;
static const int kPatchDebugBreakSlotReturnOffset = 4;
@@ -688,17 +710,27 @@
// Move the offset of the label location relative to the current
// position (after the move) to the destination.
void movl(const Operand& dst, Label* src);
+#ifdef V8_TARGET_ARCH_X32
+ void movl(Register dst, int32_t value, RelocInfo::Mode rmode);
+#endif
// Move sign extended immediate to memory location.
void movq(const Operand& dst, Immediate value);
// Instructions to load a 64-bit immediate into a register.
// All 64-bit immediates must have a relocation mode.
+ void movq(Register dst, int64_t value, RelocInfo::Mode rmode);
+#ifndef V8_TARGET_ARCH_X32
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<Object> handle, RelocInfo::Mode rmode);
+#else
+ void movl(Register dst, void* ptr, RelocInfo::Mode rmode);
+ void movl(Register dst, const char* s, RelocInfo::Mode rmode);
+ void movl(Register dst, ExternalReference ext);
+ void movl(Register dst, Handle<Object> handle, RelocInfo::Mode rmode);
+#endif
void movsxbq(Register dst, const Operand& src);
void movsxwq(Register dst, const Operand& src);
@@ -729,6 +761,9 @@
// Exchange two registers
void xchg(Register dst, Register src);
+#ifdef V8_TARGET_ARCH_X32
+ void xchgl(Register dst, Register src);
+#endif
// Arithmetics
void addl(Register dst, Register src) {
@@ -963,6 +998,12 @@
arithmetic_op(0x09, src, dst);
}
+#ifdef V8_TARGET_ARCH_X32
+ void orl(const Operand& dst, Register src) {
+ arithmetic_op_32(0x09, src, dst);
+ }
+#endif
+
void or_(Register dst, Immediate src) {
immediate_arithmetic_op(0x1, dst, src);
}
@@ -979,7 +1020,6 @@
immediate_arithmetic_op_32(0x1, dst, src);
}
-
void rcl(Register dst, Immediate imm8) {
shift(dst, imm8, 0x2);
}
@@ -988,6 +1028,12 @@
shift(dst, imm8, 0x0);
}
+#ifdef V8_TARGET_ARCH_X32
+ void roll(Register dst, Immediate imm8) {
+ shift_32(dst, imm8, 0x0);
+ }
+#endif
+
void rcr(Register dst, Immediate imm8) {
shift(dst, imm8, 0x3);
}
@@ -1095,6 +1141,12 @@
arithmetic_op_32(0x2B, dst, src);
}
+#ifdef V8_TARGET_ARCH_X32
+ void subl(const Operand& dst, Register src) {
+ arithmetic_op_32(0x29, src, dst);
+ }
+#endif
+
void subl(const Operand& dst, Immediate src) {
immediate_arithmetic_op_32(0x5, dst, src);
}
@@ -1114,6 +1166,9 @@
void testl(Register dst, Register src);
void testl(Register reg, Immediate mask);
void testl(const Operand& op, Immediate mask);
+#ifdef V8_TARGET_ARCH_X32
+ void testl(const Operand& op, Register reg);
+#endif
void testq(const Operand& op, Register reg);
void testq(Register dst, Register src);
void testq(Register dst, Immediate mask);
@@ -1138,6 +1193,12 @@
immediate_arithmetic_op_32(0x6, dst, src);
}
+#ifdef V8_TARGET_ARCH_X32
+ void xorl(const Operand& dst, Register src) {
+ arithmetic_op_32(0x31, src, dst);
+ }
+#endif
+
void xorl(const Operand& dst, Immediate src) {
immediate_arithmetic_op_32(0x6, dst, src);
}
@@ -1378,6 +1439,9 @@
void movmskpd(Register dst, XMMRegister src);
void movmskps(Register dst, XMMRegister src);
+#ifdef V8_TARGET_ARCH_X32
+ void pcmpeqd(XMMRegister dst, XMMRegister src);
+#endif
// The first argument is the reg field, the second argument is the r/m field.
void emit_sse_operand(XMMRegister dst, XMMRegister src);
@@ -1444,6 +1508,9 @@
void emit(byte x) { *pc_++ = x; }
inline void emitl(uint32_t x);
+#ifdef V8_TARGET_ARCH_X32
+ inline void emitl(uint32_t x, RelocInfo::Mode rmode);
+#endif
inline void emitq(uint64_t x, RelocInfo::Mode rmode);
inline void emitw(uint16_t x);
inline void emit_code_target(Handle<Code> target,

Powered by Google App Engine
This is Rietveld 408576698