OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // value. If the comparison fails an error message is printed, but the test | 85 // value. If the comparison fails an error message is printed, but the test |
86 // continues to run until the end. | 86 // continues to run until the end. |
87 #define COMPARE(asm_, compare_string) \ | 87 #define COMPARE(asm_, compare_string) \ |
88 { \ | 88 { \ |
89 int pc_offset = assm.pc_offset(); \ | 89 int pc_offset = assm.pc_offset(); \ |
90 byte *progcounter = &buffer[pc_offset]; \ | 90 byte *progcounter = &buffer[pc_offset]; \ |
91 assm.asm_; \ | 91 assm.asm_; \ |
92 if (!DisassembleAndCompare(progcounter, compare_string)) failure = true; \ | 92 if (!DisassembleAndCompare(progcounter, compare_string)) failure = true; \ |
93 } | 93 } |
94 | 94 |
| 95 // Force emission of any pending literals into a pool. |
| 96 #define EMIT_PENDING_LITERALS() \ |
| 97 assm.CheckConstPool(true, false) |
| 98 |
95 | 99 |
96 // Verify that all invocations of the COMPARE macro passed successfully. | 100 // Verify that all invocations of the COMPARE macro passed successfully. |
97 // Exit with a failure if at least one of the tests failed. | 101 // Exit with a failure if at least one of the tests failed. |
98 #define VERIFY_RUN() \ | 102 #define VERIFY_RUN() \ |
99 if (failure) { \ | 103 if (failure) { \ |
100 V8_Fatal(__FILE__, __LINE__, "ARM Disassembler tests failed.\n"); \ | 104 V8_Fatal(__FILE__, __LINE__, "ARM Disassembler tests failed.\n"); \ |
101 } | 105 } |
102 | 106 |
103 | 107 |
104 TEST(Type0) { | 108 TEST(Type0) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 if (CpuFeatures::IsSupported(ARMv7)) { | 277 if (CpuFeatures::IsSupported(ARMv7)) { |
274 COMPARE(mov(r5, Operand(0x01234), LeaveCC, ne), | 278 COMPARE(mov(r5, Operand(0x01234), LeaveCC, ne), |
275 "13015234 movwne r5, #4660"); | 279 "13015234 movwne r5, #4660"); |
276 // We only disassemble one instruction so the eor instruction is not here. | 280 // We only disassemble one instruction so the eor instruction is not here. |
277 COMPARE(eor(r5, r4, Operand(0x1234), LeaveCC, ne), | 281 COMPARE(eor(r5, r4, Operand(0x1234), LeaveCC, ne), |
278 "1301c234 movwne ip, #4660"); | 282 "1301c234 movwne ip, #4660"); |
279 // Movw can't do setcc so we don't get that here. Mov immediate with setcc | 283 // Movw can't do setcc so we don't get that here. Mov immediate with setcc |
280 // is pretty strange anyway. | 284 // is pretty strange anyway. |
281 COMPARE(mov(r5, Operand(0x01234), SetCC, ne), | 285 COMPARE(mov(r5, Operand(0x01234), SetCC, ne), |
282 "159fc000 ldrne ip, [pc, #+0]"); | 286 "159fc000 ldrne ip, [pc, #+0]"); |
| 287 // Emit a literal pool now, otherwise this could be dumped later, in the |
| 288 // middle of a different test. |
| 289 EMIT_PENDING_LITERALS(); |
| 290 |
283 // We only disassemble one instruction so the eor instruction is not here. | 291 // We only disassemble one instruction so the eor instruction is not here. |
284 // The eor does the setcc so we get a movw here. | 292 // The eor does the setcc so we get a movw here. |
285 COMPARE(eor(r5, r4, Operand(0x1234), SetCC, ne), | 293 COMPARE(eor(r5, r4, Operand(0x1234), SetCC, ne), |
286 "1301c234 movwne ip, #4660"); | 294 "1301c234 movwne ip, #4660"); |
287 | 295 |
288 COMPARE(movt(r5, 0x4321, ne), | 296 COMPARE(movt(r5, 0x4321, ne), |
289 "13445321 movtne r5, #17185"); | 297 "13445321 movtne r5, #17185"); |
290 COMPARE(movw(r5, 0xabcd, eq), | 298 COMPARE(movw(r5, 0xabcd, eq), |
291 "030a5bcd movweq r5, #43981"); | 299 "030a5bcd movweq r5, #43981"); |
292 } | 300 } |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 "e04987ff strd r8, [r9], #-127"); | 747 "e04987ff strd r8, [r9], #-127"); |
740 COMPARE(strd(r10, fp, MemOperand(fp, 127, PreIndex)), | 748 COMPARE(strd(r10, fp, MemOperand(fp, 127, PreIndex)), |
741 "e1eba7ff strd r10, [fp, #+127]!"); | 749 "e1eba7ff strd r10, [fp, #+127]!"); |
742 COMPARE(strd(ip, sp, MemOperand(sp, -127, PreIndex)), | 750 COMPARE(strd(ip, sp, MemOperand(sp, -127, PreIndex)), |
743 "e16dc7ff strd ip, [sp, #-127]!"); | 751 "e16dc7ff strd ip, [sp, #-127]!"); |
744 } | 752 } |
745 | 753 |
746 VERIFY_RUN(); | 754 VERIFY_RUN(); |
747 } | 755 } |
748 | 756 |
OLD | NEW |