| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 static_cast<int32_t>(Simulator::Current()->Call( \ | 194 static_cast<int32_t>(Simulator::Current()->Call( \ |
| 195 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) | 195 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0)) |
| 196 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ | 196 #define EXECUTE_TEST_CODE_DOUBLE(name, entry) \ |
| 197 bit_cast<double, int64_t>(Simulator::Current()->Call( \ | 197 bit_cast<double, int64_t>(Simulator::Current()->Call( \ |
| 198 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) | 198 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) |
| 199 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ | 199 #define EXECUTE_TEST_CODE_INTPTR_INTPTR(name, entry, pointer_arg) \ |
| 200 static_cast<intptr_t>(Simulator::Current()->Call( \ | 200 static_cast<intptr_t>(Simulator::Current()->Call( \ |
| 201 bit_cast<int32_t, uword>(entry), \ | 201 bit_cast<int32_t, uword>(entry), \ |
| 202 bit_cast<int32_t, intptr_t>(pointer_arg), \ | 202 bit_cast<int32_t, intptr_t>(pointer_arg), \ |
| 203 0, 0, 0)) | 203 0, 0, 0)) |
| 204 #endif | 204 #endif // defined(ARCH_IS_64_BIT) |
| 205 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ | 205 #define EXECUTE_TEST_CODE_INT64_LL(name, entry, long_arg0, long_arg1) \ |
| 206 static_cast<int64_t>(Simulator::Current()->Call( \ | 206 static_cast<int64_t>(Simulator::Current()->Call( \ |
| 207 bit_cast<int32_t, uword>(entry), \ | 207 bit_cast<int32_t, uword>(entry), \ |
| 208 Utils::Low32Bits(long_arg0), \ | 208 Utils::Low32Bits(long_arg0), \ |
| 209 Utils::High32Bits(long_arg0), \ | 209 Utils::High32Bits(long_arg0), \ |
| 210 Utils::Low32Bits(long_arg1), \ | 210 Utils::Low32Bits(long_arg1), \ |
| 211 Utils::High32Bits(long_arg1))) | 211 Utils::High32Bits(long_arg1))) |
| 212 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ | 212 #define EXECUTE_TEST_CODE_FLOAT(name, entry) \ |
| 213 bit_cast<float, int32_t>(Simulator::Current()->Call( \ | 213 bit_cast<float, int32_t>(Simulator::Current()->Call( \ |
| 214 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) | 214 bit_cast<int32_t, uword>(entry), 0, 0, 0, 0, true)) |
| 215 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ | 215 #define EXECUTE_TEST_CODE_INT32_F(name, entry, float_arg) \ |
| 216 static_cast<int32_t>(Simulator::Current()->Call( \ | 216 static_cast<int32_t>(Simulator::Current()->Call( \ |
| 217 bit_cast<int32_t, uword>(entry), \ | 217 bit_cast<int32_t, uword>(entry), \ |
| 218 bit_cast<int32_t, float>(float_arg), \ | 218 bit_cast<int32_t, float>(float_arg), \ |
| 219 0, 0, 0, false, true)) | 219 0, 0, 0, false, true)) |
| 220 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ | 220 #define EXECUTE_TEST_CODE_INT32_D(name, entry, double_arg) \ |
| 221 static_cast<int32_t>(Simulator::Current()->Call( \ | 221 static_cast<int32_t>(Simulator::Current()->Call( \ |
| 222 bit_cast<int32_t, uword>(entry), \ | 222 bit_cast<int32_t, uword>(entry), \ |
| 223 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ | 223 Utils::Low32Bits(bit_cast<int64_t, double>(double_arg)), \ |
| 224 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ | 224 Utils::High32Bits(bit_cast<int64_t, double>(double_arg)), \ |
| 225 0, 0, false, true)) | 225 0, 0, false, true)) |
| 226 #endif // defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) | 226 #endif // defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) |
| 227 #endif // defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 227 #else |
| 228 // For DBC Assembler tests. |
| 229 #define EXECUTE_TEST_CODE_INTPTR(code) \ |
| 230 Smi::Value(Smi::RawCast(Simulator::Current()->Call( \ |
| 231 code, \ |
| 232 Array::Handle(ArgumentsDescriptor::New(0)), \ |
| 233 Array::Handle(Array::New(0)), \ |
| 234 Thread::Current()))) |
| 235 #define EXECUTE_TEST_CODE_BOOL(code) \ |
| 236 (Bool::RawCast(Simulator::Current()->Call( \ |
| 237 code, \ |
| 238 Array::Handle(ArgumentsDescriptor::New(0)), \ |
| 239 Array::Handle(Array::New(0)), \ |
| 240 Thread::Current())) == Bool::True().raw()) |
| 241 #endif // defined(TARGET_ARCH_{ARM, ARM64, MIPS}) |
| 228 | 242 |
| 229 | 243 |
| 230 inline Dart_Handle NewString(const char* str) { | 244 inline Dart_Handle NewString(const char* str) { |
| 231 return Dart_NewStringFromCString(str); | 245 return Dart_NewStringFromCString(str); |
| 232 } | 246 } |
| 233 | 247 |
| 234 | 248 |
| 235 namespace dart { | 249 namespace dart { |
| 236 | 250 |
| 237 // Forward declarations. | 251 // Forward declarations. |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // Yields: | 573 // Yields: |
| 560 // | 574 // |
| 561 // out = "\"id\":\"\"" | 575 // out = "\"id\":\"\"" |
| 562 // | 576 // |
| 563 void ElideJSONSubstring(const char* prefix, const char* in, char* out); | 577 void ElideJSONSubstring(const char* prefix, const char* in, char* out); |
| 564 | 578 |
| 565 | 579 |
| 566 } // namespace dart | 580 } // namespace dart |
| 567 | 581 |
| 568 #endif // VM_UNIT_TEST_H_ | 582 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |