summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/assembler/MacroAssemblerX86.h
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/assembler/MacroAssemblerX86.h')
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerX86.h114
1 files changed, 60 insertions, 54 deletions
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
index f05c8cec9..547158fa7 100644
--- a/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,6 +30,10 @@
#include "MacroAssemblerX86Common.h"
+#if USE(MASM_PROBE)
+#include <wtf/StdLibExtras.h>
+#endif
+
namespace JSC {
class MacroAssemblerX86 : public MacroAssemblerX86Common {
@@ -107,18 +111,6 @@ public:
m_assembler.movzbl_mr(address, dest);
}
- void abortWithReason(AbortReason reason)
- {
- move(TrustedImm32(reason), X86Registers::eax);
- breakpoint();
- }
-
- void abortWithReason(AbortReason reason, intptr_t misc)
- {
- move(TrustedImm32(misc), X86Registers::edx);
- abortWithReason(reason);
- }
-
ConvertibleLoadLabel convertibleLoadPtr(Address address, RegisterID dest)
{
ConvertibleLoadLabel result = ConvertibleLoadLabel(this);
@@ -131,11 +123,11 @@ public:
m_assembler.addsd_mr(address.m_ptr, dest);
}
- void storeDouble(FPRegisterID src, TrustedImmPtr address)
+ void storeDouble(FPRegisterID src, const void* address)
{
ASSERT(isSSE2Present());
- ASSERT(address.m_value);
- m_assembler.movsd_rm(src, address.m_value);
+ ASSERT(address);
+ m_assembler.movsd_rm(src, address);
}
void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest)
@@ -164,20 +156,18 @@ public:
m_assembler.movb_i8m(imm.m_value, address);
}
+ // Possibly clobbers src.
void moveDoubleToInts(FPRegisterID src, RegisterID dest1, RegisterID dest2)
{
- ASSERT(isSSE2Present());
- m_assembler.pextrw_irr(3, src, dest1);
- m_assembler.pextrw_irr(2, src, dest2);
- lshift32(TrustedImm32(16), dest1);
- or32(dest1, dest2);
- moveFloatTo32(src, dest1);
+ movePackedToInt32(src, dest1);
+ rshiftPacked(TrustedImm32(32), src);
+ movePackedToInt32(src, dest2);
}
void moveIntsToDouble(RegisterID src1, RegisterID src2, FPRegisterID dest, FPRegisterID scratch)
{
- move32ToFloat(src1, dest);
- move32ToFloat(src2, scratch);
+ moveInt32ToPacked(src1, dest);
+ moveInt32ToPacked(src2, scratch);
lshiftPacked(TrustedImm32(32), scratch);
orPacked(scratch, dest);
}
@@ -267,14 +257,6 @@ public:
return Jump(m_assembler.jCC(x86Condition(cond)));
}
- Jump branch32WithPatch(RelationalCondition cond, Address left, DataLabel32& dataLabel, TrustedImm32 initialRightValue = TrustedImm32(0))
- {
- padBeforePatch();
- m_assembler.cmpl_im_force32(initialRightValue.m_value, left.offset, left.base);
- dataLabel = DataLabel32(this);
- return Jump(m_assembler.jCC(x86Condition(cond)));
- }
-
DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
{
padBeforePatch();
@@ -283,6 +265,7 @@ public:
}
static bool supportsFloatingPoint() { return isSSE2Present(); }
+ // See comment on MacroAssemblerARMv7::supportsFloatingPointTruncate()
static bool supportsFloatingPointTruncate() { return isSSE2Present(); }
static bool supportsFloatingPointSqrt() { return isSSE2Present(); }
static bool supportsFloatingPointAbs() { return isSSE2Present(); }
@@ -294,7 +277,6 @@ public:
}
static bool canJumpReplacePatchableBranchPtrWithPatch() { return true; }
- static bool canJumpReplacePatchableBranch32WithPatch() { return true; }
static CodeLocationLabel startOfBranchPtrWithPatchOnRegister(CodeLocationDataLabelPtr label)
{
@@ -317,17 +299,6 @@ public:
return label.labelAtOffset(-totalBytes);
}
- static CodeLocationLabel startOfPatchableBranch32WithPatchOnAddress(CodeLocationDataLabel32 label)
- {
- const int opcodeBytes = 1;
- const int modRMBytes = 1;
- const int offsetBytes = 0;
- const int immediateBytes = 4;
- const int totalBytes = opcodeBytes + modRMBytes + offsetBytes + immediateBytes;
- ASSERT(totalBytes >= maxJumpReplacementSize());
- return label.labelAtOffset(-totalBytes);
- }
-
static void revertJumpReplacementToBranchPtrWithPatch(CodeLocationLabel instructionStart, RegisterID reg, void* initialValue)
{
X86Assembler::revertJumpTo_cmpl_ir_force32(instructionStart.executableAddress(), reinterpret_cast<intptr_t>(initialValue), reg);
@@ -339,10 +310,18 @@ public:
X86Assembler::revertJumpTo_cmpl_im_force32(instructionStart.executableAddress(), reinterpret_cast<intptr_t>(initialValue), 0, address.base);
}
- static void revertJumpReplacementToPatchableBranch32WithPatch(CodeLocationLabel instructionStart, Address address, int32_t initialValue)
+#if USE(MASM_PROBE)
+ // For details about probe(), see comment in MacroAssemblerX86_64.h.
+ void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0);
+#endif // USE(MASM_PROBE)
+
+private:
+ friend class LinkBuffer;
+ friend class RepatchBuffer;
+
+ static void linkCall(void* code, Call call, FunctionPtr function)
{
- ASSERT(!address.offset);
- X86Assembler::revertJumpTo_cmpl_im_force32(instructionStart.executableAddress(), initialValue, 0, address.base);
+ X86Assembler::linkCall(code, call.m_label, function.value());
}
static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
@@ -355,18 +334,45 @@ public:
X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
}
-private:
- friend class LinkBuffer;
+#if USE(MASM_PROBE)
+ inline TrustedImm32 trustedImm32FromPtr(void* ptr)
+ {
+ return TrustedImm32(TrustedImmPtr(ptr));
+ }
- static void linkCall(void* code, Call call, FunctionPtr function)
+ inline TrustedImm32 trustedImm32FromPtr(ProbeFunction function)
{
- if (call.isFlagSet(Call::Tail))
- X86Assembler::linkJump(code, call.m_label, function.value());
- else
- X86Assembler::linkCall(code, call.m_label, function.value());
+ return TrustedImm32(TrustedImmPtr(reinterpret_cast<void*>(function)));
+ }
+
+ inline TrustedImm32 trustedImm32FromPtr(void (*function)())
+ {
+ return TrustedImm32(TrustedImmPtr(reinterpret_cast<void*>(function)));
}
+#endif
};
+#if USE(MASM_PROBE)
+
+extern "C" void ctiMasmProbeTrampoline();
+
+// For details on "What code is emitted for the probe?" and "What values are in
+// the saved registers?", see comment for MacroAssemblerX86::probe() in
+// MacroAssemblerX86_64.h.
+
+inline void MacroAssemblerX86::probe(MacroAssemblerX86::ProbeFunction function, void* arg1, void* arg2)
+{
+ push(RegisterID::esp);
+ push(RegisterID::eax);
+ push(trustedImm32FromPtr(arg2));
+ push(trustedImm32FromPtr(arg1));
+ push(trustedImm32FromPtr(function));
+
+ move(trustedImm32FromPtr(ctiMasmProbeTrampoline), RegisterID::eax);
+ call(RegisterID::eax);
+}
+#endif // USE(MASM_PROBE)
+
} // namespace JSC
#endif // ENABLE(ASSEMBLER)