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

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

Issue 9316071: Dart_PropagateError, take 2. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 const char* cname, 392 const char* cname,
393 const Script& script, 393 const Script& script,
394 const Library& lib) { 394 const Library& lib) {
395 const String& name = String::Handle(String::NewSymbol(cname)); 395 const String& name = String::Handle(String::NewSymbol(cname));
396 cls.set_name(name); 396 cls.set_name(name);
397 cls.set_script(script); 397 cls.set_script(script);
398 lib.AddClass(cls); 398 lib.AddClass(cls);
399 } 399 }
400 400
401 401
402 void Object::Init(Isolate* isolate) { 402 RawError* Object::Init(Isolate* isolate) {
403 TIMERSCOPE(time_bootstrap); 403 TIMERSCOPE(time_bootstrap);
404 ObjectStore* object_store = isolate->object_store(); 404 ObjectStore* object_store = isolate->object_store();
405 405
406 Class& cls = Class::Handle(); 406 Class& cls = Class::Handle();
407 Type& type = Type::Handle(); 407 Type& type = Type::Handle();
408 Array& array = Array::Handle(); 408 Array& array = Array::Handle();
409 409
410 // All RawArray fields will be initialized to an empty array, therefore 410 // All RawArray fields will be initialized to an empty array, therefore
411 // initialize array class first. 411 // initialize array class first.
412 cls = Class::New<Array>(); 412 cls = Class::New<Array>();
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 bool_value = Bool::New(false); 638 bool_value = Bool::New(false);
639 object_store->set_false_value(bool_value); 639 object_store->set_false_value(bool_value);
640 640
641 // Setup some default native field classes which can be extended for 641 // Setup some default native field classes which can be extended for
642 // specifying native fields in dart classes. 642 // specifying native fields in dart classes.
643 Library::InitNativeWrappersLibrary(isolate); 643 Library::InitNativeWrappersLibrary(isolate);
644 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null()); 644 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null());
645 645
646 // Finish the initialization by compiling the bootstrap scripts containing the 646 // Finish the initialization by compiling the bootstrap scripts containing the
647 // base interfaces and the implementation of the internal classes. 647 // base interfaces and the implementation of the internal classes.
648 Bootstrap::Compile(core_lib, script); 648 Error& error = Error::Handle();
649 Bootstrap::Compile(core_impl_lib, impl_script); 649 error = Bootstrap::Compile(core_lib, script);
650 if (!error.IsNull()) {
651 return error.raw();
652 }
653 error = Bootstrap::Compile(core_impl_lib, impl_script);
654 if (!error.IsNull()) {
655 return error.raw();
656 }
650 657
651 Bootstrap::SetupNativeResolver(); 658 Bootstrap::SetupNativeResolver();
652 659
653 // Remove the Object superclass cycle by setting the super type to null (not 660 // Remove the Object superclass cycle by setting the super type to null (not
654 // to the type of null). 661 // to the type of null).
655 cls = object_store->object_class(); 662 cls = object_store->object_class();
656 cls.set_super_type(Type::Handle()); 663 cls.set_super_type(Type::Handle());
657 664
658 ClassFinalizer::VerifyBootstrapClasses(); 665 ClassFinalizer::VerifyBootstrapClasses();
666 return Error::null();
659 } 667 }
660 668
661 669
662 void Object::InitFromSnapshot(Isolate* isolate) { 670 void Object::InitFromSnapshot(Isolate* isolate) {
663 TIMERSCOPE(time_bootstrap); 671 TIMERSCOPE(time_bootstrap);
664 ObjectStore* object_store = isolate->object_store(); 672 ObjectStore* object_store = isolate->object_store();
665 673
666 Class& cls = Class::Handle(); 674 Class& cls = Class::Handle();
667 675
668 // Set up empty classes in the object store, these will get 676 // Set up empty classes in the object store, these will get
(...skipping 4017 matching lines...) Expand 10 before | Expand all | Expand 10 after
4686 ASSERT(value.IsSymbol()); 4694 ASSERT(value.IsSymbol());
4687 StorePointer(&raw_ptr()->name_, value.raw()); 4695 StorePointer(&raw_ptr()->name_, value.raw());
4688 } 4696 }
4689 4697
4690 4698
4691 void LibraryPrefix::set_library(const Library& value) const { 4699 void LibraryPrefix::set_library(const Library& value) const {
4692 StorePointer(&raw_ptr()->library_, value.raw()); 4700 StorePointer(&raw_ptr()->library_, value.raw());
4693 } 4701 }
4694 4702
4695 4703
4696 void Library::CompileAll() { 4704 RawError* Library::CompileAll() {
4705 Error& error = Error::Handle();
4697 Library& lib = Library::Handle( 4706 Library& lib = Library::Handle(
4698 Isolate::Current()->object_store()->registered_libraries()); 4707 Isolate::Current()->object_store()->registered_libraries());
4699 Class& cls = Class::Handle(); 4708 Class& cls = Class::Handle();
4700 while (!lib.IsNull()) { 4709 while (!lib.IsNull()) {
4701 ClassDictionaryIterator it(lib); 4710 ClassDictionaryIterator it(lib);
4702 while (it.HasNext()) { 4711 while (it.HasNext()) {
4703 cls ^= it.GetNextClass(); 4712 cls ^= it.GetNextClass();
4704 if (!cls.is_interface()) { 4713 if (!cls.is_interface()) {
4705 Compiler::CompileAllFunctions(cls); 4714 error = Compiler::CompileAllFunctions(cls);
4706 } 4715 }
4707 } 4716 }
4708 Array& anon_classes = Array::Handle(lib.raw_ptr()->anonymous_classes_); 4717 Array& anon_classes = Array::Handle(lib.raw_ptr()->anonymous_classes_);
4709 for (int i = 0; i < lib.raw_ptr()->num_anonymous_; i++) { 4718 for (int i = 0; i < lib.raw_ptr()->num_anonymous_; i++) {
4710 cls ^= anon_classes.At(i); 4719 cls ^= anon_classes.At(i);
4711 ASSERT(!cls.is_interface()); 4720 ASSERT(!cls.is_interface());
4712 Compiler::CompileAllFunctions(cls); 4721 error = Compiler::CompileAllFunctions(cls);
4713 } 4722 }
4714 lib = lib.next_registered(); 4723 lib = lib.next_registered();
4715 } 4724 }
4725 return error.raw();
4716 } 4726 }
4717 4727
4718 4728
4719 RawInstructions* Instructions::New(intptr_t size) { 4729 RawInstructions* Instructions::New(intptr_t size) {
4720 const Class& instructions_class = Class::Handle(Object::instructions_class()); 4730 const Class& instructions_class = Class::Handle(Object::instructions_class());
4721 Instructions& result = Instructions::Handle(); 4731 Instructions& result = Instructions::Handle();
4722 { 4732 {
4723 uword aligned_size = Instructions::InstanceSize(size); 4733 uword aligned_size = Instructions::InstanceSize(size);
4724 RawObject* raw = Object::Allocate(instructions_class, 4734 RawObject* raw = Object::Allocate(instructions_class,
4725 aligned_size, 4735 aligned_size,
(...skipping 3200 matching lines...) Expand 10 before | Expand all | Expand 10 after
7926 const String& str = String::Handle(pattern()); 7936 const String& str = String::Handle(pattern());
7927 const char* format = "JSRegExp: pattern=%s flags=%s"; 7937 const char* format = "JSRegExp: pattern=%s flags=%s";
7928 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 7938 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
7929 char* chars = reinterpret_cast<char*>( 7939 char* chars = reinterpret_cast<char*>(
7930 Isolate::Current()->current_zone()->Allocate(len + 1)); 7940 Isolate::Current()->current_zone()->Allocate(len + 1));
7931 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 7941 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
7932 return chars; 7942 return chars;
7933 } 7943 }
7934 7944
7935 } // namespace dart 7945 } // 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