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 Array& argdesc = Array::Handle(ArgumentsDescriptor::New(0, 2)); |
482 const Array& arguments = Array::Handle(Array::New(2)); | 482 const Array& arguments = Array::Handle(Array::New(2)); |
483 arguments.SetAt(0, arg1obj); | 483 arguments.SetAt(0, arg1obj); |
484 arguments.SetAt(1, arg2obj); | 484 arguments.SetAt(1, arg2obj); |
485 Simulator::Current()->Call(code(), argdesc, arguments, | 485 Simulator::Current()->Call(code(), argdesc, arguments, |
486 reinterpret_cast<Thread*>(arg3)); | 486 reinterpret_cast<Thread*>(arg3)); |
487 } | 487 } |
488 #else | 488 #else |
489 template <typename ResultType> | 489 template <typename ResultType> |
490 ResultType InvokeWithCodeAndThread() { | 490 ResultType InvokeWithCodeAndThread() { |
491 Thread* thread = Thread::Current(); | 491 Thread* thread = Thread::Current(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 ~SetFlagScope() { *flag_ = original_value_; } | 640 ~SetFlagScope() { *flag_ = original_value_; } |
641 | 641 |
642 private: | 642 private: |
643 T* flag_; | 643 T* flag_; |
644 T original_value_; | 644 T original_value_; |
645 }; | 645 }; |
646 | 646 |
647 } // namespace dart | 647 } // namespace dart |
648 | 648 |
649 #endif // RUNTIME_VM_UNIT_TEST_H_ | 649 #endif // RUNTIME_VM_UNIT_TEST_H_ |
OLD | NEW |