summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
commit881da28418d380042aa95a97f0cbd42560a64f7c (patch)
treea794dff3274695e99c651902dde93d934ea7a5af /Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
parent7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff)
parent0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff)
downloadqtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h')
-rw-r--r--Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h76
1 files changed, 35 insertions, 41 deletions
diff --git a/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h b/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
index 852f86df7..053884b01 100644
--- a/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
+++ b/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
@@ -195,12 +195,6 @@ public:
putIntegralUnchecked(value.low);
}
- PassRefPtr<ExecutableMemoryHandle> executableCopy(VM& vm, void* ownerUID, JITCompilationEffort effort)
- {
- flushConstantPool(false);
- return AssemblerBuffer::executableCopy(vm, ownerUID, effort);
- }
-
void putShortWithConstantInt(uint16_t insn, uint32_t constant, bool isReusable = false)
{
putIntegralWithConstantInt(insn, constant, isReusable);
@@ -229,6 +223,41 @@ public:
return m_numConsts;
}
+ void flushConstantPool(bool useBarrier = true)
+ {
+ if (!m_numConsts)
+ return;
+ int alignPool = (codeSize() + (useBarrier ? barrierSize : 0)) & (sizeof(uint64_t) - 1);
+
+ if (alignPool)
+ alignPool = sizeof(uint64_t) - alignPool;
+
+ // Callback to protect the constant pool from execution
+ if (useBarrier)
+ putIntegral(AssemblerType::placeConstantPoolBarrier(m_numConsts * sizeof(uint32_t) + alignPool));
+
+ if (alignPool) {
+ if (alignPool & 1)
+ AssemblerBuffer::putByte(AssemblerType::padForAlign8);
+ if (alignPool & 2)
+ AssemblerBuffer::putShort(AssemblerType::padForAlign16);
+ if (alignPool & 4)
+ AssemblerBuffer::putInt(AssemblerType::padForAlign32);
+ }
+
+ int constPoolOffset = codeSize();
+ append(reinterpret_cast<char*>(m_pool), m_numConsts * sizeof(uint32_t));
+
+ // Patch each PC relative load
+ for (LoadOffsets::Iterator iter = m_loadOffsets.begin(); iter != m_loadOffsets.end(); ++iter) {
+ void* loadAddr = reinterpret_cast<char*>(data()) + *iter;
+ AssemblerType::patchConstantPoolLoad(loadAddr, reinterpret_cast<char*>(data()) + constPoolOffset);
+ }
+
+ m_loadOffsets.clear();
+ m_numConsts = 0;
+ }
+
private:
void correctDeltas(int insnSize)
{
@@ -273,41 +302,6 @@ private:
correctDeltas(sizeof(IntegralType), 4);
}
- void flushConstantPool(bool useBarrier = true)
- {
- if (m_numConsts == 0)
- return;
- int alignPool = (codeSize() + (useBarrier ? barrierSize : 0)) & (sizeof(uint64_t) - 1);
-
- if (alignPool)
- alignPool = sizeof(uint64_t) - alignPool;
-
- // Callback to protect the constant pool from execution
- if (useBarrier)
- putIntegral(AssemblerType::placeConstantPoolBarrier(m_numConsts * sizeof(uint32_t) + alignPool));
-
- if (alignPool) {
- if (alignPool & 1)
- AssemblerBuffer::putByte(AssemblerType::padForAlign8);
- if (alignPool & 2)
- AssemblerBuffer::putShort(AssemblerType::padForAlign16);
- if (alignPool & 4)
- AssemblerBuffer::putInt(AssemblerType::padForAlign32);
- }
-
- int constPoolOffset = codeSize();
- append(reinterpret_cast<char*>(m_pool), m_numConsts * sizeof(uint32_t));
-
- // Patch each PC relative load
- for (LoadOffsets::Iterator iter = m_loadOffsets.begin(); iter != m_loadOffsets.end(); ++iter) {
- void* loadAddr = reinterpret_cast<char*>(data()) + *iter;
- AssemblerType::patchConstantPoolLoad(loadAddr, reinterpret_cast<char*>(data()) + constPoolOffset);
- }
-
- m_loadOffsets.clear();
- m_numConsts = 0;
- }
-
void flushIfNoSpaceFor(int nextInsnSize)
{
if (m_numConsts == 0)