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_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "platform/globals.h" | |
| 11 | |
| 10 #include "vm/ast.h" | 12 #include "vm/ast.h" |
| 11 #include "vm/dart.h" | 13 #include "vm/dart.h" |
| 12 #include "vm/globals.h" | 14 #include "vm/globals.h" |
| 13 #include "vm/heap.h" | 15 #include "vm/heap.h" |
| 14 #include "vm/isolate.h" | 16 #include "vm/isolate.h" |
| 15 #include "vm/longjump.h" | 17 #include "vm/longjump.h" |
| 16 #include "vm/object.h" | 18 #include "vm/object.h" |
| 17 #include "vm/object_store.h" | 19 #include "vm/object_store.h" |
| 18 #include "vm/simulator.h" | 20 #include "vm/simulator.h" |
| 19 #include "vm/zone.h" | 21 #include "vm/zone.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 static void CodeGenTestRun##name1(const Function& function) { \ | 125 static void CodeGenTestRun##name1(const Function& function) { \ |
| 124 Object& result = Object::Handle(); \ | 126 Object& result = Object::Handle(); \ |
| 125 result = DartEntry::InvokeFunction(function, Object::empty_array()); \ | 127 result = DartEntry::InvokeFunction(function, Object::empty_array()); \ |
| 126 EXPECT(!result.IsError()); \ | 128 EXPECT(!result.IsError()); \ |
| 127 Instance& actual = Instance::Handle(); \ | 129 Instance& actual = Instance::Handle(); \ |
| 128 actual ^= result.raw(); \ | 130 actual ^= result.raw(); \ |
| 129 EXPECT(actual.Equals(Instance::Handle(expected))); \ | 131 EXPECT(actual.Equals(Instance::Handle(expected))); \ |
| 130 } | 132 } |
| 131 | 133 |
| 132 | 134 |
| 133 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 135 #if defined(TARGET_ARCH_ARM) || \ |
| 134 #if defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) | 136 defined(TARGET_ARCH_MIPS) || \ |
| 137 defined(TARGET_ARCH_ARM64) | |
| 138 #if defined(HOST_ARCH_ARM) || \ | |
| 139 defined(HOST_ARCH_MIPS) || \ | |
| 140 defined(HOST_ARCH_ARM64) | |
| 135 // Running on actual ARM or MIPS hardware, execute code natively. | 141 // Running on actual ARM or MIPS hardware, execute code natively. |
| 136 #define EXECUTE_TEST_CODE_INT32(name, entry) reinterpret_cast<name>(entry)() | 142 #define EXECUTE_TEST_CODE_INT32(name, entry) reinterpret_cast<name>(entry)() |
| 137 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ | 143 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
| 138 reinterpret_cast<name>(entry)(long_arg0, long_arg1) | 144 reinterpret_cast<name>(entry)(long_arg0, long_arg1) |
| 139 #define EXECUTE_TEST_CODE_FLOAT(name, entry) reinterpret_cast<name>(entry)() | 145 #define EXECUTE_TEST_CODE_FLOAT(name, entry) reinterpret_cast<name>(entry)() |
| 140 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) reinterpret_cast<name>(entry)() | 146 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) reinterpret_cast<name>(entry)() |
| 141 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ | 147 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
| 142 reinterpret_cast<name>(entry)(float_arg) | 148 reinterpret_cast<name>(entry)(float_arg) |
| 143 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 149 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
| 144 reinterpret_cast<name>(entry)(double_arg) | 150 reinterpret_cast<name>(entry)(double_arg) |
| 145 #else | 151 #else |
| 146 // 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) | |
| 154 #define EXECUTE_TEST_CODE_INT32(name, entry) \ | |
| 155 static_cast<int32_t>(Simulator::Current()->Call( \ | |
| 156 bit_cast<int64_t, uword>(entry), 0, 0, 0, 0)) | |
| 157 #else | |
| 147 #define EXECUTE_TEST_CODE_INT32(name, entry) \ | 158 #define EXECUTE_TEST_CODE_INT32(name, entry) \ |
| 148 static_cast<int32_t>(Simulator::Current()->Call( \ | 159 static_cast<int32_t>(Simulator::Current()->Call( \ |
| 149 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) | 160 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) |
| 161 #endif | |
| 150 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ | 162 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
|
regis
2014/04/01 19:52:53
I suppose you will provide 64-bit versions of thes
zra
2014/04/01 20:35:08
Done.
| |
| 151 static_cast<int64_t>(Simulator::Current()->Call( \ | 163 static_cast<int64_t>(Simulator::Current()->Call( \ |
| 152 bit_cast<int32_t, uword>(entry), \ | 164 bit_cast<int32_t, uword>(entry), \ |
| 153 Utils::Low32Bits(long_arg0), \ | 165 Utils::Low32Bits(long_arg0), \ |
| 154 Utils::High32Bits(long_arg0), \ | 166 Utils::High32Bits(long_arg0), \ |
| 155 Utils::Low32Bits(long_arg1), \ | 167 Utils::Low32Bits(long_arg1), \ |
| 156 Utils::High32Bits(long_arg1))) | 168 Utils::High32Bits(long_arg1))) |
| 157 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ | 169 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ |
| 158 bit_cast<float, int32_t>(Simulator::Current()->Call( \ | 170 bit_cast<float, int32_t>(Simulator::Current()->Call( \ |
| 159 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) | 171 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) |
| 160 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | 172 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 } \ | 394 } \ |
| 383 } else { \ | 395 } else { \ |
| 384 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ | 396 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
| 385 #handle); \ | 397 #handle); \ |
| 386 } \ | 398 } \ |
| 387 } while (0) | 399 } while (0) |
| 388 | 400 |
| 389 } // namespace dart | 401 } // namespace dart |
| 390 | 402 |
| 391 #endif // VM_UNIT_TEST_H_ | 403 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |