| 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/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 20 matching lines...) Expand all Loading... |
| 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 optimization. | 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 // TODO(regis): Reenable this code for mips when possible. | |
| 42 #if defined(TARGET_ARCH_IA32) || \ | |
| 43 defined(TARGET_ARCH_X64) || \ | |
| 44 defined(TARGET_ARCH_ARM) | |
| 45 // Deoptimize all live frames. | 41 // Deoptimize all live frames. |
| 46 DeoptimizeIfOwner(added_subclasses_to_cids); | 42 DeoptimizeIfOwner(added_subclasses_to_cids); |
| 47 // Switch all functions' code to unoptimized. | 43 // Switch all functions' code to unoptimized. |
| 48 const ClassTable& class_table = *Isolate::Current()->class_table(); | 44 const ClassTable& class_table = *Isolate::Current()->class_table(); |
| 49 Class& cls = Class::Handle(); | 45 Class& cls = Class::Handle(); |
| 50 Array& array = Array::Handle(); | 46 Array& array = Array::Handle(); |
| 51 Function& function = Function::Handle(); | 47 Function& function = Function::Handle(); |
| 52 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++) { |
| 53 intptr_t cid = added_subclasses_to_cids[i]; | 49 intptr_t cid = added_subclasses_to_cids[i]; |
| 54 cls = class_table.At(cid); | 50 cls = class_table.At(cid); |
| 55 ASSERT(!cls.IsNull()); | 51 ASSERT(!cls.IsNull()); |
| 56 array = cls.functions(); | 52 array = cls.functions(); |
| 57 intptr_t num_functions = array.IsNull() ? 0 : array.Length(); | 53 intptr_t num_functions = array.IsNull() ? 0 : array.Length(); |
| 58 for (intptr_t f = 0; f < num_functions; f++) { | 54 for (intptr_t f = 0; f < num_functions; f++) { |
| 59 function ^= array.At(f); | 55 function ^= array.At(f); |
| 60 ASSERT(!function.IsNull()); | 56 ASSERT(!function.IsNull()); |
| 61 if (function.HasOptimizedCode()) { | 57 if (function.HasOptimizedCode()) { |
| 62 function.SwitchToUnoptimizedCode(); | 58 function.SwitchToUnoptimizedCode(); |
| 63 } | 59 } |
| 64 } | 60 } |
| 65 } | 61 } |
| 66 #endif | |
| 67 } | 62 } |
| 68 | 63 |
| 69 | 64 |
| 70 void AddSuperType(const AbstractType& type, | 65 void AddSuperType(const AbstractType& type, |
| 71 GrowableArray<intptr_t>* finalized_super_classes) { | 66 GrowableArray<intptr_t>* finalized_super_classes) { |
| 72 ASSERT(type.HasResolvedTypeClass()); | 67 ASSERT(type.HasResolvedTypeClass()); |
| 73 ASSERT(!type.IsDynamicType()); | 68 ASSERT(!type.IsDynamicType()); |
| 74 if (type.IsObjectType()) { | 69 if (type.IsObjectType()) { |
| 75 return; | 70 return; |
| 76 } | 71 } |
| (...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 expected_name ^= String::New("_offset"); | 1991 expected_name ^= String::New("_offset"); |
| 1997 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 1992 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
| 1998 field ^= fields_array.At(2); | 1993 field ^= fields_array.At(2); |
| 1999 ASSERT(field.Offset() == TypedDataView::length_offset()); | 1994 ASSERT(field.Offset() == TypedDataView::length_offset()); |
| 2000 name ^= field.name(); | 1995 name ^= field.name(); |
| 2001 ASSERT(name.Equals("length")); | 1996 ASSERT(name.Equals("length")); |
| 2002 #endif | 1997 #endif |
| 2003 } | 1998 } |
| 2004 | 1999 |
| 2005 } // namespace dart | 2000 } // namespace dart |
| OLD | NEW |