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

Side by Side Diff: test/cctest/test-disasm-mips.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-disasm-arm.cc ('k') | test/cctest/test-platform-linux.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 "%s\n" 64 "%s\n"
65 "disassembled: \n" 65 "disassembled: \n"
66 "%s\n\n", 66 "%s\n\n",
67 compare_string, disasm_buffer.start()); 67 compare_string, disasm_buffer.start());
68 return false; 68 return false;
69 } 69 }
70 return true; 70 return true;
71 } 71 }
72 72
73 73
74 // Setup V8 to a state where we can at least run the assembler and 74 // Set up V8 to a state where we can at least run the assembler and
75 // disassembler. Declare the variables and allocate the data structures used 75 // disassembler. Declare the variables and allocate the data structures used
76 // in the rest of the macros. 76 // in the rest of the macros.
77 #define SETUP() \ 77 #define SET_UP() \
78 InitializeVM(); \ 78 InitializeVM(); \
79 v8::HandleScope scope; \ 79 v8::HandleScope scope; \
80 byte *buffer = reinterpret_cast<byte*>(malloc(4*1024)); \ 80 byte *buffer = reinterpret_cast<byte*>(malloc(4*1024)); \
81 Assembler assm(Isolate::Current(), buffer, 4*1024); \ 81 Assembler assm(Isolate::Current(), buffer, 4*1024); \
82 bool failure = false; 82 bool failure = false;
83 83
84 84
85 // This macro assembles one instruction using the preallocated assembler and 85 // This macro assembles one instruction using the preallocated assembler and
86 // disassembles the generated instruction, comparing the output to the expected 86 // disassembles the generated instruction, comparing the output to the expected
87 // value. If the comparison fails an error message is printed, but the test 87 // value. If the comparison fails an error message is printed, but the test
88 // continues to run until the end. 88 // continues to run until the end.
89 #define COMPARE(asm_, compare_string) \ 89 #define COMPARE(asm_, compare_string) \
90 { \ 90 { \
91 int pc_offset = assm.pc_offset(); \ 91 int pc_offset = assm.pc_offset(); \
92 byte *progcounter = &buffer[pc_offset]; \ 92 byte *progcounter = &buffer[pc_offset]; \
93 assm.asm_; \ 93 assm.asm_; \
94 if (!DisassembleAndCompare(progcounter, compare_string)) failure = true; \ 94 if (!DisassembleAndCompare(progcounter, compare_string)) failure = true; \
95 } 95 }
96 96
97 97
98 // Verify that all invocations of the COMPARE macro passed successfully. 98 // Verify that all invocations of the COMPARE macro passed successfully.
99 // Exit with a failure if at least one of the tests failed. 99 // Exit with a failure if at least one of the tests failed.
100 #define VERIFY_RUN() \ 100 #define VERIFY_RUN() \
101 if (failure) { \ 101 if (failure) { \
102 V8_Fatal(__FILE__, __LINE__, "MIPS Disassembler tests failed.\n"); \ 102 V8_Fatal(__FILE__, __LINE__, "MIPS Disassembler tests failed.\n"); \
103 } 103 }
104 104
105 105
106 TEST(Type0) { 106 TEST(Type0) {
107 SETUP(); 107 SET_UP();
108 108
109 COMPARE(addu(a0, a1, a2), 109 COMPARE(addu(a0, a1, a2),
110 "00a62021 addu a0, a1, a2"); 110 "00a62021 addu a0, a1, a2");
111 COMPARE(addu(t2, t3, t4), 111 COMPARE(addu(t2, t3, t4),
112 "016c5021 addu t2, t3, t4"); 112 "016c5021 addu t2, t3, t4");
113 COMPARE(addu(v0, v1, s0), 113 COMPARE(addu(v0, v1, s0),
114 "00701021 addu v0, v1, s0"); 114 "00701021 addu v0, v1, s0");
115 115
116 COMPARE(subu(a0, a1, a2), 116 COMPARE(subu(a0, a1, a2),
117 "00a62023 subu a0, a1, a2"); 117 "00a62023 subu a0, a1, a2");
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 COMPARE(ext_(a0, a1, 31, 1), 428 COMPARE(ext_(a0, a1, 31, 1),
429 "7ca407c0 ext a0, a1, 31, 1"); 429 "7ca407c0 ext a0, a1, 31, 1");
430 COMPARE(ext_(s6, s7, 30, 2), 430 COMPARE(ext_(s6, s7, 30, 2),
431 "7ef60f80 ext s6, s7, 30, 2"); 431 "7ef60f80 ext s6, s7, 30, 2");
432 COMPARE(ext_(v0, v1, 0, 32), 432 COMPARE(ext_(v0, v1, 0, 32),
433 "7c62f800 ext v0, v1, 0, 32"); 433 "7c62f800 ext v0, v1, 0, 32");
434 } 434 }
435 435
436 VERIFY_RUN(); 436 VERIFY_RUN();
437 } 437 }
OLDNEW
« no previous file with comments | « test/cctest/test-disasm-arm.cc ('k') | test/cctest/test-platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698