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

Side by Side Diff: runtime/vm/assembler_x64_test.cc

Issue 306483005: - Use isolate where it is appropriate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 return 42; 1281 return 42;
1282 } 1282 }
1283 1283
1284 1284
1285 static int LeafReturnArgument(int x) { 1285 static int LeafReturnArgument(int x) {
1286 return x + 87; 1286 return x + 87;
1287 } 1287 }
1288 1288
1289 1289
1290 ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) { 1290 ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) {
1291 ExternalLabel call1("LeafReturn42", reinterpret_cast<uword>(LeafReturn42)); 1291 ExternalLabel call1(reinterpret_cast<uword>(LeafReturn42));
1292 ExternalLabel call2("LeafReturnArgument", 1292 ExternalLabel call2(reinterpret_cast<uword>(LeafReturnArgument));
1293 reinterpret_cast<uword>(LeafReturnArgument));
1294 int space = ComputeStackSpaceReservation(0, 8); 1293 int space = ComputeStackSpaceReservation(0, 8);
1295 __ subq(RSP, Immediate(space)); 1294 __ subq(RSP, Immediate(space));
1296 __ call(&call1); 1295 __ call(&call1);
1297 __ addq(RSP, Immediate(space)); 1296 __ addq(RSP, Immediate(space));
1298 space = ComputeStackSpaceReservation(0, 8); 1297 space = ComputeStackSpaceReservation(0, 8);
1299 __ subq(RSP, Immediate(space)); 1298 __ subq(RSP, Immediate(space));
1300 __ movl(RDI, RAX); 1299 __ movl(RDI, RAX);
1301 __ call(&call2); 1300 __ call(&call2);
1302 __ addq(RSP, Immediate(space)); 1301 __ addq(RSP, Immediate(space));
1303 __ ret(); 1302 __ ret();
1304 } 1303 }
1305 1304
1306 1305
1307 ASSEMBLER_TEST_RUN(CallSimpleLeaf, test) { 1306 ASSEMBLER_TEST_RUN(CallSimpleLeaf, test) {
1308 typedef int (*CallSimpleLeafCode)(); 1307 typedef int (*CallSimpleLeafCode)();
1309 EXPECT_EQ(42 + 87, reinterpret_cast<CallSimpleLeafCode>(test->entry())()); 1308 EXPECT_EQ(42 + 87, reinterpret_cast<CallSimpleLeafCode>(test->entry())());
1310 } 1309 }
1311 1310
1312 1311
1313 ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) { 1312 ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) {
1314 ExternalLabel call1("LeafReturn42", reinterpret_cast<uword>(LeafReturn42)); 1313 ExternalLabel call1(reinterpret_cast<uword>(LeafReturn42));
1315 Label L; 1314 Label L;
1316 int space = ComputeStackSpaceReservation(0, 8); 1315 int space = ComputeStackSpaceReservation(0, 8);
1317 __ subq(RSP, Immediate(space)); 1316 __ subq(RSP, Immediate(space));
1318 __ call(&L); 1317 __ call(&L);
1319 __ addq(RSP, Immediate(space)); 1318 __ addq(RSP, Immediate(space));
1320 __ ret(); 1319 __ ret();
1321 __ Bind(&L); 1320 __ Bind(&L);
1322 __ jmp(&call1); 1321 __ jmp(&call1);
1323 } 1322 }
1324 1323
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after
2944 EXPECT_EQ(1, res); // Greater equal. 2943 EXPECT_EQ(1, res); // Greater equal.
2945 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); 2944 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5);
2946 EXPECT_EQ(1, res); // Greater equal. 2945 EXPECT_EQ(1, res); // Greater equal.
2947 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); 2946 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5);
2948 EXPECT_EQ(-1, res); // Less. 2947 EXPECT_EQ(-1, res); // Less.
2949 } 2948 }
2950 2949
2951 } // namespace dart 2950 } // namespace dart
2952 2951
2953 #endif // defined TARGET_ARCH_X64 2952 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698