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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 if (!super_type.IsNull()) { | 97 if (!super_type.IsNull()) { |
98 if (super_type.HasResolvedTypeClass() && | 98 if (super_type.HasResolvedTypeClass() && |
99 Class::Handle(super_type.type_class()).is_finalized()) { | 99 Class::Handle(super_type.type_class()).is_finalized()) { |
100 AddSuperType(super_type, finalized_super_classes); | 100 AddSuperType(super_type, finalized_super_classes); |
101 } | 101 } |
102 } | 102 } |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 static void MarkImplementedClasses(const GrowableObjectArray& class_array) { | |
108 Class& cls = Class::Handle(); | |
109 Array& interfaces_array = Array::Handle(); | |
110 Type& type = Type::Handle(); | |
111 for (intptr_t i = 0; i < class_array.Length(); i++) { | |
112 cls ^= class_array.At(i); | |
113 interfaces_array = cls.interfaces(); | |
114 for (intptr_t k = 0; k < interfaces_array.Length(); k++) { | |
115 type ^= interfaces_array.At(k); | |
116 cls = type.type_class(); | |
117 cls.set_is_implemented(); | |
118 } | |
119 } | |
120 } | |
121 | |
122 | |
107 // Class finalization occurs: | 123 // Class finalization occurs: |
108 // a) when bootstrap process completes (VerifyBootstrapClasses). | 124 // a) when bootstrap process completes (VerifyBootstrapClasses). |
109 // b) after the user classes are loaded (dart_api). | 125 // b) after the user classes are loaded (dart_api). |
110 bool ClassFinalizer::FinalizePendingClasses() { | 126 bool ClassFinalizer::FinalizePendingClasses() { |
111 bool retval = true; | 127 bool retval = true; |
112 Isolate* isolate = Isolate::Current(); | 128 Isolate* isolate = Isolate::Current(); |
113 ASSERT(isolate != NULL); | 129 ASSERT(isolate != NULL); |
114 ObjectStore* object_store = isolate->object_store(); | 130 ObjectStore* object_store = isolate->object_store(); |
115 const Error& error = Error::Handle(object_store->sticky_error()); | 131 const Error& error = Error::Handle(object_store->sticky_error()); |
116 if (!error.IsNull()) { | 132 if (!error.IsNull()) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 for (intptr_t i = 0; i < class_array.Length(); i++) { | 165 for (intptr_t i = 0; i < class_array.Length(); i++) { |
150 cls ^= class_array.At(i); | 166 cls ^= class_array.At(i); |
151 FinalizeClass(cls); | 167 FinalizeClass(cls); |
152 } | 168 } |
153 if (FLAG_print_classes) { | 169 if (FLAG_print_classes) { |
154 for (intptr_t i = 0; i < class_array.Length(); i++) { | 170 for (intptr_t i = 0; i < class_array.Length(); i++) { |
155 cls ^= class_array.At(i); | 171 cls ^= class_array.At(i); |
156 PrintClassInformation(cls); | 172 PrintClassInformation(cls); |
157 } | 173 } |
158 } | 174 } |
175 MarkImplementedClasses(class_array); | |
regis
2012/11/28 22:32:17
Instead of adding another pass, you could mark int
srdjan
2012/11/28 22:43:50
Done.
| |
159 // Clear pending classes array. | 176 // Clear pending classes array. |
160 class_array = GrowableObjectArray::New(); | 177 class_array = GrowableObjectArray::New(); |
161 object_store->set_pending_classes(class_array); | 178 object_store->set_pending_classes(class_array); |
162 } else { | 179 } else { |
163 retval = false; | 180 retval = false; |
164 } | 181 } |
165 isolate->set_long_jump_base(base); | 182 isolate->set_long_jump_base(base); |
166 if (FLAG_use_cha) { | 183 if (FLAG_use_cha) { |
167 RemoveOptimizedCode(added_subclasses_to_cids); | 184 RemoveOptimizedCode(added_subclasses_to_cids); |
168 } | 185 } |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1687 void ClassFinalizer::ReportError(const char* format, ...) { | 1704 void ClassFinalizer::ReportError(const char* format, ...) { |
1688 va_list args; | 1705 va_list args; |
1689 va_start(args, format); | 1706 va_start(args, format); |
1690 const Error& error = Error::Handle( | 1707 const Error& error = Error::Handle( |
1691 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); | 1708 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); |
1692 va_end(args); | 1709 va_end(args); |
1693 ReportError(error); | 1710 ReportError(error); |
1694 } | 1711 } |
1695 | 1712 |
1696 } // namespace dart | 1713 } // namespace dart |
OLD | NEW |