diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Source/JavaScriptCore/assembler/AbstractMacroAssembler.h | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/assembler/AbstractMacroAssembler.h')
-rw-r--r-- | Source/JavaScriptCore/assembler/AbstractMacroAssembler.h | 86 |
1 files changed, 80 insertions, 6 deletions
diff --git a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h index 673031b7a..1861dc15c 100644 --- a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h +++ b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h @@ -31,7 +31,6 @@ #include "MacroAssemblerCodeRef.h" #include <wtf/CryptographicallyRandomNumber.h> #include <wtf/Noncopyable.h> -#include <wtf/UnusedParam.h> #if ENABLE(ASSEMBLER) @@ -46,12 +45,30 @@ namespace JSC { +inline bool isARMv7s() +{ +#if CPU(APPLE_ARMV7S) + return true; +#else + return false; +#endif +} + +inline bool isX86() +{ +#if CPU(X86_64) || CPU(X86) + return true; +#else + return false; +#endif +} + class JumpReplacementWatchpoint; class LinkBuffer; class RepatchBuffer; class Watchpoint; namespace DFG { -class CorrectableJumpPoint; +struct OSRExit; } template <class AssemblerType> @@ -320,7 +337,7 @@ public: class Label { template<class TemplateAssemblerType> friend class AbstractMacroAssembler; - friend class DFG::CorrectableJumpPoint; + friend struct DFG::OSRExit; friend class Jump; friend class JumpReplacementWatchpoint; friend class MacroAssemblerCodeRef; @@ -501,7 +518,7 @@ public: template<class TemplateAssemblerType> friend class AbstractMacroAssembler; friend class Call; - friend class DFG::CorrectableJumpPoint; + friend struct DFG::OSRExit; friend class LinkBuffer; public: Jump() @@ -510,7 +527,7 @@ public: #if CPU(ARM_THUMB2) // Fixme: this information should be stored in the instruction stream, not in the Jump object. - Jump(AssemblerLabel jmp, ARMv7Assembler::JumpType type, ARMv7Assembler::Condition condition = ARMv7Assembler::ConditionInvalid) + Jump(AssemblerLabel jmp, ARMv7Assembler::JumpType type = ARMv7Assembler::JumpNoCondition, ARMv7Assembler::Condition condition = ARMv7Assembler::ConditionInvalid) : m_label(jmp) , m_type(type) , m_condition(condition) @@ -528,9 +545,20 @@ public: { } #endif + + Label label() const + { + Label result; + result.m_label = m_label; + return result; + } void link(AbstractMacroAssembler<AssemblerType>* masm) const { +#if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION) + masm->checkRegisterAllocationAgainstBranchRange(m_label.m_offset, masm->debugOffset()); +#endif + #if CPU(ARM_THUMB2) masm->m_assembler.linkJump(m_label, masm->m_assembler.label(), m_type, m_condition); #elif CPU(SH4) @@ -542,6 +570,10 @@ public: void linkTo(Label label, AbstractMacroAssembler<AssemblerType>* masm) const { +#if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION) + masm->checkRegisterAllocationAgainstBranchRange(label.m_label.m_offset, m_label.m_offset); +#endif + #if CPU(ARM_THUMB2) masm->m_assembler.linkJump(m_label, label.m_label, m_type, m_condition); #else @@ -585,7 +617,7 @@ public: friend class LinkBuffer; public: - typedef Vector<Jump, 16> JumpVector; + typedef Vector<Jump, 2> JumpVector; JumpList() { } @@ -676,6 +708,44 @@ public: return Label(this); } +#if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION) + class RegisterAllocationOffset { + public: + RegisterAllocationOffset(unsigned offset) + : m_offset(offset) + { + } + + void check(unsigned low, unsigned high) + { + RELEASE_ASSERT_WITH_MESSAGE(!(low <= m_offset && m_offset <= high), "Unsafe branch over register allocation at instruction offset %u in jump offset range %u..%u", m_offset, low, high); + } + + private: + unsigned m_offset; + }; + + void addRegisterAllocationAtOffset(unsigned offset) + { + m_registerAllocationForOffsets.append(RegisterAllocationOffset(offset)); + } + + void clearRegisterAllocationOffsets() + { + m_registerAllocationForOffsets.clear(); + } + + void checkRegisterAllocationAgainstBranchRange(unsigned offset1, unsigned offset2) + { + if (offset1 > offset2) + std::swap(offset1, offset2); + + size_t size = m_registerAllocationForOffsets.size(); + for (size_t i = 0; i < size; ++i) + m_registerAllocationForOffsets[i].check(offset1, offset2); + } +#endif + template<typename T, typename U> static ptrdiff_t differenceBetween(T from, U to) { @@ -708,6 +778,10 @@ protected: WeakRandom m_randomSource; +#if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION) + Vector<RegisterAllocationOffset, 10> m_registerAllocationForOffsets; +#endif + #if ENABLE(JIT_CONSTANT_BLINDING) static bool scratchRegisterForBlinding() { return false; } static bool shouldBlindForSpecificArch(uint32_t) { return true; } |