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

Side by Side Diff: vm/object.cc

Issue 12220027: - Add handling of private dart:_ libraries. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | vm/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6198 matching lines...) Expand 10 before | Expand all | Expand 10 after
6209 return result.raw(); 6209 return result.raw();
6210 } 6210 }
6211 6211
6212 6212
6213 RawLibrary* Library::New(const String& url) { 6213 RawLibrary* Library::New(const String& url) {
6214 return NewLibraryHelper(url, false); 6214 return NewLibraryHelper(url, false);
6215 } 6215 }
6216 6216
6217 6217
6218 void Library::InitASyncLibrary(Isolate* isolate) { 6218 void Library::InitASyncLibrary(Isolate* isolate) {
6219 const String& url = String::Handle(Symbols::New("dart:async")); 6219 const String& url = Symbols::DartAsync();
6220 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6220 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6221 lib.Register(); 6221 lib.Register();
6222 isolate->object_store()->set_async_library(lib); 6222 isolate->object_store()->set_async_library(lib);
6223 } 6223 }
6224 6224
6225 6225
6226 void Library::InitCoreLibrary(Isolate* isolate) { 6226 void Library::InitCoreLibrary(Isolate* isolate) {
6227 const String& core_lib_url = String::Handle(Symbols::New("dart:core")); 6227 const String& core_lib_url = Symbols::DartCore();
6228 const Library& core_lib = 6228 const Library& core_lib =
6229 Library::Handle(Library::NewLibraryHelper(core_lib_url, false)); 6229 Library::Handle(Library::NewLibraryHelper(core_lib_url, false));
6230 core_lib.Register(); 6230 core_lib.Register();
6231 isolate->object_store()->set_core_library(core_lib); 6231 isolate->object_store()->set_core_library(core_lib);
6232 Library::InitMathLibrary(isolate); 6232 Library::InitMathLibrary(isolate);
6233 const Library& math_lib = Library::Handle(Library::MathLibrary()); 6233 const Library& math_lib = Library::Handle(Library::MathLibrary());
6234 const Namespace& math_ns = Namespace::Handle( 6234 const Namespace& math_ns = Namespace::Handle(
6235 Namespace::New(math_lib, Array::Handle(), Array::Handle())); 6235 Namespace::New(math_lib, Array::Handle(), Array::Handle()));
6236 Library::InitCollectionDevLibrary(isolate); 6236 Library::InitCollectionDevLibrary(isolate);
6237 const Library& collection_dev_lib = 6237 const Library& collection_dev_lib =
(...skipping 12 matching lines...) Expand all
6250 6250
6251 // Hook up predefined classes without setting their library pointers. These 6251 // Hook up predefined classes without setting their library pointers. These
6252 // classes are coming from the VM isolate, and are shared between multiple 6252 // classes are coming from the VM isolate, and are shared between multiple
6253 // isolates so setting their library pointers would be wrong. 6253 // isolates so setting their library pointers would be wrong.
6254 const Class& cls = Class::Handle(Object::dynamic_class()); 6254 const Class& cls = Class::Handle(Object::dynamic_class());
6255 core_lib.AddObject(cls, String::Handle(cls.Name())); 6255 core_lib.AddObject(cls, String::Handle(cls.Name()));
6256 } 6256 }
6257 6257
6258 6258
6259 void Library::InitCollectionLibrary(Isolate* isolate) { 6259 void Library::InitCollectionLibrary(Isolate* isolate) {
6260 const String& url = String::Handle(Symbols::New("dart:collection")); 6260 const String& url = Symbols::DartCollection();
6261 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6261 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6262 lib.Register(); 6262 lib.Register();
6263 const Library& math_lib = Library::Handle(Library::MathLibrary()); 6263 const Library& math_lib = Library::Handle(Library::MathLibrary());
6264 const Namespace& math_ns = Namespace::Handle( 6264 const Namespace& math_ns = Namespace::Handle(
6265 Namespace::New(math_lib, Array::Handle(), Array::Handle())); 6265 Namespace::New(math_lib, Array::Handle(), Array::Handle()));
6266 const Library& collection_dev_lib = 6266 const Library& collection_dev_lib =
6267 Library::Handle(Library::CollectionDevLibrary()); 6267 Library::Handle(Library::CollectionDevLibrary());
6268 const Namespace& collection_dev_ns = Namespace::Handle( 6268 const Namespace& collection_dev_ns = Namespace::Handle(
6269 Namespace::New(collection_dev_lib, Array::Handle(), Array::Handle())); 6269 Namespace::New(collection_dev_lib, Array::Handle(), Array::Handle()));
6270 lib.AddImport(math_ns); 6270 lib.AddImport(math_ns);
6271 lib.AddImport(collection_dev_ns); 6271 lib.AddImport(collection_dev_ns);
6272 isolate->object_store()->set_collection_library(lib); 6272 isolate->object_store()->set_collection_library(lib);
6273 } 6273 }
6274 6274
6275 6275
6276 void Library::InitCollectionDevLibrary(Isolate* isolate) { 6276 void Library::InitCollectionDevLibrary(Isolate* isolate) {
6277 const String& url = String::Handle(Symbols::New("dart:collection-dev")); 6277 const String& url = Symbols::DartCollectionDev();
6278 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6278 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6279 lib.Register(); 6279 lib.Register();
6280 isolate->object_store()->set_collection_dev_library(lib); 6280 isolate->object_store()->set_collection_dev_library(lib);
6281 } 6281 }
6282 6282
6283 6283
6284 void Library::InitMathLibrary(Isolate* isolate) { 6284 void Library::InitMathLibrary(Isolate* isolate) {
6285 const String& url = String::Handle(Symbols::New("dart:math")); 6285 const String& url = Symbols::DartMath();
6286 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6286 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6287 lib.Register(); 6287 lib.Register();
6288 isolate->object_store()->set_math_library(lib); 6288 isolate->object_store()->set_math_library(lib);
6289 } 6289 }
6290 6290
6291 6291
6292 void Library::InitIsolateLibrary(Isolate* isolate) { 6292 void Library::InitIsolateLibrary(Isolate* isolate) {
6293 const String& url = String::Handle(Symbols::New("dart:isolate")); 6293 const String& url = Symbols::DartIsolate();
6294 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6294 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6295 lib.Register(); 6295 lib.Register();
6296 const Library& async_lib = Library::Handle(Library::ASyncLibrary()); 6296 const Library& async_lib = Library::Handle(Library::ASyncLibrary());
6297 const Namespace& async_ns = Namespace::Handle( 6297 const Namespace& async_ns = Namespace::Handle(
6298 Namespace::New(async_lib, Array::Handle(), Array::Handle())); 6298 Namespace::New(async_lib, Array::Handle(), Array::Handle()));
6299 lib.AddImport(async_ns); 6299 lib.AddImport(async_ns);
6300 isolate->object_store()->set_isolate_library(lib); 6300 isolate->object_store()->set_isolate_library(lib);
6301 } 6301 }
6302 6302
6303 6303
6304 void Library::InitMirrorsLibrary(Isolate* isolate) { 6304 void Library::InitMirrorsLibrary(Isolate* isolate) {
6305 const String& url = String::Handle(Symbols::New("dart:mirrors")); 6305 const String& url = Symbols::DartMirrors();
6306 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6306 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6307 lib.Register(); 6307 lib.Register();
6308 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); 6308 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
6309 const Namespace& isolate_ns = Namespace::Handle( 6309 const Namespace& isolate_ns = Namespace::Handle(
6310 Namespace::New(isolate_lib, Array::Handle(), Array::Handle())); 6310 Namespace::New(isolate_lib, Array::Handle(), Array::Handle()));
6311 lib.AddImport(isolate_ns); 6311 lib.AddImport(isolate_ns);
6312 const Library& async_lib = Library::Handle(Library::ASyncLibrary()); 6312 const Library& async_lib = Library::Handle(Library::ASyncLibrary());
6313 const Namespace& async_ns = Namespace::Handle( 6313 const Namespace& async_ns = Namespace::Handle(
6314 Namespace::New(async_lib, Array::Handle(), Array::Handle())); 6314 Namespace::New(async_lib, Array::Handle(), Array::Handle()));
6315 lib.AddImport(async_ns); 6315 lib.AddImport(async_ns);
6316 const Library& wrappers_lib = 6316 const Library& wrappers_lib =
6317 Library::Handle(Library::NativeWrappersLibrary()); 6317 Library::Handle(Library::NativeWrappersLibrary());
6318 const Namespace& wrappers_ns = Namespace::Handle( 6318 const Namespace& wrappers_ns = Namespace::Handle(
6319 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle())); 6319 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle()));
6320 lib.AddImport(wrappers_ns); 6320 lib.AddImport(wrappers_ns);
6321 isolate->object_store()->set_mirrors_library(lib); 6321 isolate->object_store()->set_mirrors_library(lib);
6322 } 6322 }
6323 6323
6324 6324
6325 void Library::InitScalarlistLibrary(Isolate* isolate) { 6325 void Library::InitScalarlistLibrary(Isolate* isolate) {
6326 const String& url = String::Handle(Symbols::New("dart:scalarlist")); 6326 const String& url = Symbols::DartScalarlist();
6327 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6327 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6328 lib.Register(); 6328 lib.Register();
6329 const Library& collection_lib = 6329 const Library& collection_lib =
6330 Library::Handle(Library::CollectionLibrary()); 6330 Library::Handle(Library::CollectionLibrary());
6331 const Namespace& collection_ns = Namespace::Handle( 6331 const Namespace& collection_ns = Namespace::Handle(
6332 Namespace::New(collection_lib, Array::Handle(), Array::Handle())); 6332 Namespace::New(collection_lib, Array::Handle(), Array::Handle()));
6333 lib.AddImport(collection_ns); 6333 lib.AddImport(collection_ns);
6334 isolate->object_store()->set_scalarlist_library(lib); 6334 isolate->object_store()->set_scalarlist_library(lib);
6335 } 6335 }
6336 6336
6337 6337
6338 void Library::InitNativeWrappersLibrary(Isolate* isolate) { 6338 void Library::InitNativeWrappersLibrary(Isolate* isolate) {
6339 static const int kNumNativeWrappersClasses = 4; 6339 static const int kNumNativeWrappersClasses = 4;
6340 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); 6340 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10);
6341 const String& native_flds_lib_url = String::Handle( 6341 const String& native_flds_lib_url = Symbols::DartNativeWrappers();
6342 Symbols::New("dart:nativewrappers"));
6343 const Library& native_flds_lib = Library::Handle( 6342 const Library& native_flds_lib = Library::Handle(
6344 Library::NewLibraryHelper(native_flds_lib_url, false)); 6343 Library::NewLibraryHelper(native_flds_lib_url, false));
6345 native_flds_lib.Register(); 6344 native_flds_lib.Register();
6346 isolate->object_store()->set_native_wrappers_library(native_flds_lib); 6345 isolate->object_store()->set_native_wrappers_library(native_flds_lib);
6347 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass"; 6346 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass";
6348 static const int kNameLength = 25; 6347 static const int kNameLength = 25;
6349 ASSERT(kNameLength == (strlen(kNativeWrappersClass) + 1 + 1)); 6348 ASSERT(kNameLength == (strlen(kNativeWrappersClass) + 1 + 1));
6350 char name_buffer[kNameLength]; 6349 char name_buffer[kNameLength];
6351 String& cls_name = String::Handle(); 6350 String& cls_name = String::Handle();
6352 for (int fld_cnt = 1; fld_cnt <= kNumNativeWrappersClasses; fld_cnt++) { 6351 for (int fld_cnt = 1; fld_cnt <= kNumNativeWrappersClasses; fld_cnt++) {
(...skipping 6444 matching lines...) Expand 10 before | Expand all | Expand 10 after
12797 } 12796 }
12798 return result.raw(); 12797 return result.raw();
12799 } 12798 }
12800 12799
12801 12800
12802 const char* WeakProperty::ToCString() const { 12801 const char* WeakProperty::ToCString() const {
12803 return "_WeakProperty"; 12802 return "_WeakProperty";
12804 } 12803 }
12805 12804
12806 } // namespace dart 12805 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698