Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: runtime/vm/object.cc

Issue 11959012: Add dart:collection_dev library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 } 961 }
962 const Script& collection_script = 962 const Script& collection_script =
963 Script::Handle(Bootstrap::LoadCollectionScript(false)); 963 Script::Handle(Bootstrap::LoadCollectionScript(false));
964 const Library& collection_lib = 964 const Library& collection_lib =
965 Library::Handle(Library::CollectionLibrary()); 965 Library::Handle(Library::CollectionLibrary());
966 ASSERT(!collection_lib.IsNull()); 966 ASSERT(!collection_lib.IsNull());
967 error = Bootstrap::Compile(collection_lib, collection_script); 967 error = Bootstrap::Compile(collection_lib, collection_script);
968 if (!error.IsNull()) { 968 if (!error.IsNull()) {
969 return error.raw(); 969 return error.raw();
970 } 970 }
971 const Script& collection_dev_script =
972 Script::Handle(Bootstrap::LoadCollectionDevScript(false));
973 const Library& collection_dev_lib =
974 Library::Handle(Library::CollectionDevLibrary());
975 ASSERT(!collection_dev_lib.IsNull());
976 error = Bootstrap::Compile(collection_dev_lib, collection_dev_script);
977 if (!error.IsNull()) {
978 return error.raw();
979 }
971 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); 980 const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false));
972 const Library& math_lib = Library::Handle(Library::MathLibrary()); 981 const Library& math_lib = Library::Handle(Library::MathLibrary());
973 ASSERT(!math_lib.IsNull()); 982 ASSERT(!math_lib.IsNull());
974 error = Bootstrap::Compile(math_lib, math_script); 983 error = Bootstrap::Compile(math_lib, math_script);
975 if (!error.IsNull()) { 984 if (!error.IsNull()) {
976 return error.raw(); 985 return error.raw();
977 } 986 }
978 patch_script = Bootstrap::LoadMathScript(true); 987 patch_script = Bootstrap::LoadMathScript(true);
979 error = math_lib.Patch(patch_script); 988 error = math_lib.Patch(patch_script);
980 if (!error.IsNull()) { 989 if (!error.IsNull()) {
(...skipping 5069 matching lines...) Expand 10 before | Expand all | Expand 10 after
6050 isolate->object_store()->set_core_library(core_lib); 6059 isolate->object_store()->set_core_library(core_lib);
6051 Library::InitMathLibrary(isolate); 6060 Library::InitMathLibrary(isolate);
6052 const Library& math_lib = Library::Handle(Library::MathLibrary()); 6061 const Library& math_lib = Library::Handle(Library::MathLibrary());
6053 const Namespace& math_ns = Namespace::Handle( 6062 const Namespace& math_ns = Namespace::Handle(
6054 Namespace::New(math_lib, Array::Handle(), Array::Handle())); 6063 Namespace::New(math_lib, Array::Handle(), Array::Handle()));
6055 Library::InitCollectionLibrary(isolate); 6064 Library::InitCollectionLibrary(isolate);
6056 const Library& collection_lib = 6065 const Library& collection_lib =
6057 Library::Handle(Library::CollectionLibrary()); 6066 Library::Handle(Library::CollectionLibrary());
6058 const Namespace& collection_ns = Namespace::Handle( 6067 const Namespace& collection_ns = Namespace::Handle(
6059 Namespace::New(collection_lib, Array::Handle(), Array::Handle())); 6068 Namespace::New(collection_lib, Array::Handle(), Array::Handle()));
6069 Library::InitCollectionDevLibrary(isolate);
6070 const Library& collection_dev_lib =
6071 Library::Handle(Library::CollectionDevLibrary());
6072 const Namespace& collection_dev_ns = Namespace::Handle(
6073 Namespace::New(collection_dev_lib, Array::Handle(), Array::Handle()));
6060 core_lib.AddImport(math_ns); 6074 core_lib.AddImport(math_ns);
6061 core_lib.AddImport(collection_ns); 6075 core_lib.AddImport(collection_ns);
6076 core_lib.AddImport(collection_dev_ns);
6062 isolate->object_store()->set_root_library(Library::Handle()); 6077 isolate->object_store()->set_root_library(Library::Handle());
6063 6078
6064 // Hook up predefined classes without setting their library pointers. These 6079 // Hook up predefined classes without setting their library pointers. These
6065 // classes are coming from the VM isolate, and are shared between multiple 6080 // classes are coming from the VM isolate, and are shared between multiple
6066 // isolates so setting their library pointers would be wrong. 6081 // isolates so setting their library pointers would be wrong.
6067 const Class& cls = Class::Handle(Object::dynamic_class()); 6082 const Class& cls = Class::Handle(Object::dynamic_class());
6068 core_lib.AddObject(cls, String::Handle(cls.Name())); 6083 core_lib.AddObject(cls, String::Handle(cls.Name()));
6069 } 6084 }
6070 6085
6071 6086
6072 void Library::InitCollectionLibrary(Isolate* isolate) { 6087 void Library::InitCollectionLibrary(Isolate* isolate) {
6073 const String& url = String::Handle(Symbols::New("dart:collection")); 6088 const String& url = String::Handle(Symbols::New("dart:collection"));
6074 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6089 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6075 lib.Register(); 6090 lib.Register();
6076 const Library& math_lib = Library::Handle(Library::MathLibrary()); 6091 const Library& math_lib = Library::Handle(Library::MathLibrary());
6077 const Namespace& math_ns = Namespace::Handle( 6092 const Namespace& math_ns = Namespace::Handle(
6078 Namespace::New(math_lib, Array::Handle(), Array::Handle())); 6093 Namespace::New(math_lib, Array::Handle(), Array::Handle()));
6079 lib.AddImport(math_ns); 6094 lib.AddImport(math_ns);
6080 isolate->object_store()->set_collection_library(lib); 6095 isolate->object_store()->set_collection_library(lib);
6081 } 6096 }
6082 6097
6083 6098
6099 void Library::InitCollectionDevLibrary(Isolate* isolate) {
6100 const String& url = String::Handle(Symbols::New("dart:collection_dev"));
6101 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6102 lib.Register();
6103 isolate->object_store()->set_collection_dev_library(lib);
6104 }
6105
6106
6084 void Library::InitMathLibrary(Isolate* isolate) { 6107 void Library::InitMathLibrary(Isolate* isolate) {
6085 const String& url = String::Handle(Symbols::New("dart:math")); 6108 const String& url = String::Handle(Symbols::New("dart:math"));
6086 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6109 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6087 lib.Register(); 6110 lib.Register();
6088 isolate->object_store()->set_math_library(lib); 6111 isolate->object_store()->set_math_library(lib);
6089 } 6112 }
6090 6113
6091 6114
6092 void Library::InitIsolateLibrary(Isolate* isolate) { 6115 void Library::InitIsolateLibrary(Isolate* isolate) {
6093 const String& url = String::Handle(Symbols::New("dart:isolate")); 6116 const String& url = String::Handle(Symbols::New("dart:isolate"));
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
6246 RawLibrary* Library::CoreLibrary() { 6269 RawLibrary* Library::CoreLibrary() {
6247 return Isolate::Current()->object_store()->core_library(); 6270 return Isolate::Current()->object_store()->core_library();
6248 } 6271 }
6249 6272
6250 6273
6251 RawLibrary* Library::CollectionLibrary() { 6274 RawLibrary* Library::CollectionLibrary() {
6252 return Isolate::Current()->object_store()->collection_library(); 6275 return Isolate::Current()->object_store()->collection_library();
6253 } 6276 }
6254 6277
6255 6278
6279 RawLibrary* Library::CollectionDevLibrary() {
6280 return Isolate::Current()->object_store()->collection_dev_library();
6281 }
6282
6283
6256 RawLibrary* Library::MathLibrary() { 6284 RawLibrary* Library::MathLibrary() {
6257 return Isolate::Current()->object_store()->math_library(); 6285 return Isolate::Current()->object_store()->math_library();
6258 } 6286 }
6259 6287
6260 6288
6261 RawLibrary* Library::IsolateLibrary() { 6289 RawLibrary* Library::IsolateLibrary() {
6262 return Isolate::Current()->object_store()->isolate_library(); 6290 return Isolate::Current()->object_store()->isolate_library();
6263 } 6291 }
6264 6292
6265 6293
(...skipping 6277 matching lines...) Expand 10 before | Expand all | Expand 10 after
12543 } 12571 }
12544 return result.raw(); 12572 return result.raw();
12545 } 12573 }
12546 12574
12547 12575
12548 const char* WeakProperty::ToCString() const { 12576 const char* WeakProperty::ToCString() const {
12549 return "_WeakProperty"; 12577 return "_WeakProperty";
12550 } 12578 }
12551 12579
12552 } // namespace dart 12580 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | sdk/lib/_internal/libraries.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698