| 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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 } | 918 } |
| 919 error = Bootstrap::Compile(core_impl_lib, impl_script); | 919 error = Bootstrap::Compile(core_impl_lib, impl_script); |
| 920 if (!error.IsNull()) { | 920 if (!error.IsNull()) { |
| 921 return error.raw(); | 921 return error.raw(); |
| 922 } | 922 } |
| 923 patch_script = Bootstrap::LoadCoreImplScript(true); | 923 patch_script = Bootstrap::LoadCoreImplScript(true); |
| 924 error = core_impl_lib.Patch(patch_script); | 924 error = core_impl_lib.Patch(patch_script); |
| 925 if (!error.IsNull()) { | 925 if (!error.IsNull()) { |
| 926 return error.raw(); | 926 return error.raw(); |
| 927 } | 927 } |
| 928 const Script& collection_script = |
| 929 Script::Handle(Bootstrap::LoadCollectionScript(false)); |
| 930 const Library& collection_lib = |
| 931 Library::Handle(Library::CollectionLibrary()); |
| 932 ASSERT(!collection_lib.IsNull()); |
| 933 error = Bootstrap::Compile(collection_lib, collection_script); |
| 934 if (!error.IsNull()) { |
| 935 return error.raw(); |
| 936 } |
| 928 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); | 937 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); |
| 929 const Library& math_lib = Library::Handle(Library::MathLibrary()); | 938 const Library& math_lib = Library::Handle(Library::MathLibrary()); |
| 930 ASSERT(!math_lib.IsNull()); | 939 ASSERT(!math_lib.IsNull()); |
| 931 error = Bootstrap::Compile(math_lib, math_script); | 940 error = Bootstrap::Compile(math_lib, math_script); |
| 932 if (!error.IsNull()) { | 941 if (!error.IsNull()) { |
| 933 return error.raw(); | 942 return error.raw(); |
| 934 } | 943 } |
| 935 patch_script = Bootstrap::LoadMathScript(true); | 944 patch_script = Bootstrap::LoadMathScript(true); |
| 936 error = math_lib.Patch(patch_script); | 945 error = math_lib.Patch(patch_script); |
| 937 if (!error.IsNull()) { | 946 if (!error.IsNull()) { |
| (...skipping 4996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5934 isolate->object_store()->set_core_impl_library(core_impl_lib); | 5943 isolate->object_store()->set_core_impl_library(core_impl_lib); |
| 5935 core_impl_lib.Register(); | 5944 core_impl_lib.Register(); |
| 5936 const Namespace& impl_ns = Namespace::Handle( | 5945 const Namespace& impl_ns = Namespace::Handle( |
| 5937 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); | 5946 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); |
| 5938 core_lib.AddImport(impl_ns); | 5947 core_lib.AddImport(impl_ns); |
| 5939 core_impl_lib.AddImport(core_ns); | 5948 core_impl_lib.AddImport(core_ns); |
| 5940 Library::InitMathLibrary(isolate); | 5949 Library::InitMathLibrary(isolate); |
| 5941 const Library& math_lib = Library::Handle(Library::MathLibrary()); | 5950 const Library& math_lib = Library::Handle(Library::MathLibrary()); |
| 5942 const Namespace& math_ns = Namespace::Handle( | 5951 const Namespace& math_ns = Namespace::Handle( |
| 5943 Namespace::New(math_lib, Array::Handle(), Array::Handle())); | 5952 Namespace::New(math_lib, Array::Handle(), Array::Handle())); |
| 5953 Library::InitCollectionLibrary(isolate); |
| 5954 const Library& collection_lib = |
| 5955 Library::Handle(Library::CollectionLibrary()); |
| 5956 const Namespace& collection_ns = Namespace::Handle( |
| 5957 Namespace::New(collection_lib, Array::Handle(), Array::Handle())); |
| 5944 core_lib.AddImport(math_ns); | 5958 core_lib.AddImport(math_ns); |
| 5945 core_impl_lib.AddImport(math_ns); | 5959 core_impl_lib.AddImport(math_ns); |
| 5960 core_lib.AddImport(collection_ns); |
| 5961 core_impl_lib.AddImport(collection_ns); |
| 5946 isolate->object_store()->set_root_library(Library::Handle()); | 5962 isolate->object_store()->set_root_library(Library::Handle()); |
| 5947 | 5963 |
| 5948 // Hook up predefined classes without setting their library pointers. These | 5964 // Hook up predefined classes without setting their library pointers. These |
| 5949 // classes are coming from the VM isolate, and are shared between multiple | 5965 // classes are coming from the VM isolate, and are shared between multiple |
| 5950 // isolates so setting their library pointers would be wrong. | 5966 // isolates so setting their library pointers would be wrong. |
| 5951 const Class& cls = Class::Handle(Object::dynamic_class()); | 5967 const Class& cls = Class::Handle(Object::dynamic_class()); |
| 5952 core_lib.AddObject(cls, String::Handle(cls.Name())); | 5968 core_lib.AddObject(cls, String::Handle(cls.Name())); |
| 5953 } | 5969 } |
| 5954 | 5970 |
| 5955 | 5971 |
| 5972 void Library::InitCollectionLibrary(Isolate* isolate) { |
| 5973 const String& url = String::Handle(Symbols::New("dart:collection")); |
| 5974 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
| 5975 lib.Register(); |
| 5976 const Library& math_lib = Library::Handle(Library::MathLibrary()); |
| 5977 const Namespace& math_ns = Namespace::Handle( |
| 5978 Namespace::New(math_lib, Array::Handle(), Array::Handle())); |
| 5979 lib.AddImport(math_ns); |
| 5980 isolate->object_store()->set_collection_library(lib); |
| 5981 } |
| 5982 |
| 5983 |
| 5956 void Library::InitMathLibrary(Isolate* isolate) { | 5984 void Library::InitMathLibrary(Isolate* isolate) { |
| 5957 const String& url = String::Handle(Symbols::New("dart:math")); | 5985 const String& url = String::Handle(Symbols::New("dart:math")); |
| 5958 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | 5986 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
| 5959 lib.Register(); | 5987 lib.Register(); |
| 5960 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); | 5988 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); |
| 5961 const Namespace& impl_ns = Namespace::Handle( | 5989 const Namespace& impl_ns = Namespace::Handle( |
| 5962 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); | 5990 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); |
| 5963 lib.AddImport(impl_ns); | 5991 lib.AddImport(impl_ns); |
| 5964 isolate->object_store()->set_math_library(lib); | 5992 isolate->object_store()->set_math_library(lib); |
| 5965 } | 5993 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5987 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle())); | 6015 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle())); |
| 5988 lib.AddImport(wrappers_ns); | 6016 lib.AddImport(wrappers_ns); |
| 5989 isolate->object_store()->set_mirrors_library(lib); | 6017 isolate->object_store()->set_mirrors_library(lib); |
| 5990 } | 6018 } |
| 5991 | 6019 |
| 5992 | 6020 |
| 5993 void Library::InitScalarlistLibrary(Isolate* isolate) { | 6021 void Library::InitScalarlistLibrary(Isolate* isolate) { |
| 5994 const String& url = String::Handle(Symbols::New("dart:scalarlist")); | 6022 const String& url = String::Handle(Symbols::New("dart:scalarlist")); |
| 5995 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | 6023 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
| 5996 lib.Register(); | 6024 lib.Register(); |
| 5997 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); | 6025 const Library& collection_lib = |
| 5998 const Namespace& impl_ns = Namespace::Handle( | 6026 Library::Handle(Library::CollectionLibrary()); |
| 5999 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); | 6027 const Namespace& collection_ns = Namespace::Handle( |
| 6000 lib.AddImport(impl_ns); | 6028 Namespace::New(collection_lib, Array::Handle(), Array::Handle())); |
| 6029 lib.AddImport(collection_ns); |
| 6001 isolate->object_store()->set_scalarlist_library(lib); | 6030 isolate->object_store()->set_scalarlist_library(lib); |
| 6002 } | 6031 } |
| 6003 | 6032 |
| 6004 | 6033 |
| 6005 void Library::InitNativeWrappersLibrary(Isolate* isolate) { | 6034 void Library::InitNativeWrappersLibrary(Isolate* isolate) { |
| 6006 static const int kNumNativeWrappersClasses = 4; | 6035 static const int kNumNativeWrappersClasses = 4; |
| 6007 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); | 6036 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); |
| 6008 const String& native_flds_lib_url = String::Handle( | 6037 const String& native_flds_lib_url = String::Handle( |
| 6009 Symbols::New("dart:nativewrappers")); | 6038 Symbols::New("dart:nativewrappers")); |
| 6010 const Library& native_flds_lib = Library::Handle( | 6039 const Library& native_flds_lib = Library::Handle( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6108 RawLibrary* Library::CoreLibrary() { | 6137 RawLibrary* Library::CoreLibrary() { |
| 6109 return Isolate::Current()->object_store()->core_library(); | 6138 return Isolate::Current()->object_store()->core_library(); |
| 6110 } | 6139 } |
| 6111 | 6140 |
| 6112 | 6141 |
| 6113 RawLibrary* Library::CoreImplLibrary() { | 6142 RawLibrary* Library::CoreImplLibrary() { |
| 6114 return Isolate::Current()->object_store()->core_impl_library(); | 6143 return Isolate::Current()->object_store()->core_impl_library(); |
| 6115 } | 6144 } |
| 6116 | 6145 |
| 6117 | 6146 |
| 6147 RawLibrary* Library::CollectionLibrary() { |
| 6148 return Isolate::Current()->object_store()->collection_library(); |
| 6149 } |
| 6150 |
| 6151 |
| 6118 RawLibrary* Library::MathLibrary() { | 6152 RawLibrary* Library::MathLibrary() { |
| 6119 return Isolate::Current()->object_store()->math_library(); | 6153 return Isolate::Current()->object_store()->math_library(); |
| 6120 } | 6154 } |
| 6121 | 6155 |
| 6122 | 6156 |
| 6123 RawLibrary* Library::IsolateLibrary() { | 6157 RawLibrary* Library::IsolateLibrary() { |
| 6124 return Isolate::Current()->object_store()->isolate_library(); | 6158 return Isolate::Current()->object_store()->isolate_library(); |
| 6125 } | 6159 } |
| 6126 | 6160 |
| 6127 | 6161 |
| (...skipping 6099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12227 } | 12261 } |
| 12228 return result.raw(); | 12262 return result.raw(); |
| 12229 } | 12263 } |
| 12230 | 12264 |
| 12231 | 12265 |
| 12232 const char* WeakProperty::ToCString() const { | 12266 const char* WeakProperty::ToCString() const { |
| 12233 return "_WeakProperty"; | 12267 return "_WeakProperty"; |
| 12234 } | 12268 } |
| 12235 | 12269 |
| 12236 } // namespace dart | 12270 } // namespace dart |
| OLD | NEW |