Chromium Code Reviews| 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 Array& argdesc = Array::Handle(ArgumentsDescriptor::New(2)); | |
| 445 const Array& arguments = Array::Handle(Array::New(2)); | |
|
Vyacheslav Egorov (Google)
2016/05/03 21:39:02
This is unsafe. Can't use RawObject* arguments acr
zra
2016/05/03 21:58:32
Done.
| |
| 446 arguments.SetAt(0, Object::Handle(reinterpret_cast<RawObject*>(arg1))); | |
| 447 arguments.SetAt(1, Object::Handle(reinterpret_cast<RawObject*>(arg2))); | |
| 448 Simulator::Current()->Call( | |
| 449 code(), | |
| 450 argdesc, | |
| 451 arguments, | |
| 452 reinterpret_cast<Thread*>(arg3)); | |
| 453 } | |
| 433 #else | 454 #else |
| 434 template<typename ResultType> ResultType InvokeWithCodeAndThread() { | 455 template<typename ResultType> ResultType InvokeWithCodeAndThread() { |
| 435 Thread* thread = Thread::Current(); | 456 Thread* thread = Thread::Current(); |
| 436 ASSERT(thread != NULL); | 457 ASSERT(thread != NULL); |
| 437 typedef ResultType (*FunctionType) (const Code&, Thread*); | 458 typedef ResultType (*FunctionType) (const Code&, Thread*); |
| 438 return reinterpret_cast<FunctionType>(entry())(code_, thread); | 459 return reinterpret_cast<FunctionType>(entry())(code_, thread); |
| 439 } | 460 } |
| 440 | 461 |
| 441 template<typename ResultType, typename Arg1Type> | 462 template<typename ResultType, typename Arg1Type> |
| 442 ResultType InvokeWithCodeAndThread(Arg1Type arg1) { | 463 ResultType InvokeWithCodeAndThread(Arg1Type arg1) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 // Yields: | 580 // Yields: |
| 560 // | 581 // |
| 561 // out = "\"id\":\"\"" | 582 // out = "\"id\":\"\"" |
| 562 // | 583 // |
| 563 void ElideJSONSubstring(const char* prefix, const char* in, char* out); | 584 void ElideJSONSubstring(const char* prefix, const char* in, char* out); |
| 564 | 585 |
| 565 | 586 |
| 566 } // namespace dart | 587 } // namespace dart |
| 567 | 588 |
| 568 #endif // VM_UNIT_TEST_H_ | 589 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |