diff options
author | Moonchild <moonchild@palemoon.org> | 2020-06-01 21:58:35 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-06-01 21:58:35 +0000 |
commit | c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810 (patch) | |
tree | c7672903a2030d37f861b12900165a015f49d10a /js/src/jit/ProcessExecutableMemory.cpp | |
parent | 451509e2c0188a4164d4b3d1d9f5839ed1e95246 (diff) | |
parent | 744b044935f7d1d67fbe0df42d898efcbdd00536 (diff) | |
download | UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.tar UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.tar.gz UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.tar.lz UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.tar.xz UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.zip |
Merge remote-tracking branch 'origin/redwood' into release
Diffstat (limited to 'js/src/jit/ProcessExecutableMemory.cpp')
-rw-r--r-- | js/src/jit/ProcessExecutableMemory.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/js/src/jit/ProcessExecutableMemory.cpp b/js/src/jit/ProcessExecutableMemory.cpp index 71c2ab0dc..1ba5c4aae 100644 --- a/js/src/jit/ProcessExecutableMemory.cpp +++ b/js/src/jit/ProcessExecutableMemory.cpp @@ -589,7 +589,23 @@ static ProcessExecutableMemory execMemory; void* js::jit::AllocateExecutableMemory(size_t bytes, ProtectionSetting protection) { +#if defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) + // On MIPS, j/jal instructions to branch within the current + // 256 MB-aligned region. + void* allocation = nullptr; + js::Vector<void*, 8, SystemAllocPolicy> unused_maps; + for (;;) { + allocation = execMemory.allocate(bytes, protection); + if ((uintptr_t(allocation) >> 28) == (uintptr_t(allocation + bytes) >> 28)) + break; + unused_maps.append(allocation); + } + for (size_t i = 0; i < unused_maps.length(); i++) + DeallocateExecutableMemory(unused_maps[i], bytes); + return allocation; +#else return execMemory.allocate(bytes, protection); +#endif } void |