| 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 15 matching lines...) Expand all Loading... |
| 26 ObjectStore* object_store = Isolate::Current()->object_store(); | 26 ObjectStore* object_store = Isolate::Current()->object_store(); |
| 27 const GrowableObjectArray& classes = | 27 const GrowableObjectArray& classes = |
| 28 GrowableObjectArray::Handle(object_store->pending_classes()); | 28 GrowableObjectArray::Handle(object_store->pending_classes()); |
| 29 return classes.Length() == 0; | 29 return classes.Length() == 0; |
| 30 } | 30 } |
| 31 | 31 |
| 32 | 32 |
| 33 // Removes optimized code once we load more classes, since --use_cha based | 33 // Removes optimized code once we load more classes, since --use_cha based |
| 34 // optimizations may have become invalid. | 34 // optimizations may have become invalid. |
| 35 // Only methods which owner classes where subclasses can be invalid. | 35 // Only methods which owner classes where subclasses can be invalid. |
| 36 // TODO(srdjan): Be even more precise by recording the exact CHA optimziation. | 36 // TODO(srdjan): Be even more precise by recording the exact CHA optimization. |
| 37 static void RemoveOptimizedCode( | 37 static void RemoveOptimizedCode( |
| 38 const GrowableArray<intptr_t>& added_subclasses_to_cids) { | 38 const GrowableArray<intptr_t>& added_subclasses_to_cids) { |
| 39 ASSERT(FLAG_use_cha); | 39 ASSERT(FLAG_use_cha); |
| 40 if (added_subclasses_to_cids.is_empty()) return; | 40 if (added_subclasses_to_cids.is_empty()) return; |
| 41 // Deoptimize all live frames. | 41 // Deoptimize all live frames. |
| 42 DeoptimizeAll(); | 42 DeoptimizeIfOwner(added_subclasses_to_cids); |
| 43 // Switch all functions' code to unoptimized. | 43 // Switch all functions' code to unoptimized. |
| 44 const ClassTable& class_table = *Isolate::Current()->class_table(); | 44 const ClassTable& class_table = *Isolate::Current()->class_table(); |
| 45 Class& cls = Class::Handle(); | 45 Class& cls = Class::Handle(); |
| 46 Array& array = Array::Handle(); | 46 Array& array = Array::Handle(); |
| 47 Function& function = Function::Handle(); | 47 Function& function = Function::Handle(); |
| 48 for (intptr_t i = 0; i < added_subclasses_to_cids.length(); i++) { | 48 for (intptr_t i = 0; i < added_subclasses_to_cids.length(); i++) { |
| 49 intptr_t cid = added_subclasses_to_cids[i]; | 49 intptr_t cid = added_subclasses_to_cids[i]; |
| 50 cls = class_table.At(cid); | 50 cls = class_table.At(cid); |
| 51 ASSERT(!cls.IsNull()); | 51 ASSERT(!cls.IsNull()); |
| 52 array = cls.functions(); | 52 array = cls.functions(); |
| (...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 void ClassFinalizer::ReportError(const char* format, ...) { | 1697 void ClassFinalizer::ReportError(const char* format, ...) { |
| 1698 va_list args; | 1698 va_list args; |
| 1699 va_start(args, format); | 1699 va_start(args, format); |
| 1700 const Error& error = Error::Handle( | 1700 const Error& error = Error::Handle( |
| 1701 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); | 1701 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); |
| 1702 va_end(args); | 1702 va_end(args); |
| 1703 ReportError(error); | 1703 ReportError(error); |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 } // namespace dart | 1706 } // namespace dart |
| OLD | NEW |