Chromium Code Reviews| 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 } | |
| 937 /* | |
| 938 patch_script = Bootstrap::LoadMathScript(true); | |
|
floitsch
2012/10/26 12:31:28
Remove commented code.
Anders Johnsen
2012/11/12 12:07:13
Done.
| |
| 939 error = math_lib.Patch(patch_script); | |
| 940 if (!error.IsNull()) { | |
| 941 return error.raw(); | |
| 942 } | |
| 943 */ | |
| 928 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); | 944 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); |
| 929 const Library& math_lib = Library::Handle(Library::MathLibrary()); | 945 const Library& math_lib = Library::Handle(Library::MathLibrary()); |
| 930 ASSERT(!math_lib.IsNull()); | 946 ASSERT(!math_lib.IsNull()); |
| 931 error = Bootstrap::Compile(math_lib, math_script); | 947 error = Bootstrap::Compile(math_lib, math_script); |
| 932 if (!error.IsNull()) { | 948 if (!error.IsNull()) { |
| 933 return error.raw(); | 949 return error.raw(); |
| 934 } | 950 } |
| 935 patch_script = Bootstrap::LoadMathScript(true); | 951 patch_script = Bootstrap::LoadMathScript(true); |
| 936 error = math_lib.Patch(patch_script); | 952 error = math_lib.Patch(patch_script); |
| 937 if (!error.IsNull()) { | 953 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); | 5950 isolate->object_store()->set_core_impl_library(core_impl_lib); |
| 5935 core_impl_lib.Register(); | 5951 core_impl_lib.Register(); |
| 5936 const Namespace& impl_ns = Namespace::Handle( | 5952 const Namespace& impl_ns = Namespace::Handle( |
| 5937 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); | 5953 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); |
| 5938 core_lib.AddImport(impl_ns); | 5954 core_lib.AddImport(impl_ns); |
| 5939 core_impl_lib.AddImport(core_ns); | 5955 core_impl_lib.AddImport(core_ns); |
| 5940 Library::InitMathLibrary(isolate); | 5956 Library::InitMathLibrary(isolate); |
| 5941 const Library& math_lib = Library::Handle(Library::MathLibrary()); | 5957 const Library& math_lib = Library::Handle(Library::MathLibrary()); |
| 5942 const Namespace& math_ns = Namespace::Handle( | 5958 const Namespace& math_ns = Namespace::Handle( |
| 5943 Namespace::New(math_lib, Array::Handle(), Array::Handle())); | 5959 Namespace::New(math_lib, Array::Handle(), Array::Handle())); |
| 5960 Library::InitCollectionLibrary(isolate); | |
| 5961 const Library& collection_lib = | |
| 5962 Library::Handle(Library::CollectionLibrary()); | |
| 5963 const Namespace& collection_ns = Namespace::Handle( | |
| 5964 Namespace::New(collection_lib, Array::Handle(), Array::Handle())); | |
| 5944 core_lib.AddImport(math_ns); | 5965 core_lib.AddImport(math_ns); |
| 5945 core_impl_lib.AddImport(math_ns); | 5966 core_impl_lib.AddImport(math_ns); |
| 5967 core_lib.AddImport(collection_ns); | |
| 5968 core_impl_lib.AddImport(collection_ns); | |
| 5946 isolate->object_store()->set_root_library(Library::Handle()); | 5969 isolate->object_store()->set_root_library(Library::Handle()); |
| 5947 | 5970 |
| 5948 // Hook up predefined classes without setting their library pointers. These | 5971 // Hook up predefined classes without setting their library pointers. These |
| 5949 // classes are coming from the VM isolate, and are shared between multiple | 5972 // classes are coming from the VM isolate, and are shared between multiple |
| 5950 // isolates so setting their library pointers would be wrong. | 5973 // isolates so setting their library pointers would be wrong. |
| 5951 const Class& cls = Class::Handle(Object::dynamic_class()); | 5974 const Class& cls = Class::Handle(Object::dynamic_class()); |
| 5952 core_lib.AddObject(cls, String::Handle(cls.Name())); | 5975 core_lib.AddObject(cls, String::Handle(cls.Name())); |
| 5953 } | 5976 } |
| 5954 | 5977 |
| 5955 | 5978 |
| 5979 void Library::InitCollectionLibrary(Isolate* isolate) { | |
| 5980 const String& url = String::Handle(Symbols::New("dart:collection")); | |
| 5981 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | |
| 5982 lib.Register(); | |
| 5983 const Library& math_lib = Library::Handle(Library::MathLibrary()); | |
| 5984 const Namespace& math_ns = Namespace::Handle( | |
| 5985 Namespace::New(math_lib, Array::Handle(), Array::Handle())); | |
| 5986 lib.AddImport(math_ns); | |
| 5987 isolate->object_store()->set_collection_library(lib); | |
| 5988 } | |
| 5989 | |
| 5990 | |
| 5956 void Library::InitMathLibrary(Isolate* isolate) { | 5991 void Library::InitMathLibrary(Isolate* isolate) { |
| 5957 const String& url = String::Handle(Symbols::New("dart:math")); | 5992 const String& url = String::Handle(Symbols::New("dart:math")); |
| 5958 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | 5993 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
| 5959 lib.Register(); | 5994 lib.Register(); |
| 5960 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); | 5995 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); |
| 5961 const Namespace& impl_ns = Namespace::Handle( | 5996 const Namespace& impl_ns = Namespace::Handle( |
| 5962 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); | 5997 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); |
| 5963 lib.AddImport(impl_ns); | 5998 lib.AddImport(impl_ns); |
| 5964 isolate->object_store()->set_math_library(lib); | 5999 isolate->object_store()->set_math_library(lib); |
| 5965 } | 6000 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 5987 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle())); | 6022 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle())); |
| 5988 lib.AddImport(wrappers_ns); | 6023 lib.AddImport(wrappers_ns); |
| 5989 isolate->object_store()->set_mirrors_library(lib); | 6024 isolate->object_store()->set_mirrors_library(lib); |
| 5990 } | 6025 } |
| 5991 | 6026 |
| 5992 | 6027 |
| 5993 void Library::InitScalarlistLibrary(Isolate* isolate) { | 6028 void Library::InitScalarlistLibrary(Isolate* isolate) { |
| 5994 const String& url = String::Handle(Symbols::New("dart:scalarlist")); | 6029 const String& url = String::Handle(Symbols::New("dart:scalarlist")); |
| 5995 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); | 6030 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
| 5996 lib.Register(); | 6031 lib.Register(); |
| 5997 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); | 6032 const Library& collection_lib = |
| 5998 const Namespace& impl_ns = Namespace::Handle( | 6033 Library::Handle(Library::CollectionLibrary()); |
| 5999 Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); | 6034 const Namespace& collection_ns = Namespace::Handle( |
| 6000 lib.AddImport(impl_ns); | 6035 Namespace::New(collection_lib, Array::Handle(), Array::Handle())); |
| 6036 lib.AddImport(collection_ns); | |
| 6001 isolate->object_store()->set_scalarlist_library(lib); | 6037 isolate->object_store()->set_scalarlist_library(lib); |
| 6002 } | 6038 } |
| 6003 | 6039 |
| 6004 | 6040 |
| 6005 void Library::InitNativeWrappersLibrary(Isolate* isolate) { | 6041 void Library::InitNativeWrappersLibrary(Isolate* isolate) { |
| 6006 static const int kNumNativeWrappersClasses = 4; | 6042 static const int kNumNativeWrappersClasses = 4; |
| 6007 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); | 6043 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); |
| 6008 const String& native_flds_lib_url = String::Handle( | 6044 const String& native_flds_lib_url = String::Handle( |
| 6009 Symbols::New("dart:nativewrappers")); | 6045 Symbols::New("dart:nativewrappers")); |
| 6010 const Library& native_flds_lib = Library::Handle( | 6046 const Library& native_flds_lib = Library::Handle( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6108 RawLibrary* Library::CoreLibrary() { | 6144 RawLibrary* Library::CoreLibrary() { |
| 6109 return Isolate::Current()->object_store()->core_library(); | 6145 return Isolate::Current()->object_store()->core_library(); |
| 6110 } | 6146 } |
| 6111 | 6147 |
| 6112 | 6148 |
| 6113 RawLibrary* Library::CoreImplLibrary() { | 6149 RawLibrary* Library::CoreImplLibrary() { |
| 6114 return Isolate::Current()->object_store()->core_impl_library(); | 6150 return Isolate::Current()->object_store()->core_impl_library(); |
| 6115 } | 6151 } |
| 6116 | 6152 |
| 6117 | 6153 |
| 6154 RawLibrary* Library::CollectionLibrary() { | |
| 6155 return Isolate::Current()->object_store()->collection_library(); | |
| 6156 } | |
| 6157 | |
| 6158 | |
| 6118 RawLibrary* Library::MathLibrary() { | 6159 RawLibrary* Library::MathLibrary() { |
| 6119 return Isolate::Current()->object_store()->math_library(); | 6160 return Isolate::Current()->object_store()->math_library(); |
| 6120 } | 6161 } |
| 6121 | 6162 |
| 6122 | 6163 |
| 6123 RawLibrary* Library::IsolateLibrary() { | 6164 RawLibrary* Library::IsolateLibrary() { |
| 6124 return Isolate::Current()->object_store()->isolate_library(); | 6165 return Isolate::Current()->object_store()->isolate_library(); |
| 6125 } | 6166 } |
| 6126 | 6167 |
| 6127 | 6168 |
| (...skipping 6096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12224 } | 12265 } |
| 12225 return result.raw(); | 12266 return result.raw(); |
| 12226 } | 12267 } |
| 12227 | 12268 |
| 12228 | 12269 |
| 12229 const char* WeakProperty::ToCString() const { | 12270 const char* WeakProperty::ToCString() const { |
| 12230 return "_WeakProperty"; | 12271 return "_WeakProperty"; |
| 12231 } | 12272 } |
| 12232 | 12273 |
| 12233 } // namespace dart | 12274 } // namespace dart |
| OLD | NEW |