OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 | 5 |
6 #include "bin/loader.h" | 6 #include "bin/loader.h" |
7 | 7 |
8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
9 #include "bin/dartutils.h" | 9 #include "bin/dartutils.h" |
10 #include "bin/dfe.h" | 10 #include "bin/dfe.h" |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, | 643 Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, |
644 Dart_Handle library, | 644 Dart_Handle library, |
645 Dart_Handle url) { | 645 Dart_Handle url) { |
646 if (tag == Dart_kCanonicalizeUrl) { | 646 if (tag == Dart_kCanonicalizeUrl) { |
647 Dart_Handle library_url = Dart_LibraryUrl(library); | 647 Dart_Handle library_url = Dart_LibraryUrl(library); |
648 if (Dart_IsError(library_url)) { | 648 if (Dart_IsError(library_url)) { |
649 return library_url; | 649 return library_url; |
650 } | 650 } |
651 return Dart_DefaultCanonicalizeUrl(library_url, url); | 651 return Dart_DefaultCanonicalizeUrl(library_url, url); |
652 } | 652 } |
653 if (dfe.UseDartFrontend()) { | |
654 Dart_Isolate current = Dart_CurrentIsolate(); | |
655 if (!Dart_IsServiceIsolate(current) && !Dart_IsKernelIsolate(current)) { | |
656 // When using DFE the library tag handler should be called only when we | |
657 // are reloading scripts. | |
658 ASSERT(tag == Dart_kScriptTag); | |
659 return dfe.ReloadScript(current, url); | |
660 } | |
661 // TODO(asiva) We need to ensure that the kernel and service isolates | |
662 // are always loaded from a kernel IR and do not use this path. | |
663 } | |
664 const char* url_string = NULL; | 653 const char* url_string = NULL; |
665 Dart_Handle result = Dart_StringToCString(url, &url_string); | 654 Dart_Handle result = Dart_StringToCString(url, &url_string); |
666 if (Dart_IsError(result)) { | 655 if (Dart_IsError(result)) { |
667 return result; | 656 return result; |
668 } | 657 } |
669 | 658 if (tag == Dart_kScriptTag) { |
670 // Special case for handling dart: imports and parts. | 659 if (dfe.UseDartFrontend()) { |
671 if (tag != Dart_kScriptTag) { | 660 Dart_Isolate current = Dart_CurrentIsolate(); |
| 661 // Check if we are trying to reload a kernel file or if the '--dfe' |
| 662 // option was specified and we need to compile sources using DFE. |
| 663 if (!Dart_IsServiceIsolate(current) && !Dart_IsKernelIsolate(current)) { |
| 664 // When using DFE the library tag handler should be called only when |
| 665 // we are reloading scripts. |
| 666 return dfe.ReloadScript(current, url_string); |
| 667 } |
| 668 } |
| 669 // TODO(asiva) We need to ensure that the kernel and service isolates |
| 670 // are always loaded from a kernel IR and do not use this path. |
| 671 } else { |
| 672 // Special case for handling dart: imports and parts. |
672 // Grab the library's url. | 673 // Grab the library's url. |
673 Dart_Handle library_url = Dart_LibraryUrl(library); | 674 Dart_Handle library_url = Dart_LibraryUrl(library); |
674 if (Dart_IsError(library_url)) { | 675 if (Dart_IsError(library_url)) { |
675 return library_url; | 676 return library_url; |
676 } | 677 } |
677 const char* library_url_string = NULL; | 678 const char* library_url_string = NULL; |
678 result = Dart_StringToCString(library_url, &library_url_string); | 679 result = Dart_StringToCString(library_url, &library_url_string); |
679 if (Dart_IsError(result)) { | 680 if (Dart_IsError(result)) { |
680 return result; | 681 return result; |
681 } | 682 } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 MutexLocker ml(loader_infos_lock_); | 925 MutexLocker ml(loader_infos_lock_); |
925 Loader* loader = LoaderForLocked(dest_port_id); | 926 Loader* loader = LoaderForLocked(dest_port_id); |
926 if (loader == NULL) { | 927 if (loader == NULL) { |
927 return; | 928 return; |
928 } | 929 } |
929 loader->QueueMessage(message); | 930 loader->QueueMessage(message); |
930 } | 931 } |
931 | 932 |
932 } // namespace bin | 933 } // namespace bin |
933 } // namespace dart | 934 } // namespace dart |
OLD | NEW |