summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h
index 7a8b58d..745bc60 100644
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h
+++ b/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h
@@ -226,6 +226,7 @@ public:
{
}
+ void enableLatePatch() { }
private:
JmpSrc(int offset)
: m_offset(offset)
@@ -1344,6 +1345,11 @@ public:
return JmpDst(m_formatter.size());
}
+ static JmpDst labelFor(JmpSrc jump, intptr_t offset = 0)
+ {
+ return JmpDst(jump.m_offset + offset);
+ }
+
JmpDst align(int alignment)
{
while (!m_formatter.isAligned(alignment))
@@ -1366,59 +1372,48 @@ public:
ASSERT(to.m_offset != -1);
char* code = reinterpret_cast<char*>(m_formatter.data());
- patchRel32(code + from.m_offset, code + to.m_offset);
+ setRel32(code + from.m_offset, code + to.m_offset);
}
static void linkJump(void* code, JmpSrc from, void* to)
{
ASSERT(from.m_offset != -1);
- patchRel32(reinterpret_cast<char*>(code) + from.m_offset, to);
+ setRel32(reinterpret_cast<char*>(code) + from.m_offset, to);
}
static void linkCall(void* code, JmpSrc from, void* to)
{
ASSERT(from.m_offset != -1);
- patchRel32(reinterpret_cast<char*>(code) + from.m_offset, to);
+ setRel32(reinterpret_cast<char*>(code) + from.m_offset, to);
}
-#if PLATFORM(X86_64)
- static void patchPointerForCall(void* where, void* value)
- {
- reinterpret_cast<void**>(where)[-1] = value;
- }
-#endif
-
- static void patchPointer(void* code, JmpDst where, void* value)
+ static void linkPointer(void* code, JmpDst where, void* value)
{
ASSERT(where.m_offset != -1);
- patchPointer(reinterpret_cast<char*>(code) + where.m_offset, value);
+ setPointer(reinterpret_cast<char*>(code) + where.m_offset, value);
}
static void relinkJump(void* from, void* to)
{
- ExecutableAllocator::MakeWritable unprotect(reinterpret_cast<char*>(from) - sizeof(int32_t), sizeof(int32_t));
- patchRel32(from, to);
+ setRel32(from, to);
}
static void relinkCall(void* from, void* to)
{
- ExecutableAllocator::MakeWritable unprotect(reinterpret_cast<char*>(from) - sizeof(int32_t), sizeof(int32_t));
- patchRel32(from, to);
+ setRel32(from, to);
}
static void repatchInt32(void* where, int32_t value)
{
- ExecutableAllocator::MakeWritable unprotect(reinterpret_cast<char*>(where) - sizeof(int32_t), sizeof(int32_t));
- patchInt32(where, value);
+ setInt32(where, value);
}
static void repatchPointer(void* where, void* value)
{
- ExecutableAllocator::MakeWritable unprotect(reinterpret_cast<char*>(where) - sizeof(void*), sizeof(void*));
- patchPointer(where, value);
+ setPointer(where, value);
}
static void repatchLoadPtrToLEA(void* where)
@@ -1428,7 +1423,6 @@ public:
// Skip over the prefix byte.
where = reinterpret_cast<char*>(where) + 1;
#endif
- ExecutableAllocator::MakeWritable unprotect(where, 1);
*reinterpret_cast<unsigned char*>(where) = static_cast<unsigned char>(OP_LEA);
}
@@ -1476,22 +1470,22 @@ public:
private:
- static void patchPointer(void* where, void* value)
+ static void setPointer(void* where, void* value)
{
reinterpret_cast<void**>(where)[-1] = value;
}
- static void patchInt32(void* where, int32_t value)
+ static void setInt32(void* where, int32_t value)
{
reinterpret_cast<int32_t*>(where)[-1] = value;
}
- static void patchRel32(void* from, void* to)
+ static void setRel32(void* from, void* to)
{
intptr_t offset = reinterpret_cast<intptr_t>(to) - reinterpret_cast<intptr_t>(from);
ASSERT(offset == static_cast<int32_t>(offset));
- patchInt32(from, offset);
+ setInt32(from, offset);
}
class X86InstructionFormatter {