| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 COMPILE_ASSERT(!is_double<Arg3Type>::value); | 423 COMPILE_ASSERT(!is_double<Arg3Type>::value); |
| 424 const bool fp_args = false; | 424 const bool fp_args = false; |
| 425 const bool fp_return = false; | 425 const bool fp_return = false; |
| 426 Simulator::Current()->Call( | 426 Simulator::Current()->Call( |
| 427 bit_cast<intptr_t, uword>(entry()), | 427 bit_cast<intptr_t, uword>(entry()), |
| 428 reinterpret_cast<intptr_t>(arg1), | 428 reinterpret_cast<intptr_t>(arg1), |
| 429 reinterpret_cast<intptr_t>(arg2), | 429 reinterpret_cast<intptr_t>(arg2), |
| 430 reinterpret_cast<intptr_t>(arg3), | 430 reinterpret_cast<intptr_t>(arg3), |
| 431 0, fp_return, fp_args); | 431 0, fp_return, fp_args); |
| 432 } | 432 } |
| 433 #elif defined(USING_SIMULATOR) && defined(TARGET_ARCH_DBC) |
| 434 template<typename ResultType, |
| 435 typename Arg1Type, |
| 436 typename Arg2Type, |
| 437 typename Arg3Type> |
| 438 ResultType Invoke(Arg1Type arg1, Arg2Type arg2, Arg3Type arg3) { |
| 439 // TODO(fschneider): Support double arguments for simulator calls. |
| 440 COMPILE_ASSERT(is_void<ResultType>::value); |
| 441 COMPILE_ASSERT(!is_double<Arg1Type>::value); |
| 442 COMPILE_ASSERT(!is_double<Arg2Type>::value); |
| 443 COMPILE_ASSERT(!is_double<Arg3Type>::value); |
| 444 const Object& arg1obj = Object::Handle(reinterpret_cast<RawObject*>(arg1)); |
| 445 const Object& arg2obj = Object::Handle(reinterpret_cast<RawObject*>(arg2)); |
| 446 const Array& argdesc = Array::Handle(ArgumentsDescriptor::New(2)); |
| 447 const Array& arguments = Array::Handle(Array::New(2)); |
| 448 arguments.SetAt(0, arg1obj); |
| 449 arguments.SetAt(1, arg2obj); |
| 450 Simulator::Current()->Call( |
| 451 code(), |
| 452 argdesc, |
| 453 arguments, |
| 454 reinterpret_cast<Thread*>(arg3)); |
| 455 } |
| 433 #else | 456 #else |
| 434 template<typename ResultType> ResultType InvokeWithCodeAndThread() { | 457 template<typename ResultType> ResultType InvokeWithCodeAndThread() { |
| 435 Thread* thread = Thread::Current(); | 458 Thread* thread = Thread::Current(); |
| 436 ASSERT(thread != NULL); | 459 ASSERT(thread != NULL); |
| 437 typedef ResultType (*FunctionType) (const Code&, Thread*); | 460 typedef ResultType (*FunctionType) (const Code&, Thread*); |
| 438 return reinterpret_cast<FunctionType>(entry())(code_, thread); | 461 return reinterpret_cast<FunctionType>(entry())(code_, thread); |
| 439 } | 462 } |
| 440 | 463 |
| 441 template<typename ResultType, typename Arg1Type> | 464 template<typename ResultType, typename Arg1Type> |
| 442 ResultType InvokeWithCodeAndThread(Arg1Type arg1) { | 465 ResultType InvokeWithCodeAndThread(Arg1Type arg1) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // Yields: | 582 // Yields: |
| 560 // | 583 // |
| 561 // out = "\"id\":\"\"" | 584 // out = "\"id\":\"\"" |
| 562 // | 585 // |
| 563 void ElideJSONSubstring(const char* prefix, const char* in, char* out); | 586 void ElideJSONSubstring(const char* prefix, const char* in, char* out); |
| 564 | 587 |
| 565 | 588 |
| 566 } // namespace dart | 589 } // namespace dart |
| 567 | 590 |
| 568 #endif // VM_UNIT_TEST_H_ | 591 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |