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

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

Issue 10807070: Various cleanups, adding tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler_ia32.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 (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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 523
524 524
525 ASSEMBLER_TEST_GENERATE(Bitwise64, assembler) { 525 ASSEMBLER_TEST_GENERATE(Bitwise64, assembler) {
526 Label error; 526 Label error;
527 __ movq(RAX, Immediate(42)); 527 __ movq(RAX, Immediate(42));
528 __ pushq(RAX); 528 __ pushq(RAX);
529 __ xorq(RAX, Address(RSP, 0)); 529 __ xorq(RAX, Address(RSP, 0));
530 __ popq(RCX); 530 __ popq(RCX);
531 __ cmpq(RAX, Immediate(0)); 531 __ cmpq(RAX, Immediate(0));
532 __ j(NOT_EQUAL, &error); 532 __ j(NOT_EQUAL, &error);
533 __ movq(RCX, Immediate(0xFF));
534 __ movq(RAX, Immediate(0x5));
535 __ xorq(RCX, RAX);
536 __ cmpq(RCX, Immediate(0xFF ^ 0x5));
537 __ j(NOT_EQUAL, &error);
538 __ pushq(Immediate(0xFF));
539 __ movq(RCX, Immediate(0x5));
540 __ xorq(Address(RSP, 0), RCX);
541 __ popq(RCX);
542 __ cmpq(RCX, Immediate(0xFF ^ 0x5));
543 __ j(NOT_EQUAL, &error);
533 __ xorq(RCX, RCX); 544 __ xorq(RCX, RCX);
534 __ orq(RCX, Immediate(256)); 545 __ orq(RCX, Immediate(256));
535 __ movq(RAX, Immediate(4)); 546 __ movq(RAX, Immediate(4));
536 __ orq(RCX, RAX); 547 __ orq(RCX, RAX);
537 __ movq(RAX, Immediate(0xfff0)); 548 __ movq(RAX, Immediate(0xfff0));
538 __ andq(RCX, RAX); 549 __ andq(RCX, RAX);
539 __ movq(RAX, Immediate(1)); 550 __ movq(RAX, Immediate(1));
540 __ pushq(RAX); 551 __ pushq(RAX);
541 __ orq(RCX, Address(RSP, 0)); 552 __ orq(RCX, Address(RSP, 0));
542 __ popq(RAX); 553 __ popq(RAX);
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { 1387 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) {
1377 ObjectStore* object_store = Isolate::Current()->object_store(); 1388 ObjectStore* object_store = Isolate::Current()->object_store();
1378 const Object& obj = Object::ZoneHandle(object_store->smi_class()); 1389 const Object& obj = Object::ZoneHandle(object_store->smi_class());
1379 Label fail; 1390 Label fail;
1380 __ LoadObject(RAX, obj); 1391 __ LoadObject(RAX, obj);
1381 __ CompareObject(RAX, obj); 1392 __ CompareObject(RAX, obj);
1382 __ j(NOT_EQUAL, &fail); 1393 __ j(NOT_EQUAL, &fail);
1383 __ LoadObject(RCX, obj); 1394 __ LoadObject(RCX, obj);
1384 __ CompareObject(RCX, obj); 1395 __ CompareObject(RCX, obj);
1385 __ j(NOT_EQUAL, &fail); 1396 __ j(NOT_EQUAL, &fail);
1397 const Smi& smi = Smi::ZoneHandle(Smi::New(15));
1398 __ LoadObject(RCX, smi);
1399 __ CompareObject(RCX, smi);
1400 __ j(NOT_EQUAL, &fail);
1401 __ pushq(RAX);
1402 __ StoreObject(Address(RSP, 0), obj);
1403 __ popq(RCX);
1404 __ CompareObject(RCX, obj);
1405 __ j(NOT_EQUAL, &fail);
1406 __ pushq(RAX);
1407 __ StoreObject(Address(RSP, 0), smi);
1408 __ popq(RCX);
1409 __ CompareObject(RCX, smi);
1410 __ j(NOT_EQUAL, &fail);
1386 __ movl(RAX, Immediate(1)); // OK 1411 __ movl(RAX, Immediate(1)); // OK
1387 __ ret(); 1412 __ ret();
1388 __ Bind(&fail); 1413 __ Bind(&fail);
1389 __ movl(RAX, Immediate(0)); // Fail. 1414 __ movl(RAX, Immediate(0)); // Fail.
1390 __ ret(); 1415 __ ret();
1391 } 1416 }
1392 1417
1393 1418
1394 ASSEMBLER_TEST_RUN(TestObjectCompare, entry) { 1419 ASSEMBLER_TEST_RUN(TestObjectCompare, entry) {
1395 typedef bool (*TestObjectCompare)(); 1420 typedef bool (*TestObjectCompare)();
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 EXPECT_EQ(0, res); 1699 EXPECT_EQ(0, res);
1675 res = reinterpret_cast<ExtractSignBits>(entry)(-1.0); 1700 res = reinterpret_cast<ExtractSignBits>(entry)(-1.0);
1676 EXPECT_EQ(1, res); 1701 EXPECT_EQ(1, res);
1677 res = reinterpret_cast<ExtractSignBits>(entry)(-0.0); 1702 res = reinterpret_cast<ExtractSignBits>(entry)(-0.0);
1678 EXPECT_EQ(1, res); 1703 EXPECT_EQ(1, res);
1679 } 1704 }
1680 1705
1681 } // namespace dart 1706 } // namespace dart
1682 1707
1683 #endif // defined TARGET_ARCH_X64 1708 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698