| 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 | 6 |
| 7 #include "platform/assert.h" |
| 7 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 11 #include "vm/dart.h" |
| 11 #include "vm/dart_api_impl.h" | 12 #include "vm/dart_api_impl.h" |
| 12 #include "vm/dart_api_message.h" | 13 #include "vm/dart_api_message.h" |
| 13 #include "vm/dart_api_state.h" | 14 #include "vm/dart_api_state.h" |
| 14 #include "vm/dart_entry.h" | 15 #include "vm/dart_entry.h" |
| 15 #include "vm/debuginfo.h" | 16 #include "vm/debuginfo.h" |
| 16 #include "vm/exceptions.h" | 17 #include "vm/exceptions.h" |
| (...skipping 4168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4185 return Api::NewHandle(arguments->isolate(), arguments->NativeArgAt(index)); | 4186 return Api::NewHandle(arguments->isolate(), arguments->NativeArgAt(index)); |
| 4186 } | 4187 } |
| 4187 | 4188 |
| 4188 | 4189 |
| 4189 DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args) { | 4190 DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args) { |
| 4190 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 4191 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 4191 return arguments->NativeArgCount(); | 4192 return arguments->NativeArgCount(); |
| 4192 } | 4193 } |
| 4193 | 4194 |
| 4194 | 4195 |
| 4195 // This function has friend access to SetReturnUnsafe. | |
| 4196 void SetReturnValueHelper(Dart_NativeArguments args, Dart_Handle retval) { | |
| 4197 NoGCScope no_gc_scope; | |
| 4198 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | |
| 4199 arguments->SetReturnUnsafe(Api::UnwrapHandle(retval)); | |
| 4200 } | |
| 4201 | |
| 4202 | |
| 4203 DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, | 4196 DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, |
| 4204 Dart_Handle retval) { | 4197 Dart_Handle retval) { |
| 4205 SetReturnValueHelper(args, retval); | 4198 const Object& ret_obj = Object::Handle(Api::UnwrapHandle(retval)); |
| 4199 if (!ret_obj.IsNull() && !ret_obj.IsInstance()) { |
| 4200 FATAL1("Return value check failed: saw '%s' expected a dart Instance.", |
| 4201 ret_obj.ToCString()); |
| 4202 } |
| 4203 NoGCScope no_gc_scope; |
| 4204 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 4205 arguments->SetReturn(ret_obj); |
| 4206 } | 4206 } |
| 4207 | 4207 |
| 4208 | 4208 |
| 4209 // --- Scripts and Libraries --- | 4209 // --- Scripts and Libraries --- |
| 4210 | 4210 |
| 4211 | 4211 |
| 4212 DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler( | 4212 DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler( |
| 4213 Dart_LibraryTagHandler handler) { | 4213 Dart_LibraryTagHandler handler) { |
| 4214 Isolate* isolate = Isolate::Current(); | 4214 Isolate* isolate = Isolate::Current(); |
| 4215 CHECK_ISOLATE(isolate); | 4215 CHECK_ISOLATE(isolate); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4709 } | 4709 } |
| 4710 { | 4710 { |
| 4711 NoGCScope no_gc; | 4711 NoGCScope no_gc; |
| 4712 RawObject* raw_obj = obj.raw(); | 4712 RawObject* raw_obj = obj.raw(); |
| 4713 isolate->heap()->SetPeer(raw_obj, peer); | 4713 isolate->heap()->SetPeer(raw_obj, peer); |
| 4714 } | 4714 } |
| 4715 return Api::Success(isolate); | 4715 return Api::Success(isolate); |
| 4716 } | 4716 } |
| 4717 | 4717 |
| 4718 } // namespace dart | 4718 } // namespace dart |
| OLD | NEW |