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

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

Issue 11778013: Cleanup handles more efficiently, ensures we don't have to iterate over them (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/benchmark_test.cc ('k') | runtime/vm/compiler.cc » ('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/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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 105
106 106
107 // Class finalization occurs: 107 // Class finalization occurs:
108 // a) when bootstrap process completes (VerifyBootstrapClasses). 108 // a) when bootstrap process completes (VerifyBootstrapClasses).
109 // b) after the user classes are loaded (dart_api). 109 // b) after the user classes are loaded (dart_api).
110 bool ClassFinalizer::FinalizePendingClasses() { 110 bool ClassFinalizer::FinalizePendingClasses() {
111 bool retval = true; 111 bool retval = true;
112 Isolate* isolate = Isolate::Current(); 112 Isolate* isolate = Isolate::Current();
113 ASSERT(isolate != NULL); 113 ASSERT(isolate != NULL);
114 HANDLESCOPE(isolate);
114 ObjectStore* object_store = isolate->object_store(); 115 ObjectStore* object_store = isolate->object_store();
115 const Error& error = Error::Handle(object_store->sticky_error()); 116 const Error& error = Error::Handle(object_store->sticky_error());
116 if (!error.IsNull()) { 117 if (!error.IsNull()) {
117 return false; 118 return false;
118 } 119 }
119 if (AllClassesFinalized()) { 120 if (AllClassesFinalized()) {
120 return true; 121 return true;
121 } 122 }
122 123
123 GrowableArray<intptr_t> added_subclasses_to_cids; 124 GrowableArray<intptr_t> added_subclasses_to_cids;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 RemoveOptimizedCode(added_subclasses_to_cids); 164 RemoveOptimizedCode(added_subclasses_to_cids);
164 } 165 }
165 return retval; 166 return retval;
166 } 167 }
167 168
168 169
169 // Adds all interfaces of cls into 'collected'. Duplicate entries may occur. 170 // Adds all interfaces of cls into 'collected'. Duplicate entries may occur.
170 // No cycles are allowed. 171 // No cycles are allowed.
171 void ClassFinalizer::CollectInterfaces(const Class& cls, 172 void ClassFinalizer::CollectInterfaces(const Class& cls,
172 const GrowableObjectArray& collected) { 173 const GrowableObjectArray& collected) {
173 const Array& interface_array = Array::ZoneHandle(cls.interfaces()); 174 const Array& interface_array = Array::Handle(cls.interfaces());
174 AbstractType& interface = AbstractType::Handle(); 175 AbstractType& interface = AbstractType::Handle();
175 Class& interface_class = Class::Handle(); 176 Class& interface_class = Class::Handle();
176 for (intptr_t i = 0; i < interface_array.Length(); i++) { 177 for (intptr_t i = 0; i < interface_array.Length(); i++) {
177 interface ^= interface_array.At(i); 178 interface ^= interface_array.At(i);
178 interface_class = interface.type_class(); 179 interface_class = interface.type_class();
179 collected.Add(interface_class); 180 collected.Add(interface_class);
180 CollectInterfaces(interface_class, collected); 181 CollectInterfaces(interface_class, collected);
181 } 182 }
182 } 183 }
183 184
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 void ClassFinalizer::ReportError(const char* format, ...) { 1577 void ClassFinalizer::ReportError(const char* format, ...) {
1577 va_list args; 1578 va_list args;
1578 va_start(args, format); 1579 va_start(args, format);
1579 const Error& error = Error::Handle( 1580 const Error& error = Error::Handle(
1580 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); 1581 Parser::FormatError(Script::Handle(), -1, "Error", format, args));
1581 va_end(args); 1582 va_end(args);
1582 ReportError(error); 1583 ReportError(error);
1583 } 1584 }
1584 1585
1585 } // namespace dart 1586 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698