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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 } | 948 } |
949 const Script& collection_script = | 949 const Script& collection_script = |
950 Script::Handle(Bootstrap::LoadCollectionScript(false)); | 950 Script::Handle(Bootstrap::LoadCollectionScript(false)); |
951 const Library& collection_lib = | 951 const Library& collection_lib = |
952 Library::Handle(Library::CollectionLibrary()); | 952 Library::Handle(Library::CollectionLibrary()); |
953 ASSERT(!collection_lib.IsNull()); | 953 ASSERT(!collection_lib.IsNull()); |
954 error = Bootstrap::Compile(collection_lib, collection_script); | 954 error = Bootstrap::Compile(collection_lib, collection_script); |
955 if (!error.IsNull()) { | 955 if (!error.IsNull()) { |
956 return error.raw(); | 956 return error.raw(); |
957 } | 957 } |
958 const Script& collection_dev_script = | |
959 Script::Handle(Bootstrap::LoadCollectionDevScript(false)); | |
960 const Library& collection_dev_lib = | |
961 Library::Handle(Library::CollectionDevLibrary()); | |
962 ASSERT(!collection_dev_lib.IsNull()); | |
963 error = Bootstrap::Compile(collection_dev_lib, collection_dev_script); | |
964 if (!error.IsNull()) { | |
965 return error.raw(); | |
966 } | |
967 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); | 958 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); |
968 const Library& math_lib = Library::Handle(Library::MathLibrary()); | 959 const Library& math_lib = Library::Handle(Library::MathLibrary()); |
969 ASSERT(!math_lib.IsNull()); | 960 ASSERT(!math_lib.IsNull()); |
970 error = Bootstrap::Compile(math_lib, math_script); | 961 error = Bootstrap::Compile(math_lib, math_script); |
971 if (!error.IsNull()) { | 962 if (!error.IsNull()) { |
972 return error.raw(); | 963 return error.raw(); |
973 } | 964 } |
974 patch_script = Bootstrap::LoadMathScript(true); | 965 patch_script = Bootstrap::LoadMathScript(true); |
975 error = math_lib.Patch(patch_script); | 966 error = math_lib.Patch(patch_script); |
976 if (!error.IsNull()) { | 967 if (!error.IsNull()) { |
(...skipping 5174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6151 isolate->object_store()->set_core_library(core_lib); | 6142 isolate->object_store()->set_core_library(core_lib); |
6152 Library::InitMathLibrary(isolate); | 6143 Library::InitMathLibrary(isolate); |
6153 const Library& math_lib = Library::Handle(Library::MathLibrary()); | 6144 const Library& math_lib = Library::Handle(Library::MathLibrary()); |
6154 const Namespace& math_ns = Namespace::Handle( | 6145 const Namespace& math_ns = Namespace::Handle( |
6155 Namespace::New(math_lib, Array::Handle(), Array::Handle())); | 6146 Namespace::New(math_lib, Array::Handle(), Array::Handle())); |
6156 Library::InitCollectionLibrary(isolate); | 6147 Library::InitCollectionLibrary(isolate); |
6157 const Library& collection_lib = | 6148 const Library& collection_lib = |
6158 Library::Handle(Library::CollectionLibrary()); | 6149 Library::Handle(Library::CollectionLibrary()); |
6159 const Namespace& collection_ns = Namespace::Handle( | 6150 const Namespace& collection_ns = Namespace::Handle( |
6160 Namespace::New(collection_lib, Array::Handle(), Array::Handle())); | 6151 Namespace::New(collection_lib, Array::Handle(), Array::Handle())); |
6161 Library::InitCollectionDevLibrary(isolate); | |
6162 const Library& collection_dev_lib = | |
6163 Library::Handle(Library::CollectionDevLibrary()); | |
6164 const Namespace& collection_dev_ns = Namespace::Handle( | |
6165 Namespace::New(collection_dev_lib, Array::Handle(), Array::Handle())); | |
6166 core_lib.AddImport(math_ns); | 6152 core_lib.AddImport(math_ns); |
6167 core_lib.AddImport(collection_ns); | 6153 core_lib.AddImport(collection_ns); |
6168 core_lib.AddImport(collection_dev_ns); | |
6169 isolate->object_store()->set_root_library(Library::Handle()); | 6154 isolate->object_store()->set_root_library(Library::Handle()); |
6170 | 6155 |
6171 // Hook up predefined classes without setting their library pointers. These | 6156 // Hook up predefined classes without setting their library pointers. These |
6172 // classes are coming from the VM isolate, and are shared between multiple | 6157 // classes are coming from the VM isolate, and are shared between multiple |
6173 // isolates so setting their library pointers would be wrong. | 6158 // isolates so setting their library pointers would be wrong. |
6174 const Class& cls = Class::Handle(Object::dynamic_class()); | 6159 const Class& cls = Class::Handle(Object::dynamic_class()); |
6175 core_lib.AddObject(cls, String::Handle(cls.Name())); | 6160 core_lib.AddObject(cls, String::Handle(cls.Name())); |
6176 } | 6161 } |
6177 | 6162 |
6178 | 6163 |
6179 void Library::InitCollectionLibrary(Isolate* isolate) { | 6164 void Library::InitCollectionLibrary(Isolate* isolate) { |
6180 const String& url = String::Handle(Symbols::New("dart:collection")); | 6165 const String& url = String::Handle(Symbols::New("dart:collection")); |
6181 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | 6166 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
6182 lib.Register(); | 6167 lib.Register(); |
6183 const Library& math_lib = Library::Handle(Library::MathLibrary()); | 6168 const Library& math_lib = Library::Handle(Library::MathLibrary()); |
6184 const Namespace& math_ns = Namespace::Handle( | 6169 const Namespace& math_ns = Namespace::Handle( |
6185 Namespace::New(math_lib, Array::Handle(), Array::Handle())); | 6170 Namespace::New(math_lib, Array::Handle(), Array::Handle())); |
6186 lib.AddImport(math_ns); | 6171 lib.AddImport(math_ns); |
6187 isolate->object_store()->set_collection_library(lib); | 6172 isolate->object_store()->set_collection_library(lib); |
6188 } | 6173 } |
6189 | 6174 |
6190 | 6175 |
6191 void Library::InitCollectionDevLibrary(Isolate* isolate) { | |
6192 const String& url = String::Handle(Symbols::New("dart:collection-dev")); | |
6193 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | |
6194 lib.Register(); | |
6195 isolate->object_store()->set_collection_dev_library(lib); | |
6196 } | |
6197 | |
6198 | |
6199 void Library::InitMathLibrary(Isolate* isolate) { | 6176 void Library::InitMathLibrary(Isolate* isolate) { |
6200 const String& url = String::Handle(Symbols::New("dart:math")); | 6177 const String& url = String::Handle(Symbols::New("dart:math")); |
6201 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | 6178 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
6202 lib.Register(); | 6179 lib.Register(); |
6203 isolate->object_store()->set_math_library(lib); | 6180 isolate->object_store()->set_math_library(lib); |
6204 } | 6181 } |
6205 | 6182 |
6206 | 6183 |
6207 void Library::InitIsolateLibrary(Isolate* isolate) { | 6184 void Library::InitIsolateLibrary(Isolate* isolate) { |
6208 const String& url = String::Handle(Symbols::New("dart:isolate")); | 6185 const String& url = String::Handle(Symbols::New("dart:isolate")); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6377 RawLibrary* Library::CoreLibrary() { | 6354 RawLibrary* Library::CoreLibrary() { |
6378 return Isolate::Current()->object_store()->core_library(); | 6355 return Isolate::Current()->object_store()->core_library(); |
6379 } | 6356 } |
6380 | 6357 |
6381 | 6358 |
6382 RawLibrary* Library::CollectionLibrary() { | 6359 RawLibrary* Library::CollectionLibrary() { |
6383 return Isolate::Current()->object_store()->collection_library(); | 6360 return Isolate::Current()->object_store()->collection_library(); |
6384 } | 6361 } |
6385 | 6362 |
6386 | 6363 |
6387 RawLibrary* Library::CollectionDevLibrary() { | |
6388 return Isolate::Current()->object_store()->collection_dev_library(); | |
6389 } | |
6390 | |
6391 | |
6392 RawLibrary* Library::MathLibrary() { | 6364 RawLibrary* Library::MathLibrary() { |
6393 return Isolate::Current()->object_store()->math_library(); | 6365 return Isolate::Current()->object_store()->math_library(); |
6394 } | 6366 } |
6395 | 6367 |
6396 | 6368 |
6397 RawLibrary* Library::IsolateLibrary() { | 6369 RawLibrary* Library::IsolateLibrary() { |
6398 return Isolate::Current()->object_store()->isolate_library(); | 6370 return Isolate::Current()->object_store()->isolate_library(); |
6399 } | 6371 } |
6400 | 6372 |
6401 | 6373 |
(...skipping 6274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12676 } | 12648 } |
12677 return result.raw(); | 12649 return result.raw(); |
12678 } | 12650 } |
12679 | 12651 |
12680 | 12652 |
12681 const char* WeakProperty::ToCString() const { | 12653 const char* WeakProperty::ToCString() const { |
12682 return "_WeakProperty"; | 12654 return "_WeakProperty"; |
12683 } | 12655 } |
12684 | 12656 |
12685 } // namespace dart | 12657 } // namespace dart |
OLD | NEW |