| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "vm/bootstrap.h" | 5 #include "vm/bootstrap.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/bootstrap_natives.h" | 9 #include "vm/bootstrap_natives.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| 11 #include "vm/dart_api_impl.h" | 11 #include "vm/dart_api_impl.h" |
| 12 #include "vm/object.h" | 12 #include "vm/object.h" |
| 13 #include "vm/object_store.h" | 13 #include "vm/object_store.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 DEFINE_FLAG(bool, print_bootstrap, false, "Print the bootstrap source."); | 17 DEFINE_FLAG(bool, print_bootstrap, false, "Print the bootstrap source."); |
| 18 | 18 |
| 19 | 19 |
| 20 RawScript* Bootstrap::LoadScript(const char* url, | 20 RawScript* Bootstrap::LoadScript(const char* url, |
| 21 const char* source, | 21 const char* source, |
| 22 bool patch) { | 22 bool patch) { |
| 23 return Script::New(String::Handle(String::New(url, Heap::kOld)), | 23 return Script::New(String::Handle(String::New(url, Heap::kOld)), |
| 24 String::Handle(String::New(source, Heap::kOld)), | 24 String::Handle(String::New(source, Heap::kOld)), |
| 25 patch ? RawScript::kPatchTag : RawScript::kSourceTag); | 25 patch ? RawScript::kPatchTag : RawScript::kSourceTag); |
| 26 } | 26 } |
| 27 | 27 |
| 28 | 28 |
| 29 RawScript* Bootstrap::LoadASyncScript(bool patch) { |
| 30 const char* url = patch ? "dart:async-patch" : "dart:async"; |
| 31 const char* source = patch ? async_patch_ : async_source_; |
| 32 return LoadScript(url, source, patch); |
| 33 } |
| 34 |
| 35 |
| 29 RawScript* Bootstrap::LoadCoreScript(bool patch) { | 36 RawScript* Bootstrap::LoadCoreScript(bool patch) { |
| 30 // TODO(iposva): Use proper library name. | 37 // TODO(iposva): Use proper library name. |
| 31 const char* url = patch ? "dart:core-patch" : "bootstrap"; | 38 const char* url = patch ? "dart:core-patch" : "bootstrap"; |
| 32 const char* source = patch ? corelib_patch_ : corelib_source_; | 39 const char* source = patch ? corelib_patch_ : corelib_source_; |
| 33 return LoadScript(url, source, patch); | 40 return LoadScript(url, source, patch); |
| 34 } | 41 } |
| 35 | 42 |
| 36 | 43 |
| 37 RawScript* Bootstrap::LoadCollectionScript(bool patch) { | 44 RawScript* Bootstrap::LoadCollectionScript(bool patch) { |
| 38 const char* url = patch ? "dart:collection-patch" : "dart:collection"; | 45 const char* url = patch ? "dart:collection-patch" : "dart:collection"; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const Error& error = Error::Handle(Compiler::Compile(library, script)); | 86 const Error& error = Error::Handle(Compiler::Compile(library, script)); |
| 80 if (error.IsNull()) { | 87 if (error.IsNull()) { |
| 81 library.SetLoaded(); | 88 library.SetLoaded(); |
| 82 } else { | 89 } else { |
| 83 library.SetLoadError(); | 90 library.SetLoadError(); |
| 84 } | 91 } |
| 85 return error.raw(); | 92 return error.raw(); |
| 86 } | 93 } |
| 87 | 94 |
| 88 } // namespace dart | 95 } // namespace dart |
| OLD | NEW |