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_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 reinterpret_cast<name>(entry)(float_arg) | 148 reinterpret_cast<name>(entry)(float_arg) |
149 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 149 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
150 reinterpret_cast<name>(entry)(double_arg) | 150 reinterpret_cast<name>(entry)(double_arg) |
151 #else | 151 #else |
152 // Not running on ARM or MIPS hardware, call simulator to execute code. | 152 // Not running on ARM or MIPS hardware, call simulator to execute code. |
153 #if defined(ARCH_IS_64_BIT) | 153 #if defined(ARCH_IS_64_BIT) |
154 // TODO(zra): Supply more macros for 64-bit as tests are added for ARM64. | 154 // TODO(zra): Supply more macros for 64-bit as tests are added for ARM64. |
155 #define EXECUTE_TEST_CODE_INT64(name, entry) \ | 155 #define EXECUTE_TEST_CODE_INT64(name, entry) \ |
156 static_cast<int64_t>(Simulator::Current()->Call( \ | 156 static_cast<int64_t>(Simulator::Current()->Call( \ |
157 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0)) | 157 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0)) |
| 158 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
| 159 bit_cast<double, int64_t>(Simulator::Current()->Call( \ |
| 160 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0, true)) |
158 #else | 161 #else |
159 #define EXECUTE_TEST_CODE_INT32(name, entry) \ | 162 #define EXECUTE_TEST_CODE_INT32(name, entry) \ |
160 static_cast<int32_t>(Simulator::Current()->Call( \ | 163 static_cast<int32_t>(Simulator::Current()->Call( \ |
161 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) | 164 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) |
| 165 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
| 166 bit_cast<double, int64_t>(Simulator::Current()->Call( \ |
| 167 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) |
162 #endif | 168 #endif |
163 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ | 169 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
164 static_cast<int64_t>(Simulator::Current()->Call( \ | 170 static_cast<int64_t>(Simulator::Current()->Call( \ |
165 bit_cast<int32_t, uword>(entry), \ | 171 bit_cast<int32_t, uword>(entry), \ |
166 Utils::Low32Bits(long_arg0), \ | 172 Utils::Low32Bits(long_arg0), \ |
167 Utils::High32Bits(long_arg0), \ | 173 Utils::High32Bits(long_arg0), \ |
168 Utils::Low32Bits(long_arg1), \ | 174 Utils::Low32Bits(long_arg1), \ |
169 Utils::High32Bits(long_arg1))) | 175 Utils::High32Bits(long_arg1))) |
170 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ | 176 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ |
171 bit_cast<float, int32_t>(Simulator::Current()->Call( \ | 177 bit_cast<float, int32_t>(Simulator::Current()->Call( \ |
172 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) | 178 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) |
173 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | |
174 bit_cast<double, int64_t>(Simulator::Current()->Call( \ | |
175 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) | |
176 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ | 179 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
177 static_cast<int32_t>(Simulator::Current()->Call( \ | 180 static_cast<int32_t>(Simulator::Current()->Call( \ |
178 bit_cast<int32_t, uword>(entry), \ | 181 bit_cast<int32_t, uword>(entry), \ |
179 bit_cast<int32_t, float>(float_arg), \ | 182 bit_cast<int32_t, float>(float_arg), \ |
180 0, 0, 0, false, true)) | 183 0, 0, 0, false, true)) |
181 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 184 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
182 static_cast<int32_t>(Simulator::Current()->Call( \ | 185 static_cast<int32_t>(Simulator::Current()->Call( \ |
183 bit_cast<int32_t, uword>(entry), \ | 186 bit_cast<int32_t, uword>(entry), \ |
184 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ | 187 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ |
185 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ | 188 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } \ | 398 } \ |
396 } else { \ | 399 } else { \ |
397 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ | 400 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
398 #handle); \ | 401 #handle); \ |
399 } \ | 402 } \ |
400 } while (0) | 403 } while (0) |
401 | 404 |
402 } // namespace dart | 405 } // namespace dart |
403 | 406 |
404 #endif // VM_UNIT_TEST_H_ | 407 #endif // VM_UNIT_TEST_H_ |
OLD | NEW |