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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/code_generator_ia32.h » ('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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 __ ret(); 1124 __ ret();
1125 } 1125 }
1126 1126
1127 1127
1128 ASSEMBLER_TEST_RUN(TestObjectCompare, entry) { 1128 ASSEMBLER_TEST_RUN(TestObjectCompare, entry) {
1129 typedef bool (*TestObjectCompare)(); 1129 typedef bool (*TestObjectCompare)();
1130 bool res = reinterpret_cast<TestObjectCompare>(entry)(); 1130 bool res = reinterpret_cast<TestObjectCompare>(entry)();
1131 EXPECT_EQ(true, res); 1131 EXPECT_EQ(true, res);
1132 } 1132 }
1133 1133
1134
1135 ASSEMBLER_TEST_GENERATE(TestNop, assembler) {
1136 __ nop(1);
1137 __ nop(2);
1138 __ nop(3);
1139 __ nop(4);
1140 __ nop(5);
1141 __ nop(6);
1142 __ nop(7);
1143 __ nop(8);
1144 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
1145 __ ret();
1146 }
1147
1148
1149 ASSEMBLER_TEST_RUN(TestNop, entry) {
1150 typedef int (*TestNop)();
1151 int res = reinterpret_cast<TestNop>(entry)();
1152 EXPECT_EQ(36, res); // 36 nop bytes emitted.
1153 }
1154
1155
1156 ASSEMBLER_TEST_GENERATE(TestAlign0, assembler) {
1157 __ Align(4, 0);
1158 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
1159 __ ret();
1160 }
1161
1162
1163 ASSEMBLER_TEST_RUN(TestAlign0, entry) {
1164 typedef int (*TestAlign0)();
1165 int res = reinterpret_cast<TestAlign0>(entry)();
1166 EXPECT_EQ(0, res); // 0 bytes emitted.
1167 }
1168
1169
1170 ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) {
1171 __ nop(1);
1172 __ Align(4, 0);
1173 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
1174 __ ret();
1175 }
1176
1177
1178 ASSEMBLER_TEST_RUN(TestAlign1, entry) {
1179 typedef int (*TestAlign1)();
1180 int res = reinterpret_cast<TestAlign1>(entry)();
1181 EXPECT_EQ(4, res); // 4 bytes emitted.
1182 }
1183
1184
1185 ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) {
1186 __ nop(1);
1187 __ Align(4, 1);
1188 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
1189 __ ret();
1190 }
1191
1192
1193 ASSEMBLER_TEST_RUN(TestAlign1Offset1, entry) {
1194 typedef int (*TestAlign1Offset1)();
1195 int res = reinterpret_cast<TestAlign1Offset1>(entry)();
1196 EXPECT_EQ(3, res); // 3 bytes emitted.
1197 }
1198
1199
1200 ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) {
1201 __ nop(1);
1202 __ Align(16, 0);
1203 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
1204 __ ret();
1205 }
1206
1207
1208 ASSEMBLER_TEST_RUN(TestAlignLarge, entry) {
1209 typedef int (*TestAlignLarge)();
1210 int res = reinterpret_cast<TestAlignLarge>(entry)();
1211 EXPECT_EQ(16, res); // 16 bytes emitted.
1212 }
1213
1134 } // namespace dart 1214 } // namespace dart
1135 1215
1136 #endif // defined TARGET_ARCH_X64 1216 #endif // defined TARGET_ARCH_X64
OLDNEW
« 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