| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/code_generator.h" | 7 #include "vm/code_generator.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 | 95 |
| 96 // Processing ObjectStore::pending_classes_ occurs: | 96 // Processing ObjectStore::pending_classes_ occurs: |
| 97 // a) when bootstrap process completes (VerifyBootstrapClasses). | 97 // a) when bootstrap process completes (VerifyBootstrapClasses). |
| 98 // b) after the user classes are loaded (dart_api). | 98 // b) after the user classes are loaded (dart_api). |
| 99 bool ClassFinalizer::ProcessPendingClasses() { | 99 bool ClassFinalizer::ProcessPendingClasses() { |
| 100 bool retval = true; | |
| 101 Isolate* isolate = Isolate::Current(); | 100 Isolate* isolate = Isolate::Current(); |
| 102 ASSERT(isolate != NULL); | 101 ASSERT(isolate != NULL); |
| 103 HANDLESCOPE(isolate); | 102 HANDLESCOPE(isolate); |
| 104 ObjectStore* object_store = isolate->object_store(); | 103 ObjectStore* object_store = isolate->object_store(); |
| 105 const Error& error = Error::Handle(isolate, object_store->sticky_error()); | 104 const Error& error = Error::Handle(isolate, object_store->sticky_error()); |
| 106 if (!error.IsNull()) { | 105 if (!error.IsNull()) { |
| 107 return false; | 106 return false; |
| 108 } | 107 } |
| 109 if (AllClassesFinalized()) { | 108 if (AllClassesFinalized()) { |
| 110 return true; | 109 return true; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 130 if (FLAG_print_classes) { | 129 if (FLAG_print_classes) { |
| 131 for (intptr_t i = 0; i < class_array.Length(); i++) { | 130 for (intptr_t i = 0; i < class_array.Length(); i++) { |
| 132 cls ^= class_array.At(i); | 131 cls ^= class_array.At(i); |
| 133 PrintClassInformation(cls); | 132 PrintClassInformation(cls); |
| 134 } | 133 } |
| 135 } | 134 } |
| 136 // Clear pending classes array. | 135 // Clear pending classes array. |
| 137 class_array = GrowableObjectArray::New(); | 136 class_array = GrowableObjectArray::New(); |
| 138 object_store->set_pending_classes(class_array); | 137 object_store->set_pending_classes(class_array); |
| 139 VerifyImplicitFieldOffsets(); // Verification after an error may fail. | 138 VerifyImplicitFieldOffsets(); // Verification after an error may fail. |
| 139 |
| 140 return true; |
| 140 } else { | 141 } else { |
| 141 retval = false; | 142 return false; |
| 142 } | 143 } |
| 143 return retval; | 144 UNREACHABLE(); |
| 145 return true; |
| 144 } | 146 } |
| 145 | 147 |
| 146 | 148 |
| 147 // Adds all interfaces of cls into 'collected'. Duplicate entries may occur. | 149 // Adds all interfaces of cls into 'collected'. Duplicate entries may occur. |
| 148 // No cycles are allowed. | 150 // No cycles are allowed. |
| 149 void ClassFinalizer::CollectInterfaces(const Class& cls, | 151 void ClassFinalizer::CollectInterfaces(const Class& cls, |
| 150 const GrowableObjectArray& collected) { | 152 const GrowableObjectArray& collected) { |
| 151 const Array& interface_array = Array::Handle(cls.interfaces()); | 153 const Array& interface_array = Array::Handle(cls.interfaces()); |
| 152 AbstractType& interface = AbstractType::Handle(); | 154 AbstractType& interface = AbstractType::Handle(); |
| 153 Class& interface_class = Class::Handle(); | 155 Class& interface_class = Class::Handle(); |
| (...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3029 expected_name ^= String::New("_offset"); | 3031 expected_name ^= String::New("_offset"); |
| 3030 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3032 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
| 3031 field ^= fields_array.At(2); | 3033 field ^= fields_array.At(2); |
| 3032 ASSERT(field.Offset() == TypedDataView::length_offset()); | 3034 ASSERT(field.Offset() == TypedDataView::length_offset()); |
| 3033 name ^= field.name(); | 3035 name ^= field.name(); |
| 3034 ASSERT(name.Equals("length")); | 3036 ASSERT(name.Equals("length")); |
| 3035 #endif | 3037 #endif |
| 3036 } | 3038 } |
| 3037 | 3039 |
| 3038 } // namespace dart | 3040 } // namespace dart |
| OLD | NEW |