Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: test/cctest/test-disasm-mips64.cc

Issue 1237083003: MIPS: Improved checking target ranges for J and JAL instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-disasm-mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-disasm-mips64.cc
diff --git a/test/cctest/test-disasm-mips64.cc b/test/cctest/test-disasm-mips64.cc
index 225a1e7f0b1baa253c71d3d4157ab2922d10be2d..e224131d6d5219225d14a2b4b500a5aa23c68a48 100644
--- a/test/cctest/test-disasm-mips64.cc
+++ b/test/cctest/test-disasm-mips64.cc
@@ -121,16 +121,25 @@ if (failure) { \
int pc_offset = assm.pc_offset(); \
byte *progcounter = &buffer[pc_offset]; \
char str_with_address[100]; \
- int instr_index = target >> 2; \
- snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \
- compare_string, reinterpret_cast<byte *>( \
- ((uint64_t)(progcounter + 1) & ~0xfffffff) | \
+ int instr_index = (target >> 2) & kImm26Mask; \
+ snprintf( \
+ str_with_address, sizeof(str_with_address), "%s %p -> %p", \
+ compare_string, reinterpret_cast<byte *>(target), \
+ reinterpret_cast<byte *>(((uint64_t)(progcounter + 1) & ~0xfffffff) | \
(instr_index << 2))); \
assm.asm_; \
if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \
}
+#define GET_PC_REGION(pc_region) \
+ { \
+ int pc_offset = assm.pc_offset(); \
+ byte *progcounter = &buffer[pc_offset]; \
+ pc_region = reinterpret_cast<int64_t>(progcounter + 4) & ~0xfffffff; \
+ }
+
+
TEST(Type0) {
SET_UP();
@@ -1114,12 +1123,18 @@ TEST(Type3) {
COMPARE_PC_REL_COMPACT(bgtz(a0, 32767), "1c807fff bgtz a0, 32767",
32767);
- COMPARE_PC_JUMP(j(0x4), "08000001 j 0x4", 0x4);
- COMPARE_PC_JUMP(j(0xffffffc), "0bffffff j 0xffffffc", 0xffffffc);
+ int64_t pc_region;
+ GET_PC_REGION(pc_region);
+
+ int64_t target = pc_region | 0x4;
+ COMPARE_PC_JUMP(j(target), "08000001 j ", target);
+ target = pc_region | 0xffffffc;
+ COMPARE_PC_JUMP(j(target), "0bffffff j ", target);
- COMPARE_PC_JUMP(jal(0x4), "0c000001 jal 0x4", 0x4);
- COMPARE_PC_JUMP(jal(0xffffffc), "0fffffff jal 0xffffffc",
- 0xffffffc);
+ target = pc_region | 0x4;
+ COMPARE_PC_JUMP(jal(target), "0c000001 jal ", target);
+ target = pc_region | 0xffffffc;
+ COMPARE_PC_JUMP(jal(target), "0fffffff jal ", target);
VERIFY_RUN();
}
« no previous file with comments | « test/cctest/test-disasm-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698