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 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 | 6 |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 lib.SetLoadError(); | 2200 lib.SetLoadError(); |
2201 } | 2201 } |
2202 } | 2202 } |
2203 isolate->set_long_jump_base(base); | 2203 isolate->set_long_jump_base(base); |
2204 } | 2204 } |
2205 | 2205 |
2206 | 2206 |
2207 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, | 2207 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, |
2208 Dart_Handle source, | 2208 Dart_Handle source, |
2209 Dart_LibraryTagHandler handler) { | 2209 Dart_LibraryTagHandler handler) { |
| 2210 TIMERSCOPE(time_script_loading); |
2210 Isolate* isolate = Isolate::Current(); | 2211 Isolate* isolate = Isolate::Current(); |
2211 DARTSCOPE(isolate); | 2212 DARTSCOPE(isolate); |
2212 TIMERSCOPE(time_script_loading); | |
2213 const String& url_str = Api::UnwrapStringHandle(url); | 2213 const String& url_str = Api::UnwrapStringHandle(url); |
2214 if (url_str.IsNull()) { | 2214 if (url_str.IsNull()) { |
2215 RETURN_TYPE_ERROR(url, String); | 2215 RETURN_TYPE_ERROR(url, String); |
2216 } | 2216 } |
2217 const String& source_str = Api::UnwrapStringHandle(source); | 2217 const String& source_str = Api::UnwrapStringHandle(source); |
2218 if (source_str.IsNull()) { | 2218 if (source_str.IsNull()) { |
2219 RETURN_TYPE_ERROR(source, String); | 2219 RETURN_TYPE_ERROR(source, String); |
2220 } | 2220 } |
2221 Library& library = Library::Handle(isolate->object_store()->root_library()); | 2221 Library& library = Library::Handle(isolate->object_store()->root_library()); |
2222 if (!library.IsNull()) { | 2222 if (!library.IsNull()) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2350 if (library.IsNull()) { | 2350 if (library.IsNull()) { |
2351 return Api::NewError("%s: library '%s' not found.", | 2351 return Api::NewError("%s: library '%s' not found.", |
2352 CURRENT_FUNC, url_str.ToCString()); | 2352 CURRENT_FUNC, url_str.ToCString()); |
2353 } else { | 2353 } else { |
2354 return Api::NewLocalHandle(library); | 2354 return Api::NewLocalHandle(library); |
2355 } | 2355 } |
2356 } | 2356 } |
2357 | 2357 |
2358 | 2358 |
2359 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, Dart_Handle source) { | 2359 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, Dart_Handle source) { |
| 2360 TIMERSCOPE(time_script_loading); |
2360 Isolate* isolate = Isolate::Current(); | 2361 Isolate* isolate = Isolate::Current(); |
2361 DARTSCOPE(isolate); | 2362 DARTSCOPE(isolate); |
2362 const String& url_str = Api::UnwrapStringHandle(url); | 2363 const String& url_str = Api::UnwrapStringHandle(url); |
2363 if (url_str.IsNull()) { | 2364 if (url_str.IsNull()) { |
2364 RETURN_TYPE_ERROR(url, String); | 2365 RETURN_TYPE_ERROR(url, String); |
2365 } | 2366 } |
2366 const String& source_str = Api::UnwrapStringHandle(source); | 2367 const String& source_str = Api::UnwrapStringHandle(source); |
2367 if (source_str.IsNull()) { | 2368 if (source_str.IsNull()) { |
2368 RETURN_TYPE_ERROR(source, String); | 2369 RETURN_TYPE_ERROR(source, String); |
2369 } | 2370 } |
(...skipping 30 matching lines...) Expand all Loading... |
2400 RETURN_TYPE_ERROR(import, Library); | 2401 RETURN_TYPE_ERROR(import, Library); |
2401 } | 2402 } |
2402 library_vm.AddImport(import_vm); | 2403 library_vm.AddImport(import_vm); |
2403 return Api::Success(); | 2404 return Api::Success(); |
2404 } | 2405 } |
2405 | 2406 |
2406 | 2407 |
2407 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, | 2408 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, |
2408 Dart_Handle url, | 2409 Dart_Handle url, |
2409 Dart_Handle source) { | 2410 Dart_Handle source) { |
| 2411 TIMERSCOPE(time_script_loading); |
2410 Isolate* isolate = Isolate::Current(); | 2412 Isolate* isolate = Isolate::Current(); |
2411 DARTSCOPE(isolate); | 2413 DARTSCOPE(isolate); |
2412 const Library& lib = Api::UnwrapLibraryHandle(library); | 2414 const Library& lib = Api::UnwrapLibraryHandle(library); |
2413 if (lib.IsNull()) { | 2415 if (lib.IsNull()) { |
2414 RETURN_TYPE_ERROR(library, Library); | 2416 RETURN_TYPE_ERROR(library, Library); |
2415 } | 2417 } |
2416 const String& url_str = Api::UnwrapStringHandle(url); | 2418 const String& url_str = Api::UnwrapStringHandle(url); |
2417 if (url_str.IsNull()) { | 2419 if (url_str.IsNull()) { |
2418 RETURN_TYPE_ERROR(url, String); | 2420 RETURN_TYPE_ERROR(url, String); |
2419 } | 2421 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 } | 2467 } |
2466 delete debug_region; | 2468 delete debug_region; |
2467 } else { | 2469 } else { |
2468 *buffer = NULL; | 2470 *buffer = NULL; |
2469 *buffer_size = 0; | 2471 *buffer_size = 0; |
2470 } | 2472 } |
2471 } | 2473 } |
2472 | 2474 |
2473 | 2475 |
2474 } // namespace dart | 2476 } // namespace dart |
OLD | NEW |