| 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 "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 // base interfaces and the implementation of the internal classes. | 665 // base interfaces and the implementation of the internal classes. |
| 666 Error& error = Error::Handle(); | 666 Error& error = Error::Handle(); |
| 667 error = Bootstrap::Compile(core_lib, script); | 667 error = Bootstrap::Compile(core_lib, script); |
| 668 if (!error.IsNull()) { | 668 if (!error.IsNull()) { |
| 669 return error.raw(); | 669 return error.raw(); |
| 670 } | 670 } |
| 671 error = Bootstrap::Compile(core_impl_lib, impl_script); | 671 error = Bootstrap::Compile(core_impl_lib, impl_script); |
| 672 if (!error.IsNull()) { | 672 if (!error.IsNull()) { |
| 673 return error.raw(); | 673 return error.raw(); |
| 674 } | 674 } |
| 675 | |
| 676 const Script& isolate_script = Script::Handle(Bootstrap::LoadIsolateScript()); | 675 const Script& isolate_script = Script::Handle(Bootstrap::LoadIsolateScript()); |
| 677 Library::InitIsolateLibrary(isolate); | 676 Library::InitIsolateLibrary(isolate); |
| 678 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); | 677 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
| 679 ASSERT(!isolate_lib.IsNull()); | 678 ASSERT(!isolate_lib.IsNull()); |
| 680 error = Bootstrap::Compile(isolate_lib, isolate_script); | 679 error = Bootstrap::Compile(isolate_lib, isolate_script); |
| 681 if (!error.IsNull()) { | 680 if (!error.IsNull()) { |
| 682 return error.raw(); | 681 return error.raw(); |
| 683 } | 682 } |
| 684 | 683 const Script& mirrors_script = Script::Handle(Bootstrap::LoadMirrorsScript()); |
| 684 Library::InitMirrorsLibrary(isolate); |
| 685 Library& mirrors_lib = Library::Handle(Library::MirrorsLibrary()); |
| 686 ASSERT(!mirrors_lib.IsNull()); |
| 687 error = Bootstrap::Compile(mirrors_lib, mirrors_script); |
| 688 if (!error.IsNull()) { |
| 689 return error.raw(); |
| 690 } |
| 685 Bootstrap::SetupNativeResolver(); | 691 Bootstrap::SetupNativeResolver(); |
| 686 | 692 |
| 687 // Remove the Object superclass cycle by setting the super type to null (not | 693 // Remove the Object superclass cycle by setting the super type to null (not |
| 688 // to the type of null). | 694 // to the type of null). |
| 689 cls = object_store->object_class(); | 695 cls = object_store->object_class(); |
| 690 cls.set_super_type(Type::Handle()); | 696 cls.set_super_type(Type::Handle()); |
| 691 | 697 |
| 692 ClassFinalizer::VerifyBootstrapClasses(); | 698 ClassFinalizer::VerifyBootstrapClasses(); |
| 693 return Error::null(); | 699 return Error::null(); |
| 694 } | 700 } |
| (...skipping 4179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4874 | 4880 |
| 4875 | 4881 |
| 4876 void Library::InitIsolateLibrary(Isolate* isolate) { | 4882 void Library::InitIsolateLibrary(Isolate* isolate) { |
| 4877 const String& url = String::Handle(String::NewSymbol("dart:isolate")); | 4883 const String& url = String::Handle(String::NewSymbol("dart:isolate")); |
| 4878 const Library& lib = Library::Handle(Library::New(url)); | 4884 const Library& lib = Library::Handle(Library::New(url)); |
| 4879 lib.Register(); | 4885 lib.Register(); |
| 4880 isolate->object_store()->set_isolate_library(lib); | 4886 isolate->object_store()->set_isolate_library(lib); |
| 4881 } | 4887 } |
| 4882 | 4888 |
| 4883 | 4889 |
| 4890 void Library::InitMirrorsLibrary(Isolate* isolate) { |
| 4891 const String& url = String::Handle(String::NewSymbol("dart:mirrors")); |
| 4892 const Library& lib = Library::Handle(Library::New(url)); |
| 4893 lib.Register(); |
| 4894 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
| 4895 lib.AddImport(isolate_lib); |
| 4896 isolate->object_store()->set_mirrors_library(lib); |
| 4897 } |
| 4898 |
| 4899 |
| 4884 void Library::InitNativeWrappersLibrary(Isolate* isolate) { | 4900 void Library::InitNativeWrappersLibrary(Isolate* isolate) { |
| 4885 static const int kNumNativeWrappersClasses = 4; | 4901 static const int kNumNativeWrappersClasses = 4; |
| 4886 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); | 4902 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); |
| 4887 const String& native_flds_lib_url = String::Handle( | 4903 const String& native_flds_lib_url = String::Handle( |
| 4888 String::NewSymbol("dart:nativewrappers")); | 4904 String::NewSymbol("dart:nativewrappers")); |
| 4889 Library& native_flds_lib = Library::Handle( | 4905 Library& native_flds_lib = Library::Handle( |
| 4890 Library::NewLibraryHelper(native_flds_lib_url, false)); | 4906 Library::NewLibraryHelper(native_flds_lib_url, false)); |
| 4891 native_flds_lib.Register(); | 4907 native_flds_lib.Register(); |
| 4892 isolate->object_store()->set_native_wrappers_library(native_flds_lib); | 4908 isolate->object_store()->set_native_wrappers_library(native_flds_lib); |
| 4893 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass"; | 4909 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass"; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4986 RawLibrary* Library::CoreImplLibrary() { | 5002 RawLibrary* Library::CoreImplLibrary() { |
| 4987 return Isolate::Current()->object_store()->core_impl_library(); | 5003 return Isolate::Current()->object_store()->core_impl_library(); |
| 4988 } | 5004 } |
| 4989 | 5005 |
| 4990 | 5006 |
| 4991 RawLibrary* Library::IsolateLibrary() { | 5007 RawLibrary* Library::IsolateLibrary() { |
| 4992 return Isolate::Current()->object_store()->isolate_library(); | 5008 return Isolate::Current()->object_store()->isolate_library(); |
| 4993 } | 5009 } |
| 4994 | 5010 |
| 4995 | 5011 |
| 5012 RawLibrary* Library::MirrorsLibrary() { |
| 5013 return Isolate::Current()->object_store()->mirrors_library(); |
| 5014 } |
| 5015 |
| 5016 |
| 4996 RawLibrary* Library::NativeWrappersLibrary() { | 5017 RawLibrary* Library::NativeWrappersLibrary() { |
| 4997 return Isolate::Current()->object_store()->native_wrappers_library(); | 5018 return Isolate::Current()->object_store()->native_wrappers_library(); |
| 4998 } | 5019 } |
| 4999 | 5020 |
| 5000 | 5021 |
| 5001 const char* Library::ToCString() const { | 5022 const char* Library::ToCString() const { |
| 5002 const char* kFormat = "Library:'%s'"; | 5023 const char* kFormat = "Library:'%s'"; |
| 5003 const String& name = String::Handle(url()); | 5024 const String& name = String::Handle(url()); |
| 5004 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; | 5025 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; |
| 5005 char* chars = reinterpret_cast<char*>( | 5026 char* chars = reinterpret_cast<char*>( |
| (...skipping 3598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8604 result.set_num_args_tested(num_args_tested); | 8625 result.set_num_args_tested(num_args_tested); |
| 8605 // Number of array elements in one test entry (num_args_tested + 1) | 8626 // Number of array elements in one test entry (num_args_tested + 1) |
| 8606 intptr_t len = result.TestEntryLength(); | 8627 intptr_t len = result.TestEntryLength(); |
| 8607 // IC data array must be null terminated (sentinel entry). | 8628 // IC data array must be null terminated (sentinel entry). |
| 8608 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); | 8629 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); |
| 8609 result.set_ic_data(ic_data); | 8630 result.set_ic_data(ic_data); |
| 8610 return result.raw(); | 8631 return result.raw(); |
| 8611 } | 8632 } |
| 8612 | 8633 |
| 8613 } // namespace dart | 8634 } // namespace dart |
| OLD | NEW |