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

Unified Diff: runtime/vm/assembler_x64_test.cc

Issue 8984003: Port code generator to x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/code_generator_ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_x64_test.cc
===================================================================
--- runtime/vm/assembler_x64_test.cc (revision 2556)
+++ runtime/vm/assembler_x64_test.cc (working copy)
@@ -1131,6 +1131,86 @@
EXPECT_EQ(true, res);
}
+
+ASSEMBLER_TEST_GENERATE(TestNop, assembler) {
+ __ nop(1);
+ __ nop(2);
+ __ nop(3);
+ __ nop(4);
+ __ nop(5);
+ __ nop(6);
+ __ nop(7);
+ __ nop(8);
+ __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(TestNop, entry) {
+ typedef int (*TestNop)();
+ int res = reinterpret_cast<TestNop>(entry)();
+ EXPECT_EQ(36, res); // 36 nop bytes emitted.
+}
+
+
+ASSEMBLER_TEST_GENERATE(TestAlign0, assembler) {
+ __ Align(4, 0);
+ __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(TestAlign0, entry) {
+ typedef int (*TestAlign0)();
+ int res = reinterpret_cast<TestAlign0>(entry)();
+ EXPECT_EQ(0, res); // 0 bytes emitted.
+}
+
+
+ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) {
+ __ nop(1);
+ __ Align(4, 0);
+ __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(TestAlign1, entry) {
+ typedef int (*TestAlign1)();
+ int res = reinterpret_cast<TestAlign1>(entry)();
+ EXPECT_EQ(4, res); // 4 bytes emitted.
+}
+
+
+ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) {
+ __ nop(1);
+ __ Align(4, 1);
+ __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(TestAlign1Offset1, entry) {
+ typedef int (*TestAlign1Offset1)();
+ int res = reinterpret_cast<TestAlign1Offset1>(entry)();
+ EXPECT_EQ(3, res); // 3 bytes emitted.
+}
+
+
+ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) {
+ __ nop(1);
+ __ Align(16, 0);
+ __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(TestAlignLarge, entry) {
+ typedef int (*TestAlignLarge)();
+ int res = reinterpret_cast<TestAlignLarge>(entry)();
+ EXPECT_EQ(16, res); // 16 bytes emitted.
+}
+
} // namespace dart
#endif // defined TARGET_ARCH_X64
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/code_generator_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698