summaryrefslogtreecommitdiffstats
path: root/js/src/jit/mips64
diff options
context:
space:
mode:
authorJiaxun Yang <jiaxun.yang@flygoat.com>2020-05-12 12:40:09 +0800
committerMoonchild <moonchild@palemoon.org>2020-05-20 14:01:38 +0000
commitb4f0be5e9537c6c202443b34f7bb3b99cb08be0f (patch)
treefdb3814586b392b26494cf309d75f093674e33c5 /js/src/jit/mips64
parentac62e4cfdd03369d60e22f78b38b81f5f8daa5bd (diff)
downloadUXP-b4f0be5e9537c6c202443b34f7bb3b99cb08be0f.tar
UXP-b4f0be5e9537c6c202443b34f7bb3b99cb08be0f.tar.gz
UXP-b4f0be5e9537c6c202443b34f7bb3b99cb08be0f.tar.lz
UXP-b4f0be5e9537c6c202443b34f7bb3b99cb08be0f.tar.xz
UXP-b4f0be5e9537c6c202443b34f7bb3b99cb08be0f.zip
Bug 1271968 - IonMonkey: MIPS: Refactor PatchWrite_NearCall.
Tag: #1542
Diffstat (limited to 'js/src/jit/mips64')
-rw-r--r--js/src/jit/mips64/Assembler-mips64.cpp39
-rw-r--r--js/src/jit/mips64/Assembler-mips64.h8
2 files changed, 3 insertions, 44 deletions
diff --git a/js/src/jit/mips64/Assembler-mips64.cpp b/js/src/jit/mips64/Assembler-mips64.cpp
index a7254b825..4f3eac094 100644
--- a/js/src/jit/mips64/Assembler-mips64.cpp
+++ b/js/src/jit/mips64/Assembler-mips64.cpp
@@ -228,32 +228,6 @@ Assembler::Bind(uint8_t* rawCode, CodeOffset* label, const void* address)
}
}
-uint32_t
-Assembler::PatchWrite_NearCallSize()
-{
- // Load an address needs 4 instructions, and a jump with a delay slot.
- return (4 + 2) * sizeof(uint32_t);
-}
-
-void
-Assembler::PatchWrite_NearCall(CodeLocationLabel start, CodeLocationLabel toCall)
-{
- Instruction* inst = (Instruction*) start.raw();
- uint8_t* dest = toCall.raw();
-
- // Overwrite whatever instruction used to be here with a call.
- // Always use long jump for two reasons:
- // - Jump has to be the same size because of PatchWrite_NearCallSize.
- // - Return address has to be at the end of replaced block.
- // Short jump wouldn't be more efficient.
- Assembler::WriteLoad64Instructions(inst, ScratchRegister, (uint64_t)dest);
- inst[4] = InstReg(op_special, ScratchRegister, zero, ra, ff_jalr);
- inst[5] = InstNOP();
-
- // Ensure everyone sees the code that was just written into memory.
- AutoFlushICache::flush(uintptr_t(inst), PatchWrite_NearCallSize());
-}
-
uint64_t
Assembler::ExtractLoad64Value(Instruction* inst0)
{
@@ -315,19 +289,6 @@ Assembler::UpdateLoad64Value(Instruction* inst0, uint64_t value)
}
void
-Assembler::WriteLoad64Instructions(Instruction* inst0, Register reg, uint64_t value)
-{
- Instruction* inst1 = inst0->next();
- Instruction* inst2 = inst1->next();
- Instruction* inst3 = inst2->next();
-
- *inst0 = InstImm(op_lui, zero, reg, Imm16::Lower(Imm32(value >> 32)));
- *inst1 = InstImm(op_ori, reg, reg, Imm16::Upper(Imm32(value)));
- *inst2 = InstReg(op_special, rs_one, reg, reg, 48 - 32, ff_dsrl32);
- *inst3 = InstImm(op_ori, reg, reg, Imm16::Lower(Imm32(value)));
-}
-
-void
Assembler::PatchDataWithValueCheck(CodeLocationLabel label, ImmPtr newValue,
ImmPtr expectedValue)
{
diff --git a/js/src/jit/mips64/Assembler-mips64.h b/js/src/jit/mips64/Assembler-mips64.h
index 6561ba6c4..5ca003438 100644
--- a/js/src/jit/mips64/Assembler-mips64.h
+++ b/js/src/jit/mips64/Assembler-mips64.h
@@ -148,14 +148,12 @@ class Assembler : public AssemblerMIPSShared
static void TraceJumpRelocations(JSTracer* trc, JitCode* code, CompactBufferReader& reader);
static void TraceDataRelocations(JSTracer* trc, JitCode* code, CompactBufferReader& reader);
- static uint32_t PatchWrite_NearCallSize();
-
+ static uint32_t InstructionImmediateSize() {
+ return 4 * sizeof(uint32_t);
+ }
static uint64_t ExtractLoad64Value(Instruction* inst0);
static void UpdateLoad64Value(Instruction* inst0, uint64_t value);
- static void WriteLoad64Instructions(Instruction* inst0, Register reg, uint64_t value);
-
- static void PatchWrite_NearCall(CodeLocationLabel start, CodeLocationLabel toCall);
static void PatchDataWithValueCheck(CodeLocationLabel label, ImmPtr newValue,
ImmPtr expectedValue);
static void PatchDataWithValueCheck(CodeLocationLabel label, PatchedImmPtr newValue,