Reviewers: paul.l..., akos.palfi.imgtec, balazs.kilvady,
djordje.pesic_imgtec.com, ilija.pavlovic_imgtec.com,
Description:
MIPS64: Fix hidden bug in relocations for j and jal.
Resolves flaky failures of mozilla regress tests.
Additionally removed asserts from j and jal which are not
valid because addresses are not final and valid in code generation phase.
TEST=mozilla/js1_5/Regress/regress-280769-2, regress-367561-01,
mozilla/ecma_3/Statements/regress-444979
BUG=
Please review this at https://codereview.chromium.org/1216823003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+8, -23 lines):
M src/mips64/assembler-mips64.h
M src/mips64/assembler-mips64.cc
M src/mips64/assembler-mips64-inl.h
Index: src/mips64/assembler-mips64-inl.h
diff --git a/src/mips64/assembler-mips64-inl.h
b/src/mips64/assembler-mips64-inl.h
index
40c7640f2f8272b99c2ae826605098dc3117314b..f5ab3ae65f582d03e77dd9221cd3e2100a53bca6
100644
--- a/src/mips64/assembler-mips64-inl.h
+++ b/src/mips64/assembler-mips64-inl.h
@@ -121,7 +121,7 @@ void RelocInfo::apply(intptr_t delta, ICacheFlushMode
icache_flush_mode) {
if (IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)) {
// Absolute code pointer inside code object moves with the code object.
byte* p = reinterpret_cast<byte*>(pc_);
- int count = Assembler::RelocateInternalReference(rmode_, p, delta);
+ int count = Assembler::RelocateInternalReference(rmode_, p, delta,
true);
CpuFeatures::FlushICache(p, count * sizeof(uint32_t));
}
}
Index: src/mips64/assembler-mips64.cc
diff --git a/src/mips64/assembler-mips64.cc b/src/mips64/assembler-mips64.cc
index
36de2863137c4b81c7ccd378e81de9a3975b70ef..c9a618f08d7954256de3ecc5a2d4e99c14e5b823
100644
--- a/src/mips64/assembler-mips64.cc
+++ b/src/mips64/assembler-mips64.cc
@@ -1405,15 +1405,6 @@ void Assembler::bnezc(Register rs, int32_t offset) {
void Assembler::j(int64_t target) {
-#if DEBUG
- // Get pc of delay slot.
- if (target != kEndOfJumpChain) {
- uint64_t ipc = reinterpret_cast<uint64_t>(pc_ + 1 * kInstrSize);
- bool in_range = ((ipc ^ static_cast<uint64_t>(target)) >>
- (kImm26Bits + kImmFieldShift)) == 0;
- DCHECK(in_range && ((target & 3) == 0));
- }
-#endif
GenInstrJump(J, static_cast<uint32_t>(target >> 2) & kImm26Mask);
}
@@ -1433,15 +1424,6 @@ void Assembler::jr(Register rs) {
void Assembler::jal(int64_t target) {
-#ifdef DEBUG
- // Get pc of delay slot.
- if (target != kEndOfJumpChain) {
- uint64_t ipc = reinterpret_cast<uint64_t>(pc_ + 1 * kInstrSize);
- bool in_range = ((ipc ^ static_cast<uint64_t>(target)) >>
- (kImm26Bits + kImmFieldShift)) == 0;
- DCHECK(in_range && ((target & 3) == 0));
- }
-#endif
positions_recorder()->WriteRecordedPositions();
GenInstrJump(JAL, static_cast<uint32_t>(target >> 2) & kImm26Mask);
}
@@ -2909,7 +2891,8 @@ void Assembler::bc1t(int16_t offset, uint16_t cc) {
// Debugging.
int Assembler::RelocateInternalReference(RelocInfo::Mode rmode, byte* pc,
- intptr_t pc_delta) {
+ intptr_t pc_delta,
+ bool IsAllAddressValid) {
if (RelocInfo::IsInternalReference(rmode)) {
int64_t* p = reinterpret_cast<int64_t*>(pc);
if (*p == kEndOfJumpChain) {
@@ -2953,7 +2936,8 @@ int
Assembler::RelocateInternalReference(RelocInfo::Mode rmode, byte* pc,
return 4; // Number of instructions patched.
} else {
uint32_t imm28 = (instr & static_cast<int32_t>(kImm26Mask)) << 2;
- if (static_cast<int32_t>(imm28) == kEndOfJumpChain) {
+ if (!IsAllAddressValid &&
+ (static_cast<int32_t>(imm28) == kEndOfJumpChain)) {
return 0; // Number of instructions patched.
}
@@ -3012,7 +2996,7 @@ void Assembler::GrowBuffer() {
if (rmode == RelocInfo::INTERNAL_REFERENCE_ENCODED ||
rmode == RelocInfo::INTERNAL_REFERENCE) {
byte* p = reinterpret_cast<byte*>(it.rinfo()->pc());
- RelocateInternalReference(rmode, p, pc_delta);
+ RelocateInternalReference(rmode, p, pc_delta, false);
}
}
DCHECK(!overflow());
Index: src/mips64/assembler-mips64.h
diff --git a/src/mips64/assembler-mips64.h b/src/mips64/assembler-mips64.h
index
a83661c087dac4a6d8fe6c46077accda506ffe1d..6d27c0479e3d3ecc168b4f242d977a2fab22d1f4
100644
--- a/src/mips64/assembler-mips64.h
+++ b/src/mips64/assembler-mips64.h
@@ -1129,7 +1129,8 @@ class Assembler : public AssemblerBase {
void RecordDeoptReason(const int reason, const SourcePosition position);
static int RelocateInternalReference(RelocInfo::Mode rmode, byte* pc,
- intptr_t pc_delta);
+ intptr_t pc_delta,
+ bool IsAllAddressValid);
// Writes a single byte or word of data in the code stream. Used for
// inline tables, e.g., jump-tables.
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.