summaryrefslogtreecommitdiffstats
path: root/js/src/jit/mips-shared
diff options
context:
space:
mode:
authorJiaxun Yang <jiaxun.yang@flygoat.com>2020-05-12 12:40:08 +0800
committerJiaxun Yang <jiaxun.yang@flygoat.com>2020-05-14 16:31:56 +0800
commit6b56185c0b77cb4b3756fdd4b517b74c77c90afc (patch)
tree0d27f40fc49f7db56285adb0a2870e232cd67a8d /js/src/jit/mips-shared
parent1a61c518b69238f340cbb1cab1d97bae27fe3ad9 (diff)
downloadUXP-6b56185c0b77cb4b3756fdd4b517b74c77c90afc.tar
UXP-6b56185c0b77cb4b3756fdd4b517b74c77c90afc.tar.gz
UXP-6b56185c0b77cb4b3756fdd4b517b74c77c90afc.tar.lz
UXP-6b56185c0b77cb4b3756fdd4b517b74c77c90afc.tar.xz
UXP-6b56185c0b77cb4b3756fdd4b517b74c77c90afc.zip
Bug 1271968 - IonMonkey: MIPS: Merge MacroAssembler::ma_jal.
Tag: #1542
Diffstat (limited to 'js/src/jit/mips-shared')
-rw-r--r--js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp24
-rw-r--r--js/src/jit/mips-shared/MacroAssembler-mips-shared.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
index a8b53e67c..97660299a 100644
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
@@ -727,6 +727,30 @@ MacroAssemblerMIPSShared::ma_b(wasm::TrapDesc target, JumpKind jumpKind)
bindLater(&label, target);
}
+void
+MacroAssemblerMIPSShared::ma_jal(Label* label)
+{
+ if (label->bound()) {
+ // Generate the mixed jump.
+ addMixedJump(nextOffset(), ImmPtr((void*)label->offset()));
+ as_jal(JOffImm26(0));
+ as_nop();
+ return;
+ }
+
+ // Second word holds a pointer to the next branch in label's chain.
+ uint32_t nextInChain = label->used() ? label->offset() : LabelBase::INVALID_OFFSET;
+
+ // Make the whole branch continous in the buffer. The '2'
+ // instructions are writing at below (contain delay slot).
+ m_buffer.ensureSpace(2 * sizeof(uint32_t));
+
+ BufferOffset bo = as_jal(JOffImm26(0));
+ writeInst(nextInChain);
+ if (!oom())
+ label->use(bo.getOffset());
+}
+
Assembler::Condition
MacroAssemblerMIPSShared::ma_cmp(Register scratch, Register lhs, Register rhs, Condition c)
{
diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared.h b/js/src/jit/mips-shared/MacroAssembler-mips-shared.h
index 0fa73b616..b761c3e9e 100644
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.h
@@ -164,6 +164,8 @@ class MacroAssemblerMIPSShared : public Assembler
void ma_b(Label* l, JumpKind jumpKind = MixedJump);
void ma_b(wasm::TrapDesc target, JumpKind jumpKind = MixedJump);
+ void ma_jal(Label* l);
+
// fp instructions
void ma_lis(FloatRegister dest, float value);
void ma_lis(FloatRegister dest, wasm::RawF32 value);