| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 reinterpret_cast<name>(entry)(long_arg0, long_arg1) | 138 reinterpret_cast<name>(entry)(long_arg0, long_arg1) |
| 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( \ |
| 149 0, 0, 0, 0)) | 149 bit_cast<int32_t, uword>(entry), 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( \ |
| 152 bit_cast<int32_t, uword>(entry), \ |
| 152 Utils::Low32Bits(long_arg0), \ | 153 Utils::Low32Bits(long_arg0), \ |
| 153 Utils::High32Bits(long_arg0), \ | 154 Utils::High32Bits(long_arg0), \ |
| 154 Utils::Low32Bits(long_arg1), \ | 155 Utils::Low32Bits(long_arg1), \ |
| 155 Utils::High32Bits(long_arg1))) | 156 Utils::High32Bits(long_arg1))) |
| 156 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ | 157 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ |
| 157 bit_cast<float, int32_t>(Simulator::Current()->Call((int32_t)entry, \ | 158 bit_cast<float, int32_t>(Simulator::Current()->Call( \ |
| 158 0, 0, 0, 0)) | 159 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) |
| 159 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | 160 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
| 160 bit_cast<double, int64_t>(Simulator::Current()->Call((int32_t)entry, \ | 161 bit_cast<double, int64_t>(Simulator::Current()->Call( \ |
| 161 0, 0, 0, 0)) | 162 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) |
| 162 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ | 163 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
| 163 static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ | 164 static_cast<int32_t>(Simulator::Current()->Call( \ |
| 165 bit_cast<int32_t, uword>(entry), \ |
| 164 bit_cast<int32_t, float>(float_arg), \ | 166 bit_cast<int32_t, float>(float_arg), \ |
| 165 0, 0, 0)) | 167 0, 0, 0)) |
| 166 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 168 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
| 167 static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ | 169 static_cast<int32_t>(Simulator::Current()->Call( \ |
| 170 bit_cast<int32_t, uword>(entry), \ |
| 168 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ | 171 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ |
| 169 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ | 172 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ |
| 170 0, 0)) | 173 0, 0)) |
| 171 #endif // defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) | 174 #endif // defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) |
| 172 #endif // defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 175 #endif // defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
| 173 | 176 |
| 174 | 177 |
| 175 inline Dart_Handle NewString(const char* str) { | 178 inline Dart_Handle NewString(const char* str) { |
| 176 return Dart_NewStringFromCString(str); | 179 return Dart_NewStringFromCString(str); |
| 177 } | 180 } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 } \ | 375 } \ |
| 373 } else { \ | 376 } else { \ |
| 374 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ | 377 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
| 375 #handle); \ | 378 #handle); \ |
| 376 } \ | 379 } \ |
| 377 } while (0) | 380 } while (0) |
| 378 | 381 |
| 379 } // namespace dart | 382 } // namespace dart |
| 380 | 383 |
| 381 #endif // VM_UNIT_TEST_H_ | 384 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |