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 #ifndef VM_UNIT_TEST_H_ | 5 #ifndef VM_UNIT_TEST_H_ |
6 #define VM_UNIT_TEST_H_ | 6 #define VM_UNIT_TEST_H_ |
7 | 7 |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 | 9 |
10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 #define EXECUTE_TEST_CODE_INT32(name, entry) reinterpret_cast<name>(entry)() | 142 #define EXECUTE_TEST_CODE_INT32(name, entry) reinterpret_cast<name>(entry)() |
143 #define EXECUTE_TEST_CODE_INT64(name, entry) reinterpret_cast<name>(entry)() | 143 #define EXECUTE_TEST_CODE_INT64(name, entry) reinterpret_cast<name>(entry)() |
144 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ | 144 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
145 reinterpret_cast<name>(entry)(long_arg0, long_arg1) | 145 reinterpret_cast<name>(entry)(long_arg0, long_arg1) |
146 #define EXECUTE_TEST_CODE_FLOAT(name, entry) reinterpret_cast<name>(entry)() | 146 #define EXECUTE_TEST_CODE_FLOAT(name, entry) reinterpret_cast<name>(entry)() |
147 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) reinterpret_cast<name>(entry)() | 147 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) reinterpret_cast<name>(entry)() |
148 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ | 148 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
149 reinterpret_cast<name>(entry)(float_arg) | 149 reinterpret_cast<name>(entry)(float_arg) |
150 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 150 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
151 reinterpret_cast<name>(entry)(double_arg) | 151 reinterpret_cast<name>(entry)(double_arg) |
| 152 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ |
| 153 reinterpret_cast<name>(entry)(pointer_arg) |
152 #else | 154 #else |
153 // Not running on ARM or MIPS hardware, call simulator to execute code. | 155 // Not running on ARM or MIPS hardware, call simulator to execute code. |
154 #if defined(ARCH_IS_64_BIT) | 156 #if defined(ARCH_IS_64_BIT) |
155 // TODO(zra): Supply more macros for 64-bit as tests are added for ARM64. | 157 // TODO(zra): Supply more macros for 64-bit as tests are added for ARM64. |
156 #define EXECUTE_TEST_CODE_INT64(name, entry) \ | 158 #define EXECUTE_TEST_CODE_INT64(name, entry) \ |
157 static_cast<int64_t>(Simulator::Current()->Call( \ | 159 static_cast<int64_t>(Simulator::Current()->Call( \ |
158 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0)) | 160 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0)) |
159 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | 161 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
160 bit_cast<double, int64_t>(Simulator::Current()->Call( \ | 162 bit_cast<double, int64_t>(Simulator::Current()->Call( \ |
161 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0, true)) | 163 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0, true)) |
| 164 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ |
| 165 static_cast<intptr_t>(Simulator::Current()->Call( \ |
| 166 bit_cast<int64_t, uword>(entry), \ |
| 167 bit_cast<int64_t, intptr_t>(pointer_arg), \ |
| 168 0, 0, 0)) |
162 #else | 169 #else |
163 #define EXECUTE_TEST_CODE_INT32(name, entry) \ | 170 #define EXECUTE_TEST_CODE_INT32(name, entry) \ |
164 static_cast<int32_t>(Simulator::Current()->Call( \ | 171 static_cast<int32_t>(Simulator::Current()->Call( \ |
165 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) | 172 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) |
166 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | 173 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
167 bit_cast<double, int64_t>(Simulator::Current()->Call( \ | 174 bit_cast<double, int64_t>(Simulator::Current()->Call( \ |
168 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) | 175 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) |
| 176 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ |
| 177 static_cast<intptr_t>(Simulator::Current()->Call( \ |
| 178 bit_cast<int32_t, uword>(entry), \ |
| 179 bit_cast<int32_t, intptr_t>(pointer_arg), \ |
| 180 0, 0, 0)) |
169 #endif | 181 #endif |
170 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ | 182 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
171 static_cast<int64_t>(Simulator::Current()->Call( \ | 183 static_cast<int64_t>(Simulator::Current()->Call( \ |
172 bit_cast<int32_t, uword>(entry), \ | 184 bit_cast<int32_t, uword>(entry), \ |
173 Utils::Low32Bits(long_arg0), \ | 185 Utils::Low32Bits(long_arg0), \ |
174 Utils::High32Bits(long_arg0), \ | 186 Utils::High32Bits(long_arg0), \ |
175 Utils::Low32Bits(long_arg1), \ | 187 Utils::Low32Bits(long_arg1), \ |
176 Utils::High32Bits(long_arg1))) | 188 Utils::High32Bits(long_arg1))) |
177 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ | 189 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ |
178 bit_cast<float, int32_t>(Simulator::Current()->Call( \ | 190 bit_cast<float, int32_t>(Simulator::Current()->Call( \ |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } \ | 417 } \ |
406 } else { \ | 418 } else { \ |
407 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ | 419 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
408 #handle); \ | 420 #handle); \ |
409 } \ | 421 } \ |
410 } while (0) | 422 } while (0) |
411 | 423 |
412 } // namespace dart | 424 } // namespace dart |
413 | 425 |
414 #endif // VM_UNIT_TEST_H_ | 426 #endif // VM_UNIT_TEST_H_ |
OLD | NEW |