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

Side by Side Diff: test/cctest/test-disasm-arm.cc

Issue 9139051: Cosmetic changes ("set up" is a verb, "setup" is a noun). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-disasm-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 "%s\n" 62 "%s\n"
63 "disassembled: \n" 63 "disassembled: \n"
64 "%s\n\n", 64 "%s\n\n",
65 compare_string, disasm_buffer.start()); 65 compare_string, disasm_buffer.start());
66 return false; 66 return false;
67 } 67 }
68 return true; 68 return true;
69 } 69 }
70 70
71 71
72 // Setup V8 to a state where we can at least run the assembler and 72 // Set up V8 to a state where we can at least run the assembler and
73 // disassembler. Declare the variables and allocate the data structures used 73 // disassembler. Declare the variables and allocate the data structures used
74 // in the rest of the macros. 74 // in the rest of the macros.
75 #define SETUP() \ 75 #define SET_UP() \
76 InitializeVM(); \ 76 InitializeVM(); \
77 v8::HandleScope scope; \ 77 v8::HandleScope scope; \
78 byte *buffer = reinterpret_cast<byte*>(malloc(4*1024)); \ 78 byte *buffer = reinterpret_cast<byte*>(malloc(4*1024)); \
79 Assembler assm(Isolate::Current(), buffer, 4*1024); \ 79 Assembler assm(Isolate::Current(), buffer, 4*1024); \
80 bool failure = false; 80 bool failure = false;
81 81
82 82
83 // This macro assembles one instruction using the preallocated assembler and 83 // This macro assembles one instruction using the preallocated assembler and
84 // disassembles the generated instruction, comparing the output to the expected 84 // disassembles the generated instruction, comparing the output to the expected
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 95
96 // Verify that all invocations of the COMPARE macro passed successfully. 96 // Verify that all invocations of the COMPARE macro passed successfully.
97 // Exit with a failure if at least one of the tests failed. 97 // Exit with a failure if at least one of the tests failed.
98 #define VERIFY_RUN() \ 98 #define VERIFY_RUN() \
99 if (failure) { \ 99 if (failure) { \
100 V8_Fatal(__FILE__, __LINE__, "ARM Disassembler tests failed.\n"); \ 100 V8_Fatal(__FILE__, __LINE__, "ARM Disassembler tests failed.\n"); \
101 } 101 }
102 102
103 103
104 TEST(Type0) { 104 TEST(Type0) {
105 SETUP(); 105 SET_UP();
106 106
107 COMPARE(and_(r0, r1, Operand(r2)), 107 COMPARE(and_(r0, r1, Operand(r2)),
108 "e0010002 and r0, r1, r2"); 108 "e0010002 and r0, r1, r2");
109 COMPARE(and_(r1, r2, Operand(r3), LeaveCC), 109 COMPARE(and_(r1, r2, Operand(r3), LeaveCC),
110 "e0021003 and r1, r2, r3"); 110 "e0021003 and r1, r2, r3");
111 COMPARE(and_(r2, r3, Operand(r4), SetCC), 111 COMPARE(and_(r2, r3, Operand(r4), SetCC),
112 "e0132004 ands r2, r3, r4"); 112 "e0132004 ands r2, r3, r4");
113 COMPARE(and_(r3, r4, Operand(r5), LeaveCC, eq), 113 COMPARE(and_(r3, r4, Operand(r5), LeaveCC, eq),
114 "00043005 andeq r3, r4, r5"); 114 "00043005 andeq r3, r4, r5");
115 115
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 COMPARE(bkpt(0xffff), 322 COMPARE(bkpt(0xffff),
323 "e12fff7f bkpt 65535"); 323 "e12fff7f bkpt 65535");
324 COMPARE(clz(r6, r7), 324 COMPARE(clz(r6, r7),
325 "e16f6f17 clz r6, r7"); 325 "e16f6f17 clz r6, r7");
326 326
327 VERIFY_RUN(); 327 VERIFY_RUN();
328 } 328 }
329 329
330 330
331 TEST(Type1) { 331 TEST(Type1) {
332 SETUP(); 332 SET_UP();
333 333
334 COMPARE(and_(r0, r1, Operand(0x00000000)), 334 COMPARE(and_(r0, r1, Operand(0x00000000)),
335 "e2010000 and r0, r1, #0"); 335 "e2010000 and r0, r1, #0");
336 COMPARE(and_(r1, r2, Operand(0x00000001), LeaveCC), 336 COMPARE(and_(r1, r2, Operand(0x00000001), LeaveCC),
337 "e2021001 and r1, r2, #1"); 337 "e2021001 and r1, r2, #1");
338 COMPARE(and_(r2, r3, Operand(0x00000010), SetCC), 338 COMPARE(and_(r2, r3, Operand(0x00000010), SetCC),
339 "e2132010 ands r2, r3, #16"); 339 "e2132010 ands r2, r3, #16");
340 COMPARE(and_(r3, r4, Operand(0x00000100), LeaveCC, eq), 340 COMPARE(and_(r3, r4, Operand(0x00000100), LeaveCC, eq),
341 "02043c01 andeq r3, r4, #256"); 341 "02043c01 andeq r3, r4, #256");
342 COMPARE(and_(r4, r5, Operand(0x00001000), SetCC, ne), 342 COMPARE(and_(r4, r5, Operand(0x00001000), SetCC, ne),
343 "12154a01 andnes r4, r5, #4096"); 343 "12154a01 andnes r4, r5, #4096");
344 344
345 COMPARE(eor(r4, r5, Operand(0x00001000)), 345 COMPARE(eor(r4, r5, Operand(0x00001000)),
346 "e2254a01 eor r4, r5, #4096"); 346 "e2254a01 eor r4, r5, #4096");
347 COMPARE(eor(r4, r4, Operand(0x00010000), LeaveCC), 347 COMPARE(eor(r4, r4, Operand(0x00010000), LeaveCC),
348 "e2244801 eor r4, r4, #65536"); 348 "e2244801 eor r4, r4, #65536");
349 COMPARE(eor(r4, r3, Operand(0x00100000), SetCC), 349 COMPARE(eor(r4, r3, Operand(0x00100000), SetCC),
350 "e2334601 eors r4, r3, #1048576"); 350 "e2334601 eors r4, r3, #1048576");
351 COMPARE(eor(r4, r2, Operand(0x01000000), LeaveCC, cs), 351 COMPARE(eor(r4, r2, Operand(0x01000000), LeaveCC, cs),
352 "22224401 eorcs r4, r2, #16777216"); 352 "22224401 eorcs r4, r2, #16777216");
353 COMPARE(eor(r4, r1, Operand(0x10000000), SetCC, cc), 353 COMPARE(eor(r4, r1, Operand(0x10000000), SetCC, cc),
354 "32314201 eorccs r4, r1, #268435456"); 354 "32314201 eorccs r4, r1, #268435456");
355 355
356 VERIFY_RUN(); 356 VERIFY_RUN();
357 } 357 }
358 358
359 359
360 TEST(Type3) { 360 TEST(Type3) {
361 SETUP(); 361 SET_UP();
362 362
363 if (CpuFeatures::IsSupported(ARMv7)) { 363 if (CpuFeatures::IsSupported(ARMv7)) {
364 COMPARE(ubfx(r0, r1, 5, 10), 364 COMPARE(ubfx(r0, r1, 5, 10),
365 "e7e902d1 ubfx r0, r1, #5, #10"); 365 "e7e902d1 ubfx r0, r1, #5, #10");
366 COMPARE(ubfx(r1, r0, 5, 10), 366 COMPARE(ubfx(r1, r0, 5, 10),
367 "e7e912d0 ubfx r1, r0, #5, #10"); 367 "e7e912d0 ubfx r1, r0, #5, #10");
368 COMPARE(ubfx(r0, r1, 31, 1), 368 COMPARE(ubfx(r0, r1, 31, 1),
369 "e7e00fd1 ubfx r0, r1, #31, #1"); 369 "e7e00fd1 ubfx r0, r1, #31, #1");
370 COMPARE(ubfx(r1, r0, 31, 1), 370 COMPARE(ubfx(r1, r0, 31, 1),
371 "e7e01fd0 ubfx r1, r0, #31, #1"); 371 "e7e01fd0 ubfx r1, r0, #31, #1");
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 COMPARE(usat(r8, 0, Operand(r5, ASR, 17)), 406 COMPARE(usat(r8, 0, Operand(r5, ASR, 17)),
407 "e6e088d5 usat r8, #0, r5, asr #17"); 407 "e6e088d5 usat r8, #0, r5, asr #17");
408 } 408 }
409 409
410 VERIFY_RUN(); 410 VERIFY_RUN();
411 } 411 }
412 412
413 413
414 414
415 TEST(Vfp) { 415 TEST(Vfp) {
416 SETUP(); 416 SET_UP();
417 417
418 if (CpuFeatures::IsSupported(VFP3)) { 418 if (CpuFeatures::IsSupported(VFP3)) {
419 CpuFeatures::Scope scope(VFP3); 419 CpuFeatures::Scope scope(VFP3);
420 COMPARE(vmov(d0, d1), 420 COMPARE(vmov(d0, d1),
421 "eeb00b41 vmov.f64 d0, d1"); 421 "eeb00b41 vmov.f64 d0, d1");
422 COMPARE(vmov(d3, d3, eq), 422 COMPARE(vmov(d3, d3, eq),
423 "0eb03b43 vmov.f64eq d3, d3"); 423 "0eb03b43 vmov.f64eq d3, d3");
424 424
425 COMPARE(vmov(s0, s31), 425 COMPARE(vmov(s0, s31),
426 "eeb00a6f vmov.f32 s0, s31"); 426 "eeb00a6f vmov.f32 s0, s31");
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 "ec860a20 vstmia r6, {s0-s31}"); 539 "ec860a20 vstmia r6, {s0-s31}");
540 COMPARE(vldm(ia, r7, s0, s31), 540 COMPARE(vldm(ia, r7, s0, s31),
541 "ec970a20 vldmia r7, {s0-s31}"); 541 "ec970a20 vldmia r7, {s0-s31}");
542 } 542 }
543 543
544 VERIFY_RUN(); 544 VERIFY_RUN();
545 } 545 }
546 546
547 547
548 TEST(LoadStore) { 548 TEST(LoadStore) {
549 SETUP(); 549 SET_UP();
550 550
551 COMPARE(ldrb(r0, MemOperand(r1)), 551 COMPARE(ldrb(r0, MemOperand(r1)),
552 "e5d10000 ldrb r0, [r1, #+0]"); 552 "e5d10000 ldrb r0, [r1, #+0]");
553 COMPARE(ldrb(r2, MemOperand(r3, 42)), 553 COMPARE(ldrb(r2, MemOperand(r3, 42)),
554 "e5d3202a ldrb r2, [r3, #+42]"); 554 "e5d3202a ldrb r2, [r3, #+42]");
555 COMPARE(ldrb(r4, MemOperand(r5, -42)), 555 COMPARE(ldrb(r4, MemOperand(r5, -42)),
556 "e555402a ldrb r4, [r5, #-42]"); 556 "e555402a ldrb r4, [r5, #-42]");
557 COMPARE(ldrb(r6, MemOperand(r7, 42, PostIndex)), 557 COMPARE(ldrb(r6, MemOperand(r7, 42, PostIndex)),
558 "e4d7602a ldrb r6, [r7], #+42"); 558 "e4d7602a ldrb r6, [r7], #+42");
559 COMPARE(ldrb(r8, MemOperand(r9, -42, PostIndex)), 559 COMPARE(ldrb(r8, MemOperand(r9, -42, PostIndex)),
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 "e04987ff strd r8, [r9], #-127"); 739 "e04987ff strd r8, [r9], #-127");
740 COMPARE(strd(r10, fp, MemOperand(fp, 127, PreIndex)), 740 COMPARE(strd(r10, fp, MemOperand(fp, 127, PreIndex)),
741 "e1eba7ff strd r10, [fp, #+127]!"); 741 "e1eba7ff strd r10, [fp, #+127]!");
742 COMPARE(strd(ip, sp, MemOperand(sp, -127, PreIndex)), 742 COMPARE(strd(ip, sp, MemOperand(sp, -127, PreIndex)),
743 "e16dc7ff strd ip, [sp, #-127]!"); 743 "e16dc7ff strd ip, [sp, #-127]!");
744 } 744 }
745 745
746 VERIFY_RUN(); 746 VERIFY_RUN();
747 } 747 }
748 748
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-disasm-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698