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