| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 Dart_Isolate Api::CastIsolate(Isolate* isolate) { | 172 Dart_Isolate Api::CastIsolate(Isolate* isolate) { |
| 173 return reinterpret_cast<Dart_Isolate>(isolate); | 173 return reinterpret_cast<Dart_Isolate>(isolate); |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| 177 Dart_Handle Api::NewError(const char* format, ...) { | 177 Dart_Handle Api::NewError(const char* format, ...) { |
| 178 Isolate* isolate = Isolate::Current(); | 178 Isolate* isolate = Isolate::Current(); |
| 179 DARTSCOPE(isolate); | 179 HANDLESCOPE(isolate); |
| 180 CHECK_CALLBACK_STATE(isolate); | 180 CHECK_CALLBACK_STATE(isolate); |
| 181 | 181 |
| 182 va_list args; | 182 va_list args; |
| 183 va_start(args, format); | 183 va_start(args, format); |
| 184 intptr_t len = OS::VSNPrint(NULL, 0, format, args); | 184 intptr_t len = OS::VSNPrint(NULL, 0, format, args); |
| 185 va_end(args); | 185 va_end(args); |
| 186 | 186 |
| 187 char* buffer = isolate->current_zone()->Alloc<char>(len + 1); | 187 char* buffer = isolate->current_zone()->Alloc<char>(len + 1); |
| 188 va_list args2; | 188 va_list args2; |
| 189 va_start(args2, format); | 189 va_start(args2, format); |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, | 869 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, |
| 870 const char* main, | 870 const char* main, |
| 871 const uint8_t* snapshot, | 871 const uint8_t* snapshot, |
| 872 void* callback_data, | 872 void* callback_data, |
| 873 char** error) { | 873 char** error) { |
| 874 TRACE_API_CALL(CURRENT_FUNC); | 874 TRACE_API_CALL(CURRENT_FUNC); |
| 875 char* isolate_name = BuildIsolateName(script_uri, main); | 875 char* isolate_name = BuildIsolateName(script_uri, main); |
| 876 Isolate* isolate = Dart::CreateIsolate(isolate_name); | 876 Isolate* isolate = Dart::CreateIsolate(isolate_name); |
| 877 free(isolate_name); | 877 free(isolate_name); |
| 878 { | 878 { |
| 879 START_TIMER(isolate, time_total_runtime); |
| 879 StackZone zone(isolate); | 880 StackZone zone(isolate); |
| 880 HANDLESCOPE(isolate); | 881 HANDLESCOPE(isolate); |
| 881 const Error& error_obj = | 882 const Error& error_obj = |
| 882 Error::Handle(isolate, | 883 Error::Handle(isolate, |
| 883 Dart::InitializeIsolate(snapshot, callback_data)); | 884 Dart::InitializeIsolate(snapshot, callback_data)); |
| 884 if (error_obj.IsNull()) { | 885 if (error_obj.IsNull()) { |
| 886 START_TIMER(isolate, time_native_execution); |
| 885 if (FLAG_check_function_fingerprints) { | 887 if (FLAG_check_function_fingerprints) { |
| 886 Library::CheckFunctionFingerprints(); | 888 Library::CheckFunctionFingerprints(); |
| 887 } | 889 } |
| 888 START_TIMER(time_total_runtime); | |
| 889 return reinterpret_cast<Dart_Isolate>(isolate); | 890 return reinterpret_cast<Dart_Isolate>(isolate); |
| 890 } | 891 } |
| 891 *error = strdup(error_obj.ToErrorCString()); | 892 *error = strdup(error_obj.ToErrorCString()); |
| 892 } | 893 } |
| 894 STOP_TIMER(isolate, time_native_execution); |
| 895 STOP_TIMER(isolate, time_total_runtime); |
| 893 Dart::ShutdownIsolate(); | 896 Dart::ShutdownIsolate(); |
| 894 return reinterpret_cast<Dart_Isolate>(NULL); | 897 return reinterpret_cast<Dart_Isolate>(NULL); |
| 895 } | 898 } |
| 896 | 899 |
| 897 | 900 |
| 898 DART_EXPORT void Dart_ShutdownIsolate() { | 901 DART_EXPORT void Dart_ShutdownIsolate() { |
| 899 Isolate* isolate = Isolate::Current(); | 902 Isolate* isolate = Isolate::Current(); |
| 900 CHECK_ISOLATE(isolate); | 903 CHECK_ISOLATE(isolate); |
| 901 { | 904 { |
| 902 StackZone zone(isolate); | 905 StackZone zone(isolate); |
| 903 HandleScope handle_scope(isolate); | 906 HandleScope handle_scope(isolate); |
| 904 Dart::RunShutdownCallback(); | 907 Dart::RunShutdownCallback(); |
| 905 } | 908 } |
| 906 STOP_TIMER(time_total_runtime); | 909 STOP_TIMER(isolate, time_native_execution); |
| 910 STOP_TIMER(isolate, time_total_runtime); |
| 907 Dart::ShutdownIsolate(); | 911 Dart::ShutdownIsolate(); |
| 908 } | 912 } |
| 909 | 913 |
| 910 | 914 |
| 911 DART_EXPORT Dart_Isolate Dart_CurrentIsolate() { | 915 DART_EXPORT Dart_Isolate Dart_CurrentIsolate() { |
| 912 return Api::CastIsolate(Isolate::Current()); | 916 return Api::CastIsolate(Isolate::Current()); |
| 913 } | 917 } |
| 914 | 918 |
| 915 | 919 |
| 916 DART_EXPORT void* Dart_CurrentIsolateData() { | 920 DART_EXPORT void* Dart_CurrentIsolateData() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 946 intptr_t new_size) { | 950 intptr_t new_size) { |
| 947 return Api::TopScope(Isolate::Current())->zone()->Realloc<uint8_t>( | 951 return Api::TopScope(Isolate::Current())->zone()->Realloc<uint8_t>( |
| 948 ptr, old_size, new_size); | 952 ptr, old_size, new_size); |
| 949 } | 953 } |
| 950 | 954 |
| 951 | 955 |
| 952 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer, | 956 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer, |
| 953 intptr_t* size) { | 957 intptr_t* size) { |
| 954 Isolate* isolate = Isolate::Current(); | 958 Isolate* isolate = Isolate::Current(); |
| 955 DARTSCOPE(isolate); | 959 DARTSCOPE(isolate); |
| 956 TIMERSCOPE(time_creating_snapshot); | 960 TIMERSCOPE(isolate, time_creating_snapshot); |
| 957 if (buffer == NULL) { | 961 if (buffer == NULL) { |
| 958 RETURN_NULL_ERROR(buffer); | 962 RETURN_NULL_ERROR(buffer); |
| 959 } | 963 } |
| 960 if (size == NULL) { | 964 if (size == NULL) { |
| 961 RETURN_NULL_ERROR(size); | 965 RETURN_NULL_ERROR(size); |
| 962 } | 966 } |
| 963 Dart_Handle state = Api::CheckIsolateState(isolate); | 967 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 964 if (::Dart_IsError(state)) { | 968 if (::Dart_IsError(state)) { |
| 965 return state; | 969 return state; |
| 966 } | 970 } |
| 967 // Since this is only a snapshot the root library should not be set. | 971 // Since this is only a snapshot the root library should not be set. |
| 968 isolate->object_store()->set_root_library(Library::Handle(isolate)); | 972 isolate->object_store()->set_root_library(Library::Handle(isolate)); |
| 969 FullSnapshotWriter writer(buffer, ApiReallocate); | 973 FullSnapshotWriter writer(buffer, ApiReallocate); |
| 970 writer.WriteFullSnapshot(); | 974 writer.WriteFullSnapshot(); |
| 971 *size = writer.BytesWritten(); | 975 *size = writer.BytesWritten(); |
| 972 return Api::Success(); | 976 return Api::Success(); |
| 973 } | 977 } |
| 974 | 978 |
| 975 | 979 |
| 976 DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer, | 980 DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer, |
| 977 intptr_t* size) { | 981 intptr_t* size) { |
| 978 Isolate* isolate = Isolate::Current(); | 982 Isolate* isolate = Isolate::Current(); |
| 979 DARTSCOPE(isolate); | 983 DARTSCOPE(isolate); |
| 980 TIMERSCOPE(time_creating_snapshot); | 984 TIMERSCOPE(isolate, time_creating_snapshot); |
| 981 if (buffer == NULL) { | 985 if (buffer == NULL) { |
| 982 RETURN_NULL_ERROR(buffer); | 986 RETURN_NULL_ERROR(buffer); |
| 983 } | 987 } |
| 984 if (size == NULL) { | 988 if (size == NULL) { |
| 985 RETURN_NULL_ERROR(size); | 989 RETURN_NULL_ERROR(size); |
| 986 } | 990 } |
| 987 Dart_Handle state = Api::CheckIsolateState(isolate); | 991 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 988 if (::Dart_IsError(state)) { | 992 if (::Dart_IsError(state)) { |
| 989 return state; | 993 return state; |
| 990 } | 994 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 return Api::Success(); | 1202 return Api::Success(); |
| 1199 } | 1203 } |
| 1200 return Api::NewError("Dart_PostMessage failed."); | 1204 return Api::NewError("Dart_PostMessage failed."); |
| 1201 } | 1205 } |
| 1202 | 1206 |
| 1203 // --- Scopes ---- | 1207 // --- Scopes ---- |
| 1204 | 1208 |
| 1205 DART_EXPORT void Dart_EnterScope() { | 1209 DART_EXPORT void Dart_EnterScope() { |
| 1206 Isolate* isolate = Isolate::Current(); | 1210 Isolate* isolate = Isolate::Current(); |
| 1207 CHECK_ISOLATE(isolate); | 1211 CHECK_ISOLATE(isolate); |
| 1212 NativeToVmTimerScope __temp_isolate_timer__(isolate); |
| 1208 ApiState* state = isolate->api_state(); | 1213 ApiState* state = isolate->api_state(); |
| 1209 ASSERT(state != NULL); | 1214 ASSERT(state != NULL); |
| 1210 ApiLocalScope* new_scope = state->reusable_scope(); | 1215 ApiLocalScope* new_scope = state->reusable_scope(); |
| 1211 if (new_scope == NULL) { | 1216 if (new_scope == NULL) { |
| 1212 new_scope = new ApiLocalScope(state->top_scope(), | 1217 new_scope = new ApiLocalScope(state->top_scope(), |
| 1213 isolate->top_exit_frame_info()); | 1218 isolate->top_exit_frame_info()); |
| 1214 ASSERT(new_scope != NULL); | 1219 ASSERT(new_scope != NULL); |
| 1215 } else { | 1220 } else { |
| 1216 new_scope->Reinit(isolate, | 1221 new_scope->Reinit(isolate, |
| 1217 state->top_scope(), | 1222 state->top_scope(), |
| (...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3192 } | 3197 } |
| 3193 | 3198 |
| 3194 | 3199 |
| 3195 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, | 3200 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, |
| 3196 Dart_Handle name, | 3201 Dart_Handle name, |
| 3197 int number_of_arguments, | 3202 int number_of_arguments, |
| 3198 Dart_Handle* arguments) { | 3203 Dart_Handle* arguments) { |
| 3199 Isolate* isolate = Isolate::Current(); | 3204 Isolate* isolate = Isolate::Current(); |
| 3200 DARTSCOPE(isolate); | 3205 DARTSCOPE(isolate); |
| 3201 CHECK_CALLBACK_STATE(isolate); | 3206 CHECK_CALLBACK_STATE(isolate); |
| 3202 // TODO(turnidge): This is a bit simplistic. It overcounts when | |
| 3203 // other operations (gc, compilation) are active. | |
| 3204 TIMERSCOPE(time_dart_execution); | |
| 3205 | 3207 |
| 3206 const String& function_name = Api::UnwrapStringHandle(isolate, name); | 3208 const String& function_name = Api::UnwrapStringHandle(isolate, name); |
| 3207 if (function_name.IsNull()) { | 3209 if (function_name.IsNull()) { |
| 3208 RETURN_TYPE_ERROR(isolate, name, String); | 3210 RETURN_TYPE_ERROR(isolate, name, String); |
| 3209 } | 3211 } |
| 3210 if (number_of_arguments < 0) { | 3212 if (number_of_arguments < 0) { |
| 3211 return Api::NewError( | 3213 return Api::NewError( |
| 3212 "%s expects argument 'number_of_arguments' to be non-negative.", | 3214 "%s expects argument 'number_of_arguments' to be non-negative.", |
| 3213 CURRENT_FUNC); | 3215 CURRENT_FUNC); |
| 3214 } | 3216 } |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4093 lib.SetLoadError(); | 4095 lib.SetLoadError(); |
| 4094 } | 4096 } |
| 4095 } | 4097 } |
| 4096 } | 4098 } |
| 4097 | 4099 |
| 4098 | 4100 |
| 4099 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, | 4101 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, |
| 4100 Dart_Handle source, | 4102 Dart_Handle source, |
| 4101 intptr_t line_offset, | 4103 intptr_t line_offset, |
| 4102 intptr_t col_offset) { | 4104 intptr_t col_offset) { |
| 4103 TIMERSCOPE(time_script_loading); | |
| 4104 Isolate* isolate = Isolate::Current(); | 4105 Isolate* isolate = Isolate::Current(); |
| 4106 TIMERSCOPE(isolate, time_script_loading); |
| 4105 DARTSCOPE(isolate); | 4107 DARTSCOPE(isolate); |
| 4106 const String& url_str = Api::UnwrapStringHandle(isolate, url); | 4108 const String& url_str = Api::UnwrapStringHandle(isolate, url); |
| 4107 if (url_str.IsNull()) { | 4109 if (url_str.IsNull()) { |
| 4108 RETURN_TYPE_ERROR(isolate, url, String); | 4110 RETURN_TYPE_ERROR(isolate, url, String); |
| 4109 } | 4111 } |
| 4110 const String& source_str = Api::UnwrapStringHandle(isolate, source); | 4112 const String& source_str = Api::UnwrapStringHandle(isolate, source); |
| 4111 if (source_str.IsNull()) { | 4113 if (source_str.IsNull()) { |
| 4112 RETURN_TYPE_ERROR(isolate, source, String); | 4114 RETURN_TYPE_ERROR(isolate, source, String); |
| 4113 } | 4115 } |
| 4114 Library& library = | 4116 Library& library = |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4141 Dart_Handle result; | 4143 Dart_Handle result; |
| 4142 CompileSource(isolate, library, script, &result); | 4144 CompileSource(isolate, library, script, &result); |
| 4143 return result; | 4145 return result; |
| 4144 } | 4146 } |
| 4145 | 4147 |
| 4146 | 4148 |
| 4147 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, | 4149 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, |
| 4148 intptr_t buffer_len) { | 4150 intptr_t buffer_len) { |
| 4149 Isolate* isolate = Isolate::Current(); | 4151 Isolate* isolate = Isolate::Current(); |
| 4150 DARTSCOPE(isolate); | 4152 DARTSCOPE(isolate); |
| 4151 TIMERSCOPE(time_script_loading); | 4153 TIMERSCOPE(isolate, time_script_loading); |
| 4152 if (buffer == NULL) { | 4154 if (buffer == NULL) { |
| 4153 RETURN_NULL_ERROR(buffer); | 4155 RETURN_NULL_ERROR(buffer); |
| 4154 } | 4156 } |
| 4155 NoHeapGrowthControlScope no_growth_control; | 4157 NoHeapGrowthControlScope no_growth_control; |
| 4156 | 4158 |
| 4157 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 4159 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
| 4158 if (!snapshot->IsScriptSnapshot()) { | 4160 if (!snapshot->IsScriptSnapshot()) { |
| 4159 return Api::NewError("%s expects parameter 'buffer' to be a script type" | 4161 return Api::NewError("%s expects parameter 'buffer' to be a script type" |
| 4160 " snapshot.", CURRENT_FUNC); | 4162 " snapshot.", CURRENT_FUNC); |
| 4161 } | 4163 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4323 return Api::NewError("%s: library '%s' not found.", | 4325 return Api::NewError("%s: library '%s' not found.", |
| 4324 CURRENT_FUNC, url_str.ToCString()); | 4326 CURRENT_FUNC, url_str.ToCString()); |
| 4325 } else { | 4327 } else { |
| 4326 return Api::NewHandle(isolate, library.raw()); | 4328 return Api::NewHandle(isolate, library.raw()); |
| 4327 } | 4329 } |
| 4328 } | 4330 } |
| 4329 | 4331 |
| 4330 | 4332 |
| 4331 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, | 4333 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, |
| 4332 Dart_Handle source) { | 4334 Dart_Handle source) { |
| 4333 TIMERSCOPE(time_script_loading); | |
| 4334 Isolate* isolate = Isolate::Current(); | 4335 Isolate* isolate = Isolate::Current(); |
| 4336 TIMERSCOPE(isolate, time_script_loading); |
| 4335 DARTSCOPE(isolate); | 4337 DARTSCOPE(isolate); |
| 4336 const String& url_str = Api::UnwrapStringHandle(isolate, url); | 4338 const String& url_str = Api::UnwrapStringHandle(isolate, url); |
| 4337 if (url_str.IsNull()) { | 4339 if (url_str.IsNull()) { |
| 4338 RETURN_TYPE_ERROR(isolate, url, String); | 4340 RETURN_TYPE_ERROR(isolate, url, String); |
| 4339 } | 4341 } |
| 4340 const String& source_str = Api::UnwrapStringHandle(isolate, source); | 4342 const String& source_str = Api::UnwrapStringHandle(isolate, source); |
| 4341 if (source_str.IsNull()) { | 4343 if (source_str.IsNull()) { |
| 4342 RETURN_TYPE_ERROR(isolate, source, String); | 4344 RETURN_TYPE_ERROR(isolate, source, String); |
| 4343 } | 4345 } |
| 4344 CHECK_CALLBACK_STATE(isolate); | 4346 CHECK_CALLBACK_STATE(isolate); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4415 library_vm.AddObject(library_prefix, prefix_symbol); | 4417 library_vm.AddObject(library_prefix, prefix_symbol); |
| 4416 } | 4418 } |
| 4417 } | 4419 } |
| 4418 return Api::Success(); | 4420 return Api::Success(); |
| 4419 } | 4421 } |
| 4420 | 4422 |
| 4421 | 4423 |
| 4422 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, | 4424 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, |
| 4423 Dart_Handle url, | 4425 Dart_Handle url, |
| 4424 Dart_Handle source) { | 4426 Dart_Handle source) { |
| 4425 TIMERSCOPE(time_script_loading); | |
| 4426 Isolate* isolate = Isolate::Current(); | 4427 Isolate* isolate = Isolate::Current(); |
| 4428 TIMERSCOPE(isolate, time_script_loading); |
| 4427 DARTSCOPE(isolate); | 4429 DARTSCOPE(isolate); |
| 4428 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 4430 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
| 4429 if (lib.IsNull()) { | 4431 if (lib.IsNull()) { |
| 4430 RETURN_TYPE_ERROR(isolate, library, Library); | 4432 RETURN_TYPE_ERROR(isolate, library, Library); |
| 4431 } | 4433 } |
| 4432 const String& url_str = Api::UnwrapStringHandle(isolate, url); | 4434 const String& url_str = Api::UnwrapStringHandle(isolate, url); |
| 4433 if (url_str.IsNull()) { | 4435 if (url_str.IsNull()) { |
| 4434 RETURN_TYPE_ERROR(isolate, url, String); | 4436 RETURN_TYPE_ERROR(isolate, url, String); |
| 4435 } | 4437 } |
| 4436 const String& source_str = Api::UnwrapStringHandle(isolate, source); | 4438 const String& source_str = Api::UnwrapStringHandle(isolate, source); |
| 4437 if (source_str.IsNull()) { | 4439 if (source_str.IsNull()) { |
| 4438 RETURN_TYPE_ERROR(isolate, source, String); | 4440 RETURN_TYPE_ERROR(isolate, source, String); |
| 4439 } | 4441 } |
| 4440 CHECK_CALLBACK_STATE(isolate); | 4442 CHECK_CALLBACK_STATE(isolate); |
| 4441 | 4443 |
| 4442 NoHeapGrowthControlScope no_growth_control; | 4444 NoHeapGrowthControlScope no_growth_control; |
| 4443 | 4445 |
| 4444 const Script& script = Script::Handle( | 4446 const Script& script = Script::Handle( |
| 4445 isolate, Script::New(url_str, source_str, RawScript::kSourceTag)); | 4447 isolate, Script::New(url_str, source_str, RawScript::kSourceTag)); |
| 4446 Dart_Handle result; | 4448 Dart_Handle result; |
| 4447 CompileSource(isolate, lib, script, &result); | 4449 CompileSource(isolate, lib, script, &result); |
| 4448 return result; | 4450 return result; |
| 4449 } | 4451 } |
| 4450 | 4452 |
| 4451 | 4453 |
| 4452 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, | 4454 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, |
| 4453 Dart_Handle url, | 4455 Dart_Handle url, |
| 4454 Dart_Handle patch_source) { | 4456 Dart_Handle patch_source) { |
| 4455 TIMERSCOPE(time_script_loading); | |
| 4456 Isolate* isolate = Isolate::Current(); | 4457 Isolate* isolate = Isolate::Current(); |
| 4458 TIMERSCOPE(isolate, time_script_loading); |
| 4457 DARTSCOPE(isolate); | 4459 DARTSCOPE(isolate); |
| 4458 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 4460 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
| 4459 if (lib.IsNull()) { | 4461 if (lib.IsNull()) { |
| 4460 RETURN_TYPE_ERROR(isolate, library, Library); | 4462 RETURN_TYPE_ERROR(isolate, library, Library); |
| 4461 } | 4463 } |
| 4462 const String& url_str = Api::UnwrapStringHandle(isolate, url); | 4464 const String& url_str = Api::UnwrapStringHandle(isolate, url); |
| 4463 if (url_str.IsNull()) { | 4465 if (url_str.IsNull()) { |
| 4464 RETURN_TYPE_ERROR(isolate, url, String); | 4466 RETURN_TYPE_ERROR(isolate, url, String); |
| 4465 } | 4467 } |
| 4466 const String& source_str = Api::UnwrapStringHandle(isolate, patch_source); | 4468 const String& source_str = Api::UnwrapStringHandle(isolate, patch_source); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4534 } | 4536 } |
| 4535 | 4537 |
| 4536 | 4538 |
| 4537 // --- Service support --- | 4539 // --- Service support --- |
| 4538 | 4540 |
| 4539 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { | 4541 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { |
| 4540 return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); | 4542 return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); |
| 4541 } | 4543 } |
| 4542 | 4544 |
| 4543 } // namespace dart | 4545 } // namespace dart |
| OLD | NEW |