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

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

Issue 64173005: Deoptimize closure functions in DeoptimizeWorld. This was causing (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | « no previous file | runtime/vm/object.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/debugger.h" 5 #include "vm/debugger.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 // that inline the function that contains the newly created breakpoint. 942 // that inline the function that contains the newly created breakpoint.
943 // We currently don't have this info so we deoptimize all functions. 943 // We currently don't have this info so we deoptimize all functions.
944 void Debugger::DeoptimizeWorld() { 944 void Debugger::DeoptimizeWorld() {
945 // Deoptimize all functions in stack activation frames. 945 // Deoptimize all functions in stack activation frames.
946 DeoptimizeAll(); 946 DeoptimizeAll();
947 // Iterate over all classes, deoptimize functions. 947 // Iterate over all classes, deoptimize functions.
948 // TODO(hausner): Could possibly be combined with RemoveOptimizedCode() 948 // TODO(hausner): Could possibly be combined with RemoveOptimizedCode()
949 const ClassTable& class_table = *isolate_->class_table(); 949 const ClassTable& class_table = *isolate_->class_table();
950 Class& cls = Class::Handle(); 950 Class& cls = Class::Handle();
951 Array& functions = Array::Handle(); 951 Array& functions = Array::Handle();
952 GrowableObjectArray& closures = GrowableObjectArray::Handle();
952 Function& function = Function::Handle(); 953 Function& function = Function::Handle();
953 intptr_t num_classes = class_table.NumCids(); 954 intptr_t num_classes = class_table.NumCids();
954 for (intptr_t i = 1; i < num_classes; i++) { 955 for (intptr_t i = 1; i < num_classes; i++) {
955 if (class_table.HasValidClassAt(i)) { 956 if (class_table.HasValidClassAt(i)) {
956 cls = class_table.At(i); 957 cls = class_table.At(i);
958
959 // Disable optimized functions.
957 functions = cls.functions(); 960 functions = cls.functions();
958 intptr_t num_functions = functions.IsNull() ? 0 : functions.Length(); 961 if (!functions.IsNull()) {
959 for (intptr_t f = 0; f < num_functions; f++) { 962 intptr_t num_functions = functions.Length();
960 function ^= functions.At(f); 963 for (intptr_t pos = 0; pos < num_functions; pos++) {
961 ASSERT(!function.IsNull()); 964 function ^= functions.At(pos);
962 if (function.HasOptimizedCode()) { 965 ASSERT(!function.IsNull());
963 function.SwitchToUnoptimizedCode(); 966 if (function.HasOptimizedCode()) {
967 function.SwitchToUnoptimizedCode();
968 }
969 // Also disable any optimized implicit closure functions.
970 if (function.HasImplicitClosureFunction()) {
971 function = function.ImplicitClosureFunction();
972 if (function.HasOptimizedCode()) {
973 function.SwitchToUnoptimizedCode();
974 }
975 }
976 }
977 }
978
979 // Disable other optimized closure functions.
980 closures = cls.closures();
981 if (!closures.IsNull()) {
982 intptr_t num_closures = closures.Length();
983 for (intptr_t pos = 0; pos < num_closures; pos++) {
984 function ^= closures.At(pos);
985 ASSERT(!function.IsNull());
986 if (function.HasOptimizedCode()) {
987 function.SwitchToUnoptimizedCode();
988 }
964 } 989 }
965 } 990 }
966 } 991 }
967 } 992 }
968 } 993 }
969 994
970 995
971 void Debugger::InstrumentForStepping(const Function& target_function) { 996 void Debugger::InstrumentForStepping(const Function& target_function) {
972 if (target_function.is_native()) { 997 if (target_function.is_native()) {
973 // Can't instrument native functions. 998 // Can't instrument native functions.
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 } 2133 }
2109 2134
2110 2135
2111 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2136 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2112 ASSERT(bpt->next() == NULL); 2137 ASSERT(bpt->next() == NULL);
2113 bpt->set_next(code_breakpoints_); 2138 bpt->set_next(code_breakpoints_);
2114 code_breakpoints_ = bpt; 2139 code_breakpoints_ = bpt;
2115 } 2140 }
2116 2141
2117 } // namespace dart 2142 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698