| 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 "vm/ast.h" | 10 #include "vm/ast.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 #define EXECUTE_TEST_CODE_FLOAT(name, entry) reinterpret_cast<name>(entry)() | 139 #define EXECUTE_TEST_CODE_FLOAT(name, entry) reinterpret_cast<name>(entry)() |
| 140 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) reinterpret_cast<name>(entry)() | 140 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) reinterpret_cast<name>(entry)() |
| 141 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ | 141 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
| 142 reinterpret_cast<name>(entry)(float_arg) | 142 reinterpret_cast<name>(entry)(float_arg) |
| 143 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 143 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
| 144 reinterpret_cast<name>(entry)(double_arg) | 144 reinterpret_cast<name>(entry)(double_arg) |
| 145 #else | 145 #else |
| 146 // Not running on ARM or MIPS hardware, call simulator to execute code. | 146 // Not running on ARM or MIPS hardware, call simulator to execute code. |
| 147 #define EXECUTE_TEST_CODE_INT32(name, entry) \ | 147 #define EXECUTE_TEST_CODE_INT32(name, entry) \ |
| 148 static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ | 148 static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ |
| 149 0, 0, 0, 0, 0)) | 149 0, 0, 0, 0)) |
| 150 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ | 150 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
| 151 static_cast<int64_t>(Simulator::Current()->Call((int32_t)entry, \ | 151 static_cast<int64_t>(Simulator::Current()->Call((int32_t)entry, \ |
| 152 Utils::Low32Bits(long_arg0), \ | 152 Utils::Low32Bits(long_arg0), \ |
| 153 Utils::High32Bits(long_arg0), \ | 153 Utils::High32Bits(long_arg0), \ |
| 154 Utils::Low32Bits(long_arg1), \ | 154 Utils::Low32Bits(long_arg1), \ |
| 155 Utils::High32Bits(long_arg1), \ | 155 Utils::High32Bits(long_arg1))) |
| 156 0)) | |
| 157 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ | 156 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ |
| 158 bit_cast<float, int32_t>(Simulator::Current()->Call((int32_t)entry, \ | 157 bit_cast<float, int32_t>(Simulator::Current()->Call((int32_t)entry, \ |
| 159 0, 0, 0, 0, 0)) | 158 0, 0, 0, 0)) |
| 160 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | 159 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
| 161 bit_cast<double, int64_t>(Simulator::Current()->Call((int32_t)entry, \ | 160 bit_cast<double, int64_t>(Simulator::Current()->Call((int32_t)entry, \ |
| 162 0, 0, 0, 0, 0)) | 161 0, 0, 0, 0)) |
| 163 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ | 162 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
| 164 static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ | 163 static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ |
| 165 bit_cast<int32_t, float>(float_arg), \ | 164 bit_cast<int32_t, float>(float_arg), \ |
| 166 0, 0, 0, 0)) | 165 0, 0, 0)) |
| 167 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 166 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
| 168 static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ | 167 static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ |
| 169 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ | 168 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ |
| 170 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ | 169 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ |
| 171 0, 0, 0)) | 170 0, 0)) |
| 172 #endif // defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) | 171 #endif // defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) |
| 173 #endif // defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 172 #endif // defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
| 174 | 173 |
| 175 | 174 |
| 176 inline Dart_Handle NewString(const char* str) { | 175 inline Dart_Handle NewString(const char* str) { |
| 177 return Dart_NewStringFromCString(str); | 176 return Dart_NewStringFromCString(str); |
| 178 } | 177 } |
| 179 | 178 |
| 180 | 179 |
| 181 namespace dart { | 180 namespace dart { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } else { \ | 356 } else { \ |
| 358 dart::Expect(__FILE__, __LINE__).Fail( \ | 357 dart::Expect(__FILE__, __LINE__).Fail( \ |
| 359 "expected '%s' to be an error handle but found a valid handle.\n", \ | 358 "expected '%s' to be an error handle but found a valid handle.\n", \ |
| 360 #handle); \ | 359 #handle); \ |
| 361 } \ | 360 } \ |
| 362 } while (0) | 361 } while (0) |
| 363 | 362 |
| 364 } // namespace dart | 363 } // namespace dart |
| 365 | 364 |
| 366 #endif // VM_UNIT_TEST_H_ | 365 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |