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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 #define EXECUTE_TEST_CODE_INT32(name, entry) \ | 147 #define EXECUTE_TEST_CODE_INT32(name, entry) \ |
148 static_cast<int32_t>(Simulator::Current()->Call( \ | 148 static_cast<int32_t>(Simulator::Current()->Call( \ |
149 bit_cast<int32_t, uword>(entry), 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( \ | 151 static_cast<int64_t>(Simulator::Current()->Call( \ |
152 bit_cast<int32_t, uword>(entry), \ | 152 bit_cast<int32_t, uword>(entry), \ |
153 Utils::Low32Bits(long_arg0), \ | 153 Utils::Low32Bits(long_arg0), \ |
154 Utils::High32Bits(long_arg0), \ | 154 Utils::High32Bits(long_arg0), \ |
155 Utils::Low32Bits(long_arg1), \ | 155 Utils::Low32Bits(long_arg1), \ |
156 Utils::High32Bits(long_arg1))) | 156 Utils::High32Bits(long_arg1))) |
157 #if defined(TARGET_ARCH_MIPS) | |
158 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ | 157 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ |
159 bit_cast<float, int32_t>(Simulator::Current()->Call( \ | 158 bit_cast<float, int32_t>(Simulator::Current()->Call( \ |
160 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) | 159 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) |
161 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | 160 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
162 bit_cast<double, int64_t>(Simulator::Current()->Call( \ | 161 bit_cast<double, int64_t>(Simulator::Current()->Call( \ |
163 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) | 162 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) |
164 #else // defined(TARGET_ARCH_MIPS) | |
165 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ | |
166 bit_cast<float, int32_t>(Simulator::Current()->Call( \ | |
167 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) | |
168 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | |
169 bit_cast<double, int64_t>(Simulator::Current()->Call( \ | |
170 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) | |
171 #endif // defined(TARGET_ARCH_MIPS) | |
172 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ | 163 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
173 static_cast<int32_t>(Simulator::Current()->Call( \ | 164 static_cast<int32_t>(Simulator::Current()->Call( \ |
174 bit_cast<int32_t, uword>(entry), \ | 165 bit_cast<int32_t, uword>(entry), \ |
175 bit_cast<int32_t, float>(float_arg), \ | 166 bit_cast<int32_t, float>(float_arg), \ |
176 0, 0, 0)) | 167 0, 0, 0, false, true)) |
177 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 168 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
178 static_cast<int32_t>(Simulator::Current()->Call( \ | 169 static_cast<int32_t>(Simulator::Current()->Call( \ |
179 bit_cast<int32_t, uword>(entry), \ | 170 bit_cast<int32_t, uword>(entry), \ |
180 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ | 171 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ |
181 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ | 172 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ |
182 0, 0)) | 173 0, 0, false, true)) |
183 #endif // defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) | 174 #endif // defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) |
184 #endif // defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 175 #endif // defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
185 | 176 |
186 | 177 |
187 inline Dart_Handle NewString(const char* str) { | 178 inline Dart_Handle NewString(const char* str) { |
188 return Dart_NewStringFromCString(str); | 179 return Dart_NewStringFromCString(str); |
189 } | 180 } |
190 | 181 |
191 | 182 |
192 namespace dart { | 183 namespace dart { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } \ | 382 } \ |
392 } else { \ | 383 } else { \ |
393 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ | 384 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
394 #handle); \ | 385 #handle); \ |
395 } \ | 386 } \ |
396 } while (0) | 387 } while (0) |
397 | 388 |
398 } // namespace dart | 389 } // namespace dart |
399 | 390 |
400 #endif // VM_UNIT_TEST_H_ | 391 #endif // VM_UNIT_TEST_H_ |
OLD | NEW |