OLD | NEW |
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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 __ ret(); | 1005 __ ret(); |
1006 } | 1006 } |
1007 | 1007 |
1008 | 1008 |
1009 ASSEMBLER_TEST_RUN(DoubleFPOperations, entry) { | 1009 ASSEMBLER_TEST_RUN(DoubleFPOperations, entry) { |
1010 typedef double (*SingleFPOperationsCode)(); | 1010 typedef double (*SingleFPOperationsCode)(); |
1011 double res = reinterpret_cast<SingleFPOperationsCode>(entry)(); | 1011 double res = reinterpret_cast<SingleFPOperationsCode>(entry)(); |
1012 EXPECT_FLOAT_EQ(14.7, res, 0.001); | 1012 EXPECT_FLOAT_EQ(14.7, res, 0.001); |
1013 } | 1013 } |
1014 | 1014 |
| 1015 |
| 1016 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { |
| 1017 ObjectStore* object_store = Isolate::Current()->object_store(); |
| 1018 const Object& obj = Object::ZoneHandle(object_store->smi_class()); |
| 1019 Label fail; |
| 1020 __ LoadObject(RAX, obj); |
| 1021 __ CompareObject(RAX, obj); |
| 1022 __ j(NOT_EQUAL, &fail); |
| 1023 __ LoadObject(RCX, obj); |
| 1024 __ CompareObject(RCX, obj); |
| 1025 __ j(NOT_EQUAL, &fail); |
| 1026 __ movl(RAX, Immediate(1)); // OK |
| 1027 __ ret(); |
| 1028 __ Bind(&fail); |
| 1029 __ movl(RAX, Immediate(0)); // Fail. |
| 1030 __ ret(); |
| 1031 } |
| 1032 |
| 1033 |
| 1034 ASSEMBLER_TEST_RUN(TestObjectCompare, entry) { |
| 1035 typedef bool (*TestObjectCompare)(); |
| 1036 bool res = reinterpret_cast<TestObjectCompare>(entry)(); |
| 1037 EXPECT_EQ(true, res); |
| 1038 } |
| 1039 |
1015 } // namespace dart | 1040 } // namespace dart |
1016 | 1041 |
1017 #endif // defined TARGET_ARCH_X64 | 1042 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |