Chromium Code Reviews| Index: runtime/vm/unit_test.h |
| =================================================================== |
| --- runtime/vm/unit_test.h (revision 18162) |
| +++ runtime/vm/unit_test.h (working copy) |
| @@ -15,6 +15,7 @@ |
| #include "vm/longjump.h" |
| #include "vm/object.h" |
| #include "vm/object_store.h" |
| +#include "vm/simulator.h" |
| #include "vm/zone.h" |
| // The UNIT_TEST_CASE macro is used for tests that do not need any |
| @@ -128,6 +129,47 @@ |
| } |
| +#if defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) |
|
Ivan Posva
2013/02/06 23:33:50
This whole section is only valid when TARGET_ARCH_
regis
2013/02/07 00:53:24
Done.
|
| +// Running on actual ARM or MIPS hardware, execute code natively. |
| +#define EXECUTE_TEST_CODE_INT32(name, entry) reinterpret_cast<name>(entry)() |
| +#define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
| + reinterpret_cast<name>(entry)(long_arg0, long_arg1) |
| +#define EXECUTE_TEST_CODE_FLOAT(name, entry) reinterpret_cast<name>(entry)() |
| +#define EXECUTE_TEST_CODE_DOUBLE(name, entry) reinterpret_cast<name>(entry)() |
| +#define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
| + reinterpret_cast<name>(entry)(float_arg) |
| +#define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
| + reinterpret_cast<name>(entry)(double_arg) |
| +#else |
| +// Not running on ARM or MIPS hardware, call simulator to execute code. |
| +#define EXECUTE_TEST_CODE_INT32(name, entry) \ |
| + static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ |
| + 0, 0, 0, 0, 0)) |
| +#define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
| + static_cast<int64_t>(Simulator::Current()->Call((int32_t)entry, \ |
| + Utils::Low32Bits(long_arg0), \ |
| + Utils::High32Bits(long_arg0), \ |
| + Utils::Low32Bits(long_arg1), \ |
| + Utils::High32Bits(long_arg1), \ |
| + 0)) |
| +#define EXECUTE_TEST_CODE_FLOAT(name, entry) \ |
| + bit_cast<float, int32_t>(Simulator::Current()->Call((int32_t)entry, \ |
| + 0, 0, 0, 0, 0)) |
| +#define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
| + bit_cast<double, int64_t>(Simulator::Current()->Call((int32_t)entry, \ |
| + 0, 0, 0, 0, 0)) |
| +#define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
| + static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ |
| + bit_cast<int32_t, float>(float_arg), \ |
| + 0, 0, 0, 0)) |
| +#define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
| + static_cast<int32_t>(Simulator::Current()->Call((int32_t)entry, \ |
| + Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ |
| + Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ |
| + 0, 0, 0)) |
| +#endif // defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) |
| + |
| + |
| inline Dart_Handle NewString(const char* str) { |
| return Dart_NewStringFromCString(str); |
| } |