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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 | 6 |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 3764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3775 } | 3775 } |
3776 } | 3776 } |
3777 | 3777 |
3778 | 3778 |
3779 // Removes optimized code once we load more classes, since --use_cha based | 3779 // Removes optimized code once we load more classes, since --use_cha based |
3780 // optimizations may have become invalid. | 3780 // optimizations may have become invalid. |
3781 // TODO(srdjan): Note which functions use which CHA decision and deoptimize | 3781 // TODO(srdjan): Note which functions use which CHA decision and deoptimize |
3782 // only the necessary ones. | 3782 // only the necessary ones. |
3783 static void RemoveOptimizedCode() { | 3783 static void RemoveOptimizedCode() { |
3784 ASSERT(FLAG_use_cha); | 3784 ASSERT(FLAG_use_cha); |
| 3785 // Deoptimize all live frames. |
| 3786 DeoptimizeAll(); |
| 3787 // Switch all functions' code to unoptimized. |
3785 const ClassTable& class_table = *Isolate::Current()->class_table(); | 3788 const ClassTable& class_table = *Isolate::Current()->class_table(); |
3786 Class& cls = Class::Handle(); | 3789 Class& cls = Class::Handle(); |
3787 Array& array = Array::Handle(); | 3790 Array& array = Array::Handle(); |
3788 Function& function = Function::Handle(); | 3791 Function& function = Function::Handle(); |
3789 const intptr_t num_cids = class_table.NumCids(); | 3792 const intptr_t num_cids = class_table.NumCids(); |
3790 for (intptr_t i = kInstanceCid; i < num_cids; i++) { | 3793 for (intptr_t i = kInstanceCid; i < num_cids; i++) { |
3791 if (!class_table.HasValidClassAt(i)) continue; | 3794 if (!class_table.HasValidClassAt(i)) continue; |
3792 cls = class_table.At(i); | 3795 cls = class_table.At(i); |
3793 ASSERT(!cls.IsNull()); | 3796 ASSERT(!cls.IsNull()); |
3794 array = cls.functions(); | 3797 array = cls.functions(); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4181 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { | 4184 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { |
4182 Dart::set_perf_events_writer(function); | 4185 Dart::set_perf_events_writer(function); |
4183 } | 4186 } |
4184 | 4187 |
4185 | 4188 |
4186 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { | 4189 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { |
4187 Dart::set_flow_graph_writer(function); | 4190 Dart::set_flow_graph_writer(function); |
4188 } | 4191 } |
4189 | 4192 |
4190 } // namespace dart | 4193 } // namespace dart |
OLD | NEW |