| 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 "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2691 // exception. | 2691 // exception. |
| 2692 ApiState* state = isolate->api_state(); | 2692 ApiState* state = isolate->api_state(); |
| 2693 ASSERT(state != NULL); | 2693 ASSERT(state != NULL); |
| 2694 const Instance* saved_exception; | 2694 const Instance* saved_exception; |
| 2695 { | 2695 { |
| 2696 NoGCScope no_gc; | 2696 NoGCScope no_gc; |
| 2697 RawInstance* raw_exception = exception.raw(); | 2697 RawInstance* raw_exception = exception.raw(); |
| 2698 state->UnwindScopes(isolate->top_exit_frame_info()); | 2698 state->UnwindScopes(isolate->top_exit_frame_info()); |
| 2699 saved_exception = &Instance::Handle(raw_exception); | 2699 saved_exception = &Instance::Handle(raw_exception); |
| 2700 } | 2700 } |
| 2701 Exceptions::Throw(*saved_exception); | 2701 Exceptions::Throw(isolate, *saved_exception); |
| 2702 const String& message = String::Handle( | 2702 const String& message = String::Handle( |
| 2703 String::New("Exception was not thrown, internal error")); | 2703 String::New("Exception was not thrown, internal error")); |
| 2704 return ApiError::New(message); | 2704 return ApiError::New(message); |
| 2705 } | 2705 } |
| 2706 | 2706 |
| 2707 // TODO(sgjesse): value should always be smaller then 0xff. Add error handling. | 2707 // TODO(sgjesse): value should always be smaller then 0xff. Add error handling. |
| 2708 #define GET_LIST_ELEMENT_AS_BYTES(isolate, type, obj, native_array, offset, \ | 2708 #define GET_LIST_ELEMENT_AS_BYTES(isolate, type, obj, native_array, offset, \ |
| 2709 length) \ | 2709 length) \ |
| 2710 const type& array = type::Cast(obj); \ | 2710 const type& array = type::Cast(obj); \ |
| 2711 if (Utils::RangeCheck(offset, length, array.Length())) { \ | 2711 if (Utils::RangeCheck(offset, length, array.Length())) { \ |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4205 ApiState* state = isolate->api_state(); | 4205 ApiState* state = isolate->api_state(); |
| 4206 ASSERT(state != NULL); | 4206 ASSERT(state != NULL); |
| 4207 const Instance* saved_exception; | 4207 const Instance* saved_exception; |
| 4208 { | 4208 { |
| 4209 NoGCScope no_gc; | 4209 NoGCScope no_gc; |
| 4210 RawInstance* raw_exception = | 4210 RawInstance* raw_exception = |
| 4211 Api::UnwrapInstanceHandle(isolate, exception).raw(); | 4211 Api::UnwrapInstanceHandle(isolate, exception).raw(); |
| 4212 state->UnwindScopes(isolate->top_exit_frame_info()); | 4212 state->UnwindScopes(isolate->top_exit_frame_info()); |
| 4213 saved_exception = &Instance::Handle(raw_exception); | 4213 saved_exception = &Instance::Handle(raw_exception); |
| 4214 } | 4214 } |
| 4215 Exceptions::Throw(*saved_exception); | 4215 Exceptions::Throw(isolate, *saved_exception); |
| 4216 return Api::NewError("Exception was not thrown, internal error"); | 4216 return Api::NewError("Exception was not thrown, internal error"); |
| 4217 } | 4217 } |
| 4218 | 4218 |
| 4219 | 4219 |
| 4220 DART_EXPORT Dart_Handle Dart_ReThrowException(Dart_Handle exception, | 4220 DART_EXPORT Dart_Handle Dart_ReThrowException(Dart_Handle exception, |
| 4221 Dart_Handle stacktrace) { | 4221 Dart_Handle stacktrace) { |
| 4222 Isolate* isolate = Isolate::Current(); | 4222 Isolate* isolate = Isolate::Current(); |
| 4223 CHECK_ISOLATE(isolate); | 4223 CHECK_ISOLATE(isolate); |
| 4224 CHECK_CALLBACK_STATE(isolate); | 4224 CHECK_CALLBACK_STATE(isolate); |
| 4225 { | 4225 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4247 { | 4247 { |
| 4248 NoGCScope no_gc; | 4248 NoGCScope no_gc; |
| 4249 RawInstance* raw_exception = | 4249 RawInstance* raw_exception = |
| 4250 Api::UnwrapInstanceHandle(isolate, exception).raw(); | 4250 Api::UnwrapInstanceHandle(isolate, exception).raw(); |
| 4251 RawInstance* raw_stacktrace = | 4251 RawInstance* raw_stacktrace = |
| 4252 Api::UnwrapInstanceHandle(isolate, stacktrace).raw(); | 4252 Api::UnwrapInstanceHandle(isolate, stacktrace).raw(); |
| 4253 state->UnwindScopes(isolate->top_exit_frame_info()); | 4253 state->UnwindScopes(isolate->top_exit_frame_info()); |
| 4254 saved_exception = &Instance::Handle(raw_exception); | 4254 saved_exception = &Instance::Handle(raw_exception); |
| 4255 saved_stacktrace = &Instance::Handle(raw_stacktrace); | 4255 saved_stacktrace = &Instance::Handle(raw_stacktrace); |
| 4256 } | 4256 } |
| 4257 Exceptions::ReThrow(*saved_exception, *saved_stacktrace); | 4257 Exceptions::ReThrow(isolate, *saved_exception, *saved_stacktrace); |
| 4258 return Api::NewError("Exception was not re thrown, internal error"); | 4258 return Api::NewError("Exception was not re thrown, internal error"); |
| 4259 } | 4259 } |
| 4260 | 4260 |
| 4261 | 4261 |
| 4262 // --- Native fields and functions --- | 4262 // --- Native fields and functions --- |
| 4263 | 4263 |
| 4264 DART_EXPORT Dart_Handle Dart_CreateNativeWrapperClass(Dart_Handle library, | 4264 DART_EXPORT Dart_Handle Dart_CreateNativeWrapperClass(Dart_Handle library, |
| 4265 Dart_Handle name, | 4265 Dart_Handle name, |
| 4266 int field_count) { | 4266 int field_count) { |
| 4267 Isolate* isolate = Isolate::Current(); | 4267 Isolate* isolate = Isolate::Current(); |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5188 | 5188 |
| 5189 | 5189 |
| 5190 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5190 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 5191 const char* name, | 5191 const char* name, |
| 5192 Dart_ServiceRequestCallback callback, | 5192 Dart_ServiceRequestCallback callback, |
| 5193 void* user_data) { | 5193 void* user_data) { |
| 5194 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5194 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
| 5195 } | 5195 } |
| 5196 | 5196 |
| 5197 } // namespace dart | 5197 } // namespace dart |
| OLD | NEW |