Chromium Code Reviews| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ | 167 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
| 168 reinterpret_cast<name>(entry)(long_arg0, long_arg1) | 168 reinterpret_cast<name>(entry)(long_arg0, long_arg1) |
| 169 #define EXECUTE_TEST_CODE_FLOAT(name, entry) reinterpret_cast<name>(entry)() | 169 #define EXECUTE_TEST_CODE_FLOAT(name, entry) reinterpret_cast<name>(entry)() |
| 170 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) reinterpret_cast<name>(entry)() | 170 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) reinterpret_cast<name>(entry)() |
| 171 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ | 171 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
| 172 reinterpret_cast<name>(entry)(float_arg) | 172 reinterpret_cast<name>(entry)(float_arg) |
| 173 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 173 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
| 174 reinterpret_cast<name>(entry)(double_arg) | 174 reinterpret_cast<name>(entry)(double_arg) |
| 175 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ | 175 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ |
| 176 reinterpret_cast<name>(entry)(pointer_arg) | 176 reinterpret_cast<name>(entry)(pointer_arg) |
| 177 #define EXECUTE_TEST_CODE_INT32_INTPTR(name, entry, pointer_arg) \ | |
| 178 reinterpret_cast<name>(entry)(pointer_arg) | |
| 177 #else | 179 #else |
| 178 // Not running on ARM or MIPS hardware, call simulator to execute code. | 180 // Not running on ARM or MIPS hardware, call simulator to execute code. |
| 179 #if defined(ARCH_IS_64_BIT) | 181 #if defined(ARCH_IS_64_BIT) |
| 180 // TODO(zra): Supply more macros for 64-bit as tests are added for ARM64. | 182 // TODO(zra): Supply more macros for 64-bit as tests are added for ARM64. |
|
zra
2016/10/26 06:59:41
We can probably remove this TODO =)
rmacnak
2016/10/31 22:57:26
Done.
| |
| 181 #define EXECUTE_TEST_CODE_INT64(name, entry) \ | 183 #define EXECUTE_TEST_CODE_INT64(name, entry) \ |
| 182 static_cast<int64_t>(Simulator::Current()->Call( \ | 184 static_cast<int64_t>(Simulator::Current()->Call( \ |
| 183 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0)) | 185 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0)) |
| 184 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | 186 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
| 185 bit_cast<double, int64_t>(Simulator::Current()->Call( \ | 187 bit_cast<double, int64_t>(Simulator::Current()->Call( \ |
| 186 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0, true)) | 188 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0, true)) |
| 187 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ | 189 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ |
| 188 static_cast<intptr_t>(Simulator::Current()->Call( \ | 190 static_cast<intptr_t>(Simulator::Current()->Call( \ |
| 189 bit_cast<int64_t, uword>(entry), \ | 191 bit_cast<int64_t, uword>(entry), \ |
| 190 bit_cast<int64_t, intptr_t>(pointer_arg), \ | 192 bit_cast<int64_t, intptr_t>(pointer_arg), \ |
| 191 0, 0, 0)) | 193 0, 0, 0)) |
| 194 #define EXECUTE_TEST_CODE_INT32_INTPTR(name, entry, pointer_arg) \ | |
| 195 static_cast<int32_t>(Simulator::Current()->Call( \ | |
| 196 bit_cast<int64_t, uword>(entry), \ | |
| 197 bit_cast<int64_t, intptr_t>(pointer_arg), \ | |
| 198 0, 0, 0)) | |
| 192 #else | 199 #else |
| 193 #define EXECUTE_TEST_CODE_INT32(name, entry) \ | 200 #define EXECUTE_TEST_CODE_INT32(name, entry) \ |
| 194 static_cast<int32_t>(Simulator::Current()->Call( \ | 201 static_cast<int32_t>(Simulator::Current()->Call( \ |
| 195 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) | 202 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) |
| 196 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | 203 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
| 197 bit_cast<double, int64_t>(Simulator::Current()->Call( \ | 204 bit_cast<double, int64_t>(Simulator::Current()->Call( \ |
| 198 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) | 205 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) |
| 199 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ | 206 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ |
| 200 static_cast<intptr_t>(Simulator::Current()->Call( \ | 207 static_cast<intptr_t>(Simulator::Current()->Call( \ |
| 201 bit_cast<int32_t, uword>(entry), \ | 208 bit_cast<int32_t, uword>(entry), \ |
| 202 bit_cast<int32_t, intptr_t>(pointer_arg), \ | 209 bit_cast<int32_t, intptr_t>(pointer_arg), \ |
| 203 0, 0, 0)) | 210 0, 0, 0)) |
| 211 #define EXECUTE_TEST_CODE_INT32_INTPTR(name, entry, pointer_arg) \ | |
| 212 static_cast<int32_t>(Simulator::Current()->Call( \ | |
| 213 bit_cast<int32_t, uword>(entry), \ | |
| 214 bit_cast<int32_t, intptr_t>(pointer_arg), \ | |
| 215 0, 0, 0)) | |
| 204 #endif // defined(ARCH_IS_64_BIT) | 216 #endif // defined(ARCH_IS_64_BIT) |
| 205 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ | 217 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
| 206 static_cast<int64_t>(Simulator::Current()->Call( \ | 218 static_cast<int64_t>(Simulator::Current()->Call( \ |
| 207 bit_cast<int32_t, uword>(entry), \ | 219 bit_cast<int32_t, uword>(entry), \ |
| 208 Utils::Low32Bits(long_arg0), \ | 220 Utils::Low32Bits(long_arg0), \ |
| 209 Utils::High32Bits(long_arg0), \ | 221 Utils::High32Bits(long_arg0), \ |
| 210 Utils::Low32Bits(long_arg1), \ | 222 Utils::Low32Bits(long_arg1), \ |
| 211 Utils::High32Bits(long_arg1))) | 223 Utils::High32Bits(long_arg1))) |
| 212 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ | 224 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ |
| 213 bit_cast<float, int32_t>(Simulator::Current()->Call( \ | 225 bit_cast<float, int32_t>(Simulator::Current()->Call( \ |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 } | 625 } |
| 614 | 626 |
| 615 private: | 627 private: |
| 616 T* flag_; | 628 T* flag_; |
| 617 T original_value_; | 629 T original_value_; |
| 618 }; | 630 }; |
| 619 | 631 |
| 620 } // namespace dart | 632 } // namespace dart |
| 621 | 633 |
| 622 #endif // VM_UNIT_TEST_H_ | 634 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |