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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 Error& error = Error::Handle(); | 917 Error& error = Error::Handle(); |
918 error = Bootstrap::Compile(core_lib, script); | 918 error = Bootstrap::Compile(core_lib, script); |
919 if (!error.IsNull()) { | 919 if (!error.IsNull()) { |
920 return error.raw(); | 920 return error.raw(); |
921 } | 921 } |
922 Script& patch_script = Script::Handle(Bootstrap::LoadCoreScript(true)); | 922 Script& patch_script = Script::Handle(Bootstrap::LoadCoreScript(true)); |
923 error = core_lib.Patch(patch_script); | 923 error = core_lib.Patch(patch_script); |
924 if (!error.IsNull()) { | 924 if (!error.IsNull()) { |
925 return error.raw(); | 925 return error.raw(); |
926 } | 926 } |
| 927 Library::InitASyncLibrary(isolate); |
| 928 const Script& async_script = |
| 929 Script::Handle(Bootstrap::LoadASyncScript(false)); |
| 930 const Library& async_lib = Library::Handle(Library::ASyncLibrary()); |
| 931 ASSERT(!async_lib.IsNull()); |
| 932 error = Bootstrap::Compile(async_lib, async_script); |
| 933 if (!error.IsNull()) { |
| 934 return error.raw(); |
| 935 } |
| 936 patch_script = Bootstrap::LoadASyncScript(true); |
| 937 error = async_lib.Patch(patch_script); |
| 938 if (!error.IsNull()) { |
| 939 return error.raw(); |
| 940 } |
927 const Script& collection_script = | 941 const Script& collection_script = |
928 Script::Handle(Bootstrap::LoadCollectionScript(false)); | 942 Script::Handle(Bootstrap::LoadCollectionScript(false)); |
929 const Library& collection_lib = | 943 const Library& collection_lib = |
930 Library::Handle(Library::CollectionLibrary()); | 944 Library::Handle(Library::CollectionLibrary()); |
931 ASSERT(!collection_lib.IsNull()); | 945 ASSERT(!collection_lib.IsNull()); |
932 error = Bootstrap::Compile(collection_lib, collection_script); | 946 error = Bootstrap::Compile(collection_lib, collection_script); |
933 if (!error.IsNull()) { | 947 if (!error.IsNull()) { |
934 return error.raw(); | 948 return error.raw(); |
935 } | 949 } |
936 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); | 950 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); |
(...skipping 5028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5965 } | 5979 } |
5966 return result.raw(); | 5980 return result.raw(); |
5967 } | 5981 } |
5968 | 5982 |
5969 | 5983 |
5970 RawLibrary* Library::New(const String& url) { | 5984 RawLibrary* Library::New(const String& url) { |
5971 return NewLibraryHelper(url, false); | 5985 return NewLibraryHelper(url, false); |
5972 } | 5986 } |
5973 | 5987 |
5974 | 5988 |
| 5989 void Library::InitASyncLibrary(Isolate* isolate) { |
| 5990 const String& url = String::Handle(Symbols::New("dart:async")); |
| 5991 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
| 5992 lib.Register(); |
| 5993 isolate->object_store()->set_async_library(lib); |
| 5994 } |
| 5995 |
| 5996 |
5975 void Library::InitCoreLibrary(Isolate* isolate) { | 5997 void Library::InitCoreLibrary(Isolate* isolate) { |
5976 const String& core_lib_url = String::Handle(Symbols::New("dart:core")); | 5998 const String& core_lib_url = String::Handle(Symbols::New("dart:core")); |
5977 const Library& core_lib = | 5999 const Library& core_lib = |
5978 Library::Handle(Library::NewLibraryHelper(core_lib_url, false)); | 6000 Library::Handle(Library::NewLibraryHelper(core_lib_url, false)); |
5979 core_lib.Register(); | 6001 core_lib.Register(); |
5980 isolate->object_store()->set_core_library(core_lib); | 6002 isolate->object_store()->set_core_library(core_lib); |
5981 Library::InitMathLibrary(isolate); | 6003 Library::InitMathLibrary(isolate); |
5982 const Library& math_lib = Library::Handle(Library::MathLibrary()); | 6004 const Library& math_lib = Library::Handle(Library::MathLibrary()); |
5983 const Namespace& math_ns = Namespace::Handle( | 6005 const Namespace& math_ns = Namespace::Handle( |
5984 Namespace::New(math_lib, Array::Handle(), Array::Handle())); | 6006 Namespace::New(math_lib, Array::Handle(), Array::Handle())); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6016 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | 6038 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
6017 lib.Register(); | 6039 lib.Register(); |
6018 isolate->object_store()->set_math_library(lib); | 6040 isolate->object_store()->set_math_library(lib); |
6019 } | 6041 } |
6020 | 6042 |
6021 | 6043 |
6022 void Library::InitIsolateLibrary(Isolate* isolate) { | 6044 void Library::InitIsolateLibrary(Isolate* isolate) { |
6023 const String& url = String::Handle(Symbols::New("dart:isolate")); | 6045 const String& url = String::Handle(Symbols::New("dart:isolate")); |
6024 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | 6046 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
6025 lib.Register(); | 6047 lib.Register(); |
| 6048 const Library& async_lib = Library::Handle(Library::ASyncLibrary()); |
| 6049 const Namespace& async_ns = Namespace::Handle( |
| 6050 Namespace::New(async_lib, Array::Handle(), Array::Handle())); |
| 6051 lib.AddImport(async_ns); |
6026 isolate->object_store()->set_isolate_library(lib); | 6052 isolate->object_store()->set_isolate_library(lib); |
6027 } | 6053 } |
6028 | 6054 |
6029 | 6055 |
6030 void Library::InitMirrorsLibrary(Isolate* isolate) { | 6056 void Library::InitMirrorsLibrary(Isolate* isolate) { |
6031 const String& url = String::Handle(Symbols::New("dart:mirrors")); | 6057 const String& url = String::Handle(Symbols::New("dart:mirrors")); |
6032 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | 6058 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
6033 lib.Register(); | 6059 lib.Register(); |
6034 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); | 6060 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
6035 const Namespace& isolate_ns = Namespace::Handle( | 6061 const Namespace& isolate_ns = Namespace::Handle( |
6036 Namespace::New(isolate_lib, Array::Handle(), Array::Handle())); | 6062 Namespace::New(isolate_lib, Array::Handle(), Array::Handle())); |
6037 lib.AddImport(isolate_ns); | 6063 lib.AddImport(isolate_ns); |
| 6064 const Library& async_lib = Library::Handle(Library::ASyncLibrary()); |
| 6065 const Namespace& async_ns = Namespace::Handle( |
| 6066 Namespace::New(async_lib, Array::Handle(), Array::Handle())); |
| 6067 lib.AddImport(async_ns); |
6038 const Library& wrappers_lib = | 6068 const Library& wrappers_lib = |
6039 Library::Handle(Library::NativeWrappersLibrary()); | 6069 Library::Handle(Library::NativeWrappersLibrary()); |
6040 const Namespace& wrappers_ns = Namespace::Handle( | 6070 const Namespace& wrappers_ns = Namespace::Handle( |
6041 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle())); | 6071 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle())); |
6042 lib.AddImport(wrappers_ns); | 6072 lib.AddImport(wrappers_ns); |
6043 isolate->object_store()->set_mirrors_library(lib); | 6073 isolate->object_store()->set_mirrors_library(lib); |
6044 } | 6074 } |
6045 | 6075 |
6046 | 6076 |
6047 void Library::InitScalarlistLibrary(Isolate* isolate) { | 6077 void Library::InitScalarlistLibrary(Isolate* isolate) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6153 ASSERT(Library::LookupLibrary(String::Handle(url())) == Library::null()); | 6183 ASSERT(Library::LookupLibrary(String::Handle(url())) == Library::null()); |
6154 ObjectStore* object_store = Isolate::Current()->object_store(); | 6184 ObjectStore* object_store = Isolate::Current()->object_store(); |
6155 GrowableObjectArray& libs = | 6185 GrowableObjectArray& libs = |
6156 GrowableObjectArray::Handle(object_store->libraries()); | 6186 GrowableObjectArray::Handle(object_store->libraries()); |
6157 ASSERT(!libs.IsNull()); | 6187 ASSERT(!libs.IsNull()); |
6158 set_index(libs.Length()); | 6188 set_index(libs.Length()); |
6159 libs.Add(*this); | 6189 libs.Add(*this); |
6160 } | 6190 } |
6161 | 6191 |
6162 | 6192 |
| 6193 RawLibrary* Library::ASyncLibrary() { |
| 6194 return Isolate::Current()->object_store()->async_library(); |
| 6195 } |
| 6196 |
| 6197 |
6163 RawLibrary* Library::CoreLibrary() { | 6198 RawLibrary* Library::CoreLibrary() { |
6164 return Isolate::Current()->object_store()->core_library(); | 6199 return Isolate::Current()->object_store()->core_library(); |
6165 } | 6200 } |
6166 | 6201 |
6167 | 6202 |
6168 RawLibrary* Library::CollectionLibrary() { | 6203 RawLibrary* Library::CollectionLibrary() { |
6169 return Isolate::Current()->object_store()->collection_library(); | 6204 return Isolate::Current()->object_store()->collection_library(); |
6170 } | 6205 } |
6171 | 6206 |
6172 | 6207 |
(...skipping 6211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12384 } | 12419 } |
12385 return result.raw(); | 12420 return result.raw(); |
12386 } | 12421 } |
12387 | 12422 |
12388 | 12423 |
12389 const char* WeakProperty::ToCString() const { | 12424 const char* WeakProperty::ToCString() const { |
12390 return "_WeakProperty"; | 12425 return "_WeakProperty"; |
12391 } | 12426 } |
12392 | 12427 |
12393 } // namespace dart | 12428 } // namespace dart |
OLD | NEW |