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

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

Issue 9422019: isolates refactor: this change introduces 'dart:isolate' as a library. This is a (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 years, 9 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 | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('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 "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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 Error& error = Error::Handle(); 656 Error& error = Error::Handle();
657 error = Bootstrap::Compile(core_lib, script); 657 error = Bootstrap::Compile(core_lib, script);
658 if (!error.IsNull()) { 658 if (!error.IsNull()) {
659 return error.raw(); 659 return error.raw();
660 } 660 }
661 error = Bootstrap::Compile(core_impl_lib, impl_script); 661 error = Bootstrap::Compile(core_impl_lib, impl_script);
662 if (!error.IsNull()) { 662 if (!error.IsNull()) {
663 return error.raw(); 663 return error.raw();
664 } 664 }
665 665
666 const Script& isolate_script = Script::Handle(Bootstrap::LoadIsolateScript());
667 Library::InitIsolateLibrary(isolate);
668 Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
669 ASSERT(!isolate_lib.IsNull());
670 error = Bootstrap::Compile(isolate_lib, isolate_script);
671 if (!error.IsNull()) {
672 return error.raw();
673 }
674
666 Bootstrap::SetupNativeResolver(); 675 Bootstrap::SetupNativeResolver();
667 676
668 // Remove the Object superclass cycle by setting the super type to null (not 677 // Remove the Object superclass cycle by setting the super type to null (not
669 // to the type of null). 678 // to the type of null).
670 cls = object_store->object_class(); 679 cls = object_store->object_class();
671 cls.set_super_type(Type::Handle()); 680 cls.set_super_type(Type::Handle());
672 681
673 ClassFinalizer::VerifyBootstrapClasses(); 682 ClassFinalizer::VerifyBootstrapClasses();
674 return Error::null(); 683 return Error::null();
675 } 684 }
(...skipping 3944 matching lines...) Expand 10 before | Expand all | Expand 10 after
4620 const Library& core_impl_lib = 4629 const Library& core_impl_lib =
4621 Library::Handle(Library::NewLibraryHelper(core_impl_lib_url, false)); 4630 Library::Handle(Library::NewLibraryHelper(core_impl_lib_url, false));
4622 isolate->object_store()->set_core_impl_library(core_impl_lib); 4631 isolate->object_store()->set_core_impl_library(core_impl_lib);
4623 core_impl_lib.Register(); 4632 core_impl_lib.Register();
4624 core_lib.AddImport(core_impl_lib); 4633 core_lib.AddImport(core_impl_lib);
4625 core_impl_lib.AddImport(core_lib); 4634 core_impl_lib.AddImport(core_lib);
4626 isolate->object_store()->set_root_library(Library::Handle()); 4635 isolate->object_store()->set_root_library(Library::Handle());
4627 } 4636 }
4628 4637
4629 4638
4639 void Library::InitIsolateLibrary(Isolate* isolate) {
4640 const String& url = String::Handle(String::NewSymbol("dart:isolate"));
4641 const Library& lib = Library::Handle(Library::New(url));
4642 lib.Register();
4643 isolate->object_store()->set_isolate_library(lib);
4644 }
4645
4646
4630 void Library::InitNativeWrappersLibrary(Isolate* isolate) { 4647 void Library::InitNativeWrappersLibrary(Isolate* isolate) {
4631 static const int kNumNativeWrappersClasses = 4; 4648 static const int kNumNativeWrappersClasses = 4;
4632 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); 4649 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10);
4633 const String& native_flds_lib_url = String::Handle( 4650 const String& native_flds_lib_url = String::Handle(
4634 String::NewSymbol("dart:nativewrappers")); 4651 String::NewSymbol("dart:nativewrappers"));
4635 Library& native_flds_lib = Library::Handle( 4652 Library& native_flds_lib = Library::Handle(
4636 Library::NewLibraryHelper(native_flds_lib_url, false)); 4653 Library::NewLibraryHelper(native_flds_lib_url, false));
4637 native_flds_lib.Register(); 4654 native_flds_lib.Register();
4638 isolate->object_store()->set_native_wrappers_library(native_flds_lib); 4655 isolate->object_store()->set_native_wrappers_library(native_flds_lib);
4639 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass"; 4656 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass";
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
4727 RawLibrary* Library::CoreLibrary() { 4744 RawLibrary* Library::CoreLibrary() {
4728 return Isolate::Current()->object_store()->core_library(); 4745 return Isolate::Current()->object_store()->core_library();
4729 } 4746 }
4730 4747
4731 4748
4732 RawLibrary* Library::CoreImplLibrary() { 4749 RawLibrary* Library::CoreImplLibrary() {
4733 return Isolate::Current()->object_store()->core_impl_library(); 4750 return Isolate::Current()->object_store()->core_impl_library();
4734 } 4751 }
4735 4752
4736 4753
4754 RawLibrary* Library::IsolateLibrary() {
4755 return Isolate::Current()->object_store()->isolate_library();
4756 }
4757
4758
4737 RawLibrary* Library::NativeWrappersLibrary() { 4759 RawLibrary* Library::NativeWrappersLibrary() {
4738 return Isolate::Current()->object_store()->native_wrappers_library(); 4760 return Isolate::Current()->object_store()->native_wrappers_library();
4739 } 4761 }
4740 4762
4741 4763
4742 const char* Library::ToCString() const { 4764 const char* Library::ToCString() const {
4743 const char* kFormat = "Library:'%s'"; 4765 const char* kFormat = "Library:'%s'";
4744 const String& name = String::Handle(url()); 4766 const String& name = String::Handle(url());
4745 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; 4767 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1;
4746 char* chars = reinterpret_cast<char*>( 4768 char* chars = reinterpret_cast<char*>(
(...skipping 3556 matching lines...) Expand 10 before | Expand all | Expand 10 after
8303 result.set_num_args_tested(num_args_tested); 8325 result.set_num_args_tested(num_args_tested);
8304 // Number of array elements in one test entry (num_args_tested + 1) 8326 // Number of array elements in one test entry (num_args_tested + 1)
8305 intptr_t len = num_args_tested + 1; 8327 intptr_t len = num_args_tested + 1;
8306 // IC data array must be null terminated (sentinel entry). 8328 // IC data array must be null terminated (sentinel entry).
8307 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); 8329 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld));
8308 result.set_ic_data(ic_data); 8330 result.set_ic_data(ic_data);
8309 return result.raw(); 8331 return result.raw();
8310 } 8332 }
8311 8333
8312 } // namespace dart 8334 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698