diff options
Diffstat (limited to 'Source/JavaScriptCore/assembler/MIPSAssembler.h')
-rw-r--r-- | Source/JavaScriptCore/assembler/MIPSAssembler.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/Source/JavaScriptCore/assembler/MIPSAssembler.h b/Source/JavaScriptCore/assembler/MIPSAssembler.h index 5e0645129..7212a182c 100644 --- a/Source/JavaScriptCore/assembler/MIPSAssembler.h +++ b/Source/JavaScriptCore/assembler/MIPSAssembler.h @@ -718,7 +718,7 @@ public: insn = insn - 6; int flushSize = linkWithOffset(insn, to); - ExecutableAllocator::cacheFlush(insn, flushSize); + cacheFlush(insn, flushSize); } static void relinkCall(void* from, void* to) @@ -730,7 +730,7 @@ public: else start = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(from) - 4 * sizeof(MIPSWord)); - ExecutableAllocator::cacheFlush(start, size); + cacheFlush(start, size); } static void repatchInt32(void* from, int32_t to) @@ -742,7 +742,7 @@ public: ASSERT((*insn & 0xfc000000) == 0x34000000); // ori *insn = (*insn & 0xffff0000) | (to & 0xffff); insn--; - ExecutableAllocator::cacheFlush(insn, 2 * sizeof(MIPSWord)); + cacheFlush(insn, 2 * sizeof(MIPSWord)); } static int32_t readInt32(void* from) @@ -783,6 +783,32 @@ public: return reinterpret_cast<void*>(result); } + static void cacheFlush(void* code, size_t size) + { +#if GCC_VERSION_AT_LEAST(4, 3, 0) +#if WTF_MIPS_ISA_REV(2) && !GCC_VERSION_AT_LEAST(4, 4, 3) + int lineSize; + asm("rdhwr %0, $1" : "=r" (lineSize)); + // + // Modify "start" and "end" to avoid GCC 4.3.0-4.4.2 bug in + // mips_expand_synci_loop that may execute synci one more time. + // "start" points to the fisrt byte of the cache line. + // "end" points to the last byte of the line before the last cache line. + // Because size is always a multiple of 4, this is safe to set + // "end" to the last byte. + // + intptr_t start = reinterpret_cast<intptr_t>(code) & (-lineSize); + intptr_t end = ((reinterpret_cast<intptr_t>(code) + size - 1) & (-lineSize)) - 1; + __builtin___clear_cache(reinterpret_cast<char*>(start), reinterpret_cast<char*>(end)); +#else + intptr_t end = reinterpret_cast<intptr_t>(code) + size; + __builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(end)); +#endif +#else + _flush_cache(reinterpret_cast<char*>(code), size, BCACHE); +#endif + } + private: /* Update each jump in the buffer of newBase. */ void relocateJumps(void* oldBase, void* newBase) |