| 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 RUNTIME_VM_UNIT_TEST_H_ | 5 #ifndef RUNTIME_VM_UNIT_TEST_H_ |
| 6 #define RUNTIME_VM_UNIT_TEST_H_ | 6 #define RUNTIME_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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 typename Arg2Type, | 471 typename Arg2Type, |
| 472 typename Arg3Type> | 472 typename Arg3Type> |
| 473 ResultType Invoke(Arg1Type arg1, Arg2Type arg2, Arg3Type arg3) { | 473 ResultType Invoke(Arg1Type arg1, Arg2Type arg2, Arg3Type arg3) { |
| 474 // TODO(fschneider): Support double arguments for simulator calls. | 474 // TODO(fschneider): Support double arguments for simulator calls. |
| 475 COMPILE_ASSERT(is_void<ResultType>::value); | 475 COMPILE_ASSERT(is_void<ResultType>::value); |
| 476 COMPILE_ASSERT(!is_double<Arg1Type>::value); | 476 COMPILE_ASSERT(!is_double<Arg1Type>::value); |
| 477 COMPILE_ASSERT(!is_double<Arg2Type>::value); | 477 COMPILE_ASSERT(!is_double<Arg2Type>::value); |
| 478 COMPILE_ASSERT(!is_double<Arg3Type>::value); | 478 COMPILE_ASSERT(!is_double<Arg3Type>::value); |
| 479 const Object& arg1obj = Object::Handle(reinterpret_cast<RawObject*>(arg1)); | 479 const Object& arg1obj = Object::Handle(reinterpret_cast<RawObject*>(arg1)); |
| 480 const Object& arg2obj = Object::Handle(reinterpret_cast<RawObject*>(arg2)); | 480 const Object& arg2obj = Object::Handle(reinterpret_cast<RawObject*>(arg2)); |
| 481 const Array& argdesc = Array::Handle(ArgumentsDescriptor::New(2)); | 481 const intptr_t kTypeArgsLen = 0; |
| 482 const intptr_t kNumArgs = 2; |
| 483 const Array& argdesc = |
| 484 Array::Handle(ArgumentsDescriptor::New(kTypeArgsLen, kNumArgs)); |
| 482 const Array& arguments = Array::Handle(Array::New(2)); | 485 const Array& arguments = Array::Handle(Array::New(2)); |
| 483 arguments.SetAt(0, arg1obj); | 486 arguments.SetAt(0, arg1obj); |
| 484 arguments.SetAt(1, arg2obj); | 487 arguments.SetAt(1, arg2obj); |
| 485 Simulator::Current()->Call(code(), argdesc, arguments, | 488 Simulator::Current()->Call(code(), argdesc, arguments, |
| 486 reinterpret_cast<Thread*>(arg3)); | 489 reinterpret_cast<Thread*>(arg3)); |
| 487 } | 490 } |
| 488 #else | 491 #else |
| 489 template <typename ResultType> | 492 template <typename ResultType> |
| 490 ResultType InvokeWithCodeAndThread() { | 493 ResultType InvokeWithCodeAndThread() { |
| 491 Thread* thread = Thread::Current(); | 494 Thread* thread = Thread::Current(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 ~SetFlagScope() { *flag_ = original_value_; } | 643 ~SetFlagScope() { *flag_ = original_value_; } |
| 641 | 644 |
| 642 private: | 645 private: |
| 643 T* flag_; | 646 T* flag_; |
| 644 T original_value_; | 647 T original_value_; |
| 645 }; | 648 }; |
| 646 | 649 |
| 647 } // namespace dart | 650 } // namespace dart |
| 648 | 651 |
| 649 #endif // RUNTIME_VM_UNIT_TEST_H_ | 652 #endif // RUNTIME_VM_UNIT_TEST_H_ |
| OLD | NEW |