| 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/class_finalizer.h" | 5 #include "vm/class_finalizer.h" |
| 6 | 6 |
| 7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // b) after the user classes are loaded (dart_api). | 35 // b) after the user classes are loaded (dart_api). |
| 36 bool ClassFinalizer::FinalizePendingClasses() { | 36 bool ClassFinalizer::FinalizePendingClasses() { |
| 37 bool retval = true; | 37 bool retval = true; |
| 38 Isolate* isolate = Isolate::Current(); | 38 Isolate* isolate = Isolate::Current(); |
| 39 ASSERT(isolate != NULL); | 39 ASSERT(isolate != NULL); |
| 40 ObjectStore* object_store = isolate->object_store(); | 40 ObjectStore* object_store = isolate->object_store(); |
| 41 const Error& error = Error::Handle(object_store->sticky_error()); | 41 const Error& error = Error::Handle(object_store->sticky_error()); |
| 42 if (!error.IsNull()) { | 42 if (!error.IsNull()) { |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 GrowableObjectArray& class_array = GrowableObjectArray::Handle(); | 45 if (AllClassesFinalized()) { |
| 46 class_array = object_store->pending_classes(); | |
| 47 ASSERT(!class_array.IsNull()); | |
| 48 if (class_array.Length() == 0) { | |
| 49 return true; | 46 return true; |
| 50 } | 47 } |
| 51 LongJump* base = isolate->long_jump_base(); | 48 LongJump* base = isolate->long_jump_base(); |
| 52 LongJump jump; | 49 LongJump jump; |
| 53 isolate->set_long_jump_base(&jump); | 50 isolate->set_long_jump_base(&jump); |
| 54 if (setjmp(*jump.Set()) == 0) { | 51 if (setjmp(*jump.Set()) == 0) { |
| 52 GrowableObjectArray& class_array = GrowableObjectArray::Handle(); |
| 53 class_array = object_store->pending_classes(); |
| 54 ASSERT(!class_array.IsNull()); |
| 55 Class& cls = Class::Handle(); | 55 Class& cls = Class::Handle(); |
| 56 // First resolve all superclasses. | 56 // First resolve all superclasses. |
| 57 for (intptr_t i = 0; i < class_array.Length(); i++) { | 57 for (intptr_t i = 0; i < class_array.Length(); i++) { |
| 58 cls ^= class_array.At(i); | 58 cls ^= class_array.At(i); |
| 59 if (FLAG_trace_class_finalization) { | 59 if (FLAG_trace_class_finalization) { |
| 60 OS::Print("Resolving super and default: %s\n", cls.ToCString()); | 60 OS::Print("Resolving super and default: %s\n", cls.ToCString()); |
| 61 } | 61 } |
| 62 ResolveSuperType(cls); | 62 ResolveSuperType(cls); |
| 63 if (cls.is_interface()) { | 63 if (cls.is_interface()) { |
| 64 ResolveFactoryClass(cls); | 64 ResolveFactoryClass(cls); |
| (...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 void ClassFinalizer::ReportError(const char* format, ...) { | 1404 void ClassFinalizer::ReportError(const char* format, ...) { |
| 1405 va_list args; | 1405 va_list args; |
| 1406 va_start(args, format); | 1406 va_start(args, format); |
| 1407 const Error& error = Error::Handle( | 1407 const Error& error = Error::Handle( |
| 1408 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); | 1408 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); |
| 1409 va_end(args); | 1409 va_end(args); |
| 1410 ReportError(error); | 1410 ReportError(error); |
| 1411 } | 1411 } |
| 1412 | 1412 |
| 1413 } // namespace dart | 1413 } // namespace dart |
| OLD | NEW |