summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorJiaxun Yang <jiaxun.yang@flygoat.com>2020-05-12 12:40:10 +0800
committerJiaxun Yang <jiaxun.yang@flygoat.com>2020-05-14 16:31:57 +0800
commitb878a54a2f977bbc6761737284cc730a94643ae9 (patch)
tree46dbbdca0060a5805e1a2474f0189efcc9095a00 /js
parent2501df81955781747c4d35916fa4e17235c18b04 (diff)
downloadUXP-b878a54a2f977bbc6761737284cc730a94643ae9.tar
UXP-b878a54a2f977bbc6761737284cc730a94643ae9.tar.gz
UXP-b878a54a2f977bbc6761737284cc730a94643ae9.tar.lz
UXP-b878a54a2f977bbc6761737284cc730a94643ae9.tar.xz
UXP-b878a54a2f977bbc6761737284cc730a94643ae9.zip
Bug 1271968 - IonMonkey: MIPS: Refactor addMixedJump.
Tag: #1542
Diffstat (limited to 'js')
-rw-r--r--js/src/jit/mips-shared/Assembler-mips-shared.cpp14
-rw-r--r--js/src/jit/mips-shared/Assembler-mips-shared.h8
-rw-r--r--js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp8
-rw-r--r--js/src/jit/mips32/MacroAssembler-mips32.cpp2
-rw-r--r--js/src/jit/mips64/MacroAssembler-mips64.cpp2
5 files changed, 17 insertions, 17 deletions
diff --git a/js/src/jit/mips-shared/Assembler-mips-shared.cpp b/js/src/jit/mips-shared/Assembler-mips-shared.cpp
index 63edc0b02..97f27c2e6 100644
--- a/js/src/jit/mips-shared/Assembler-mips-shared.cpp
+++ b/js/src/jit/mips-shared/Assembler-mips-shared.cpp
@@ -104,7 +104,7 @@ AssemblerMIPSShared::asmMergeWith(const AssemblerMIPSShared& other)
for (size_t i = 0; i < other.numMixedJumps(); i++) {
const MixedJumpPatch& mjp = other.mixedJumps_[i];
addMixedJump(BufferOffset(size() + mjp.src.getOffset()),
- ImmPtr(size() + mjp.target), mjp.kind);
+ size() + mjp.target, mjp.kind);
}
return m_buffer.appendBuffer(other.m_buffer);
}
@@ -1608,7 +1608,7 @@ AssemblerMIPSShared::bind(InstImm* inst, uintptr_t branch, uintptr_t target)
// Generate the patchable mixed jump for call.
if (inst->extractOpcode() == ((uint32_t)op_jal >> OpcodeShift)) {
- addMixedJump(BufferOffset(branch), ImmPtr((void*)target));
+ addMixedJump(BufferOffset(branch), target);
return;
}
@@ -1631,7 +1631,7 @@ AssemblerMIPSShared::bind(InstImm* inst, uintptr_t branch, uintptr_t target)
if (inst[0].encode() != inst_beq.encode())
kind = MixedJumpPatch::CONDITIONAL;
- addMixedJump(BufferOffset(branch), ImmPtr((const void*)target), kind);
+ addMixedJump(BufferOffset(branch), target, kind);
}
void
@@ -1650,7 +1650,7 @@ AssemblerMIPSShared::bind(RepatchLabel* label)
// If second instruction is lui, then this is a loop backedge.
if (inst[0].extractOpcode() == (uint32_t(op_j) >> OpcodeShift)) {
// For unconditional mixed branches generated by jumpWithPatch
- addMixedJump(b, ImmPtr((void*)dest.getOffset()), MixedJumpPatch::PATCHABLE);
+ addMixedJump(b, dest.getOffset(), MixedJumpPatch::PATCHABLE);
} else if (inst[1].extractOpcode() == (uint32_t(op_lui) >> OpcodeShift) ||
BOffImm16::IsInRange(offset))
{
@@ -1668,7 +1668,7 @@ AssemblerMIPSShared::bind(RepatchLabel* label)
// We need to add it to mixed jumps array here.
// See MacroAssemblerMIPS::branchWithCode().
MOZ_ASSERT(inst[1].encode() == NopInst);
- addMixedJump(b, ImmPtr((void*)dest.getOffset()), MixedJumpPatch::PATCHABLE);
+ addMixedJump(b, dest.getOffset(), MixedJumpPatch::PATCHABLE);
inst[0] = InstJump(op_j, JOffImm26(0)).encode();
} else {
// Handle open mixed conditional jumps created by
@@ -1680,7 +1680,7 @@ AssemblerMIPSShared::bind(RepatchLabel* label)
MOZ_ASSERT(inst[1].encode() == NopInst);
MOZ_ASSERT(inst[2].encode() == NopInst);
MOZ_ASSERT(inst[3].encode() == NopInst);
- addMixedJump(b, ImmPtr((void*)dest.getOffset()), MixedJumpPatch::PATCHABLE);
+ addMixedJump(b, dest.getOffset(), MixedJumpPatch::PATCHABLE);
inst[2] = InstJump(op_j, JOffImm26(0)).encode();
}
}
@@ -1840,7 +1840,7 @@ AssemblerMIPSShared::PatchMixedJumps(uint8_t* buffer)
MixedJumpPatch& mjp = mixedJump(i);
uint8_t* src = buffer + mjp.src.getOffset();
uint8_t* mid = nullptr;
- uint8_t* target = buffer + uintptr_t(mjp.target);
+ uint8_t* target = buffer + mjp.target;
InstImm* b = (InstImm*)src;
if (mjp.mid.assigned()) {
diff --git a/js/src/jit/mips-shared/Assembler-mips-shared.h b/js/src/jit/mips-shared/Assembler-mips-shared.h
index 3c01350e6..5a47eb1dc 100644
--- a/js/src/jit/mips-shared/Assembler-mips-shared.h
+++ b/js/src/jit/mips-shared/Assembler-mips-shared.h
@@ -842,10 +842,10 @@ class AssemblerMIPSShared : public AssemblerShared
BufferOffset src;
BufferOffset mid;
- void* target;
+ uintptr_t target;
Kind kind;
- MixedJumpPatch(BufferOffset src, void* target, Kind kind)
+ MixedJumpPatch(BufferOffset src, uintptr_t target, Kind kind)
: src(src),
mid(BufferOffset()),
target(target),
@@ -1256,10 +1256,10 @@ class AssemblerMIPSShared : public AssemblerShared
writeRelocation(src);
}
- void addMixedJump(BufferOffset src, ImmPtr target,
+ void addMixedJump(BufferOffset src, uintptr_t target,
MixedJumpPatch::Kind kind = MixedJumpPatch::NONE)
{
- enoughMemory_ &= mixedJumps_.append(MixedJumpPatch(src, target.value, kind));
+ enoughMemory_ &= mixedJumps_.append(MixedJumpPatch(src, target, kind));
}
virtual void GenerateMixedJumps() = 0;
diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
index 866a97dc8..38897de0d 100644
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
@@ -665,14 +665,14 @@ MacroAssemblerMIPSShared::branchWithCode(InstImm code, Label* label, JumpKind ju
InstImm inst_beq = InstImm(op_beq, zero, zero, BOffImm16(0));
if (code.encode() == inst_beq.encode()) {
// Handle mixed jump
- addMixedJump(nextOffset(), ImmPtr((void*)label->offset()));
+ addMixedJump(nextOffset(), label->offset());
as_j(JOffImm26(0));
as_nop();
return;
}
// Handle long conditional branch
- addMixedJump(nextOffset(), ImmPtr((void*)label->offset()), MixedJumpPatch::CONDITIONAL);
+ addMixedJump(nextOffset(), label->offset(), MixedJumpPatch::CONDITIONAL);
writeInst(code.encode());
as_nop();
return;
@@ -785,7 +785,7 @@ MacroAssemblerMIPSShared::ma_jal(Label* label)
{
if (label->bound()) {
// Generate the mixed jump.
- addMixedJump(nextOffset(), ImmPtr((void*)label->offset()));
+ addMixedJump(nextOffset(), label->offset());
as_jal(JOffImm26(0));
as_nop();
return;
@@ -1041,7 +1041,7 @@ MacroAssemblerMIPSShared::GenerateMixedJumps()
// Generate all mixed jumps.
for (size_t i = 0; i < numMixedJumps(); i++) {
MixedJumpPatch& mjp = mixedJump(i);
- if (MixedJumpPatch::NONE == mjp.kind && uintptr_t(mjp.target) <= size())
+ if (MixedJumpPatch::NONE == mjp.kind && mjp.target <= size())
continue;
BufferOffset bo = m_buffer.nextOffset();
if (MixedJumpPatch::CONDITIONAL & mjp.kind) {
diff --git a/js/src/jit/mips32/MacroAssembler-mips32.cpp b/js/src/jit/mips32/MacroAssembler-mips32.cpp
index 46e52f132..b4a148d8f 100644
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -1498,7 +1498,7 @@ MacroAssemblerMIPSCompat::jumpWithPatch(RepatchLabel* label, Label* documentatio
BufferOffset bo = nextOffset();
label->use(bo.getOffset());
if (label->bound())
- addMixedJump(bo, ImmPtr((void*)label->offset()), MixedJumpPatch::PATCHABLE);
+ addMixedJump(bo, label->offset(), MixedJumpPatch::PATCHABLE);
as_j(JOffImm26(0));
as_nop();
return CodeOffsetJump(bo.getOffset());
diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp
index 79ad8ce4a..f1ccc0b38 100644
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp
+++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ -1738,7 +1738,7 @@ MacroAssemblerMIPS64Compat::jumpWithPatch(RepatchLabel* label, Label* documentat
BufferOffset bo = nextOffset();
label->use(bo.getOffset());
if (label->bound())
- addMixedJump(bo, ImmPtr((void*)label->offset()), MixedJumpPatch::PATCHABLE);
+ addMixedJump(bo, label->offset(), MixedJumpPatch::PATCHABLE);
as_j(JOffImm26(0));
as_nop();
return CodeOffsetJump(bo.getOffset());