X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/93a3786624b2768d89bfa27e46598dc64e2fb70a..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/assembler/AssemblerBufferWithConstantPool.h diff --git a/assembler/AssemblerBufferWithConstantPool.h b/assembler/AssemblerBufferWithConstantPool.h index 852f86d..053884b 100644 --- a/assembler/AssemblerBufferWithConstantPool.h +++ b/assembler/AssemblerBufferWithConstantPool.h @@ -195,12 +195,6 @@ public: putIntegralUnchecked(value.low); } - PassRefPtr 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(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(data()) + *iter; + AssemblerType::patchConstantPoolLoad(loadAddr, reinterpret_cast(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(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(data()) + *iter; - AssemblerType::patchConstantPoolLoad(loadAddr, reinterpret_cast(data()) + constPoolOffset); - } - - m_loadOffsets.clear(); - m_numConsts = 0; - } - void flushIfNoSpaceFor(int nextInsnSize) { if (m_numConsts == 0)