mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Extend the IC protection introduced by bug 614323. [Bug 615875] [r=cdleary]
This commit is contained in:
parent
1fd3424219
commit
2331ad205e
@ -932,6 +932,13 @@ namespace JSC {
|
|||||||
return m_buffer.sizeOfConstantPool();
|
return m_buffer.sizeOfConstantPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
void allowPoolFlush(bool allowFlush)
|
||||||
|
{
|
||||||
|
m_buffer.allowPoolFlush(allowFlush);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
JmpDst label()
|
JmpDst label()
|
||||||
{
|
{
|
||||||
JmpDst label(m_buffer.size());
|
JmpDst label(m_buffer.size());
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#include "AssemblerBuffer.h"
|
#include "AssemblerBuffer.h"
|
||||||
#include "assembler/wtf/SegmentedVector.h"
|
#include "assembler/wtf/SegmentedVector.h"
|
||||||
|
#include "assembler/wtf/Assertions.h"
|
||||||
|
|
||||||
#define ASSEMBLER_HAS_CONSTANT_POOL 1
|
#define ASSEMBLER_HAS_CONSTANT_POOL 1
|
||||||
|
|
||||||
@ -103,6 +104,9 @@ public:
|
|||||||
, m_numConsts(0)
|
, m_numConsts(0)
|
||||||
, m_maxDistance(maxPoolSize)
|
, m_maxDistance(maxPoolSize)
|
||||||
, m_lastConstDelta(0)
|
, m_lastConstDelta(0)
|
||||||
|
#ifdef DEBUG
|
||||||
|
, m_allowFlush(true)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_pool = static_cast<uint32_t*>(malloc(maxPoolSize));
|
m_pool = static_cast<uint32_t*>(malloc(maxPoolSize));
|
||||||
m_mask = static_cast<char*>(malloc(maxPoolSize / sizeof(uint32_t)));
|
m_mask = static_cast<char*>(malloc(maxPoolSize / sizeof(uint32_t)));
|
||||||
@ -235,6 +239,15 @@ public:
|
|||||||
return m_numConsts;
|
return m_numConsts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
// Guard constant pool flushes to ensure that they don't occur during
|
||||||
|
// regions where offsets into the code have to be maintained (such as PICs).
|
||||||
|
void allowPoolFlush(bool allowFlush)
|
||||||
|
{
|
||||||
|
m_allowFlush = allowFlush;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void correctDeltas(int insnSize)
|
void correctDeltas(int insnSize)
|
||||||
{
|
{
|
||||||
@ -254,6 +267,7 @@ private:
|
|||||||
|
|
||||||
void flushConstantPool(bool useBarrier = true)
|
void flushConstantPool(bool useBarrier = true)
|
||||||
{
|
{
|
||||||
|
ASSERT(m_allowFlush);
|
||||||
if (m_numConsts == 0)
|
if (m_numConsts == 0)
|
||||||
return;
|
return;
|
||||||
int alignPool = (AssemblerBuffer::size() + (useBarrier ? barrierSize : 0)) & (sizeof(uint64_t) - 1);
|
int alignPool = (AssemblerBuffer::size() + (useBarrier ? barrierSize : 0)) & (sizeof(uint64_t) - 1);
|
||||||
@ -313,6 +327,10 @@ private:
|
|||||||
int m_numConsts;
|
int m_numConsts;
|
||||||
int m_maxDistance;
|
int m_maxDistance;
|
||||||
int m_lastConstDelta;
|
int m_lastConstDelta;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
bool m_allowFlush;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace JSC
|
} // namespace JSC
|
||||||
|
@ -1078,6 +1078,13 @@ public:
|
|||||||
m_assembler.forceFlushConstantPool();
|
m_assembler.forceFlushConstantPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
void allowPoolFlush(bool allowFlush)
|
||||||
|
{
|
||||||
|
m_assembler.allowPoolFlush(allowFlush);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ARMAssembler::Condition ARMCondition(Condition cond)
|
ARMAssembler::Condition ARMCondition(Condition cond)
|
||||||
{
|
{
|
||||||
|
@ -207,7 +207,7 @@ class Repatcher : public JSC::RepatchBuffer
|
|||||||
#ifdef JS_CPU_ARM
|
#ifdef JS_CPU_ARM
|
||||||
class AutoReserveICSpace {
|
class AutoReserveICSpace {
|
||||||
typedef Assembler::Label Label;
|
typedef Assembler::Label Label;
|
||||||
static const size_t reservedSpace = 64;
|
static const size_t reservedSpace = 68;
|
||||||
|
|
||||||
Assembler &masm;
|
Assembler &masm;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -219,6 +219,11 @@ class AutoReserveICSpace {
|
|||||||
masm.ensureSpace(reservedSpace);
|
masm.ensureSpace(reservedSpace);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
startLabel = masm.label();
|
startLabel = masm.label();
|
||||||
|
|
||||||
|
/* Assert that the constant pool is not flushed until we reach a safe point. */
|
||||||
|
masm.allowPoolFlush(false);
|
||||||
|
|
||||||
|
JaegerSpew(JSpew_Insns, " -- BEGIN CONSTANT-POOL-FREE REGION -- \n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,8 +231,18 @@ class AutoReserveICSpace {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Label endLabel = masm.label();
|
Label endLabel = masm.label();
|
||||||
int spaceUsed = masm.differenceBetween(startLabel, endLabel);
|
int spaceUsed = masm.differenceBetween(startLabel, endLabel);
|
||||||
|
|
||||||
|
/* Spew the space used, to help tuning of reservedSpace. */
|
||||||
|
JaegerSpew(JSpew_Insns,
|
||||||
|
" -- END CONSTANT-POOL-FREE REGION: %u bytes used of %u reserved. -- \n",
|
||||||
|
spaceUsed, reservedSpace);
|
||||||
|
|
||||||
|
/* Assert that we didn't emit more code than we protected. */
|
||||||
JS_ASSERT(spaceUsed >= 0);
|
JS_ASSERT(spaceUsed >= 0);
|
||||||
JS_ASSERT(size_t(spaceUsed) <= reservedSpace);
|
JS_ASSERT(size_t(spaceUsed) <= reservedSpace);
|
||||||
|
|
||||||
|
/* Allow the pool to be flushed. */
|
||||||
|
masm.allowPoolFlush(true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user