| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "lib/stacktrace.h" |
| 10 #include "vm/class_finalizer.h" | 11 #include "vm/class_finalizer.h" |
| 11 #include "vm/compiler.h" | 12 #include "vm/compiler.h" |
| 12 #include "vm/dart.h" | 13 #include "vm/dart.h" |
| 13 #include "vm/dart_api_impl.h" | 14 #include "vm/dart_api_impl.h" |
| 14 #include "vm/dart_api_message.h" | 15 #include "vm/dart_api_message.h" |
| 15 #include "vm/dart_api_state.h" | 16 #include "vm/dart_api_state.h" |
| 16 #include "vm/dart_entry.h" | 17 #include "vm/dart_entry.h" |
| 17 #include "vm/debugger.h" | 18 #include "vm/debugger.h" |
| 18 #include "vm/debuginfo.h" | 19 #include "vm/debuginfo.h" |
| 19 #include "vm/exceptions.h" | 20 #include "vm/exceptions.h" |
| (...skipping 4765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4785 } | 4786 } |
| 4786 return Api::Success(); | 4787 return Api::Success(); |
| 4787 } | 4788 } |
| 4788 | 4789 |
| 4789 | 4790 |
| 4790 DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, | 4791 DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, |
| 4791 Dart_Handle retval) { | 4792 Dart_Handle retval) { |
| 4792 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 4793 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 4793 ASSERT(arguments->thread()->isolate() == Isolate::Current()); | 4794 ASSERT(arguments->thread()->isolate() == Isolate::Current()); |
| 4794 if ((retval != Api::Null()) && (!Api::IsInstance(retval))) { | 4795 if ((retval != Api::Null()) && (!Api::IsInstance(retval))) { |
| 4796 // Print the current stack trace to make the problematic caller |
| 4797 // easier to find. |
| 4798 const Stacktrace& stacktrace = GetCurrentStacktrace(0); |
| 4799 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString()); |
| 4800 |
| 4795 const Object& ret_obj = Object::Handle(Api::UnwrapHandle(retval)); | 4801 const Object& ret_obj = Object::Handle(Api::UnwrapHandle(retval)); |
| 4796 FATAL1("Return value check failed: saw '%s' expected a dart Instance.", | 4802 FATAL1("Return value check failed: saw '%s' expected a dart Instance.", |
| 4797 ret_obj.ToCString()); | 4803 ret_obj.ToCString()); |
| 4798 } | 4804 } |
| 4799 ASSERT(retval != 0); | 4805 ASSERT(retval != 0); |
| 4800 Api::SetReturnValue(arguments, retval); | 4806 Api::SetReturnValue(arguments, retval); |
| 4801 } | 4807 } |
| 4802 | 4808 |
| 4803 | 4809 |
| 4804 DART_EXPORT void Dart_SetWeakHandleReturnValue(Dart_NativeArguments args, | 4810 DART_EXPORT void Dart_SetWeakHandleReturnValue(Dart_NativeArguments args, |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5967 return Api::Success(); | 5973 return Api::Success(); |
| 5968 } | 5974 } |
| 5969 #endif // DART_PRECOMPILED_RUNTIME | 5975 #endif // DART_PRECOMPILED_RUNTIME |
| 5970 | 5976 |
| 5971 | 5977 |
| 5972 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 5978 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
| 5973 return Dart::IsRunningPrecompiledCode(); | 5979 return Dart::IsRunningPrecompiledCode(); |
| 5974 } | 5980 } |
| 5975 | 5981 |
| 5976 } // namespace dart | 5982 } // namespace dart |
| OLD | NEW |