| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 | 1199 |
| 1200 // Only unoptimized code has invocation counter threshold checking. | 1200 // Only unoptimized code has invocation counter threshold checking. |
| 1201 // Once the invocation counter threshold is reached any entry into the | 1201 // Once the invocation counter threshold is reached any entry into the |
| 1202 // unoptimized code is redirected to this function. | 1202 // unoptimized code is redirected to this function. |
| 1203 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 1203 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
| 1204 ASSERT(arguments.Count() == | 1204 ASSERT(arguments.Count() == |
| 1205 kOptimizeInvokedFunctionRuntimeEntry.argument_count()); | 1205 kOptimizeInvokedFunctionRuntimeEntry.argument_count()); |
| 1206 const Function& function = Function::CheckedHandle(arguments.At(0)); | 1206 const Function& function = Function::CheckedHandle(arguments.At(0)); |
| 1207 if (isolate->debugger()->IsActive()) { |
| 1208 // We cannot set breakpoints in optimized code, so do not optimize |
| 1209 // the function. |
| 1210 function.set_usage_counter(0); |
| 1211 return; |
| 1212 } |
| 1207 if (function.deoptimization_counter() >= | 1213 if (function.deoptimization_counter() >= |
| 1208 FLAG_deoptimization_counter_threshold) { | 1214 FLAG_deoptimization_counter_threshold) { |
| 1209 // TODO(srdjan): Investigate excessive deoptimization. | 1215 // TODO(srdjan): Investigate excessive deoptimization. |
| 1210 function.set_usage_counter(0); | 1216 function.set_usage_counter(0); |
| 1211 return; | 1217 return; |
| 1212 } | 1218 } |
| 1213 if (function.HasOptimizedCode()) { | 1219 if (function.HasOptimizedCode()) { |
| 1214 // The caller has been already optimized. | 1220 // The caller has been already optimized. |
| 1215 // TODO(srdjan): This is a significant slowdown, the caller is probably in | 1221 // TODO(srdjan): This is a significant slowdown, the caller is probably in |
| 1216 // a loop. Maybe test if the code has been optimized before calling. | 1222 // a loop. Maybe test if the code has been optimized before calling. |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 } | 1434 } |
| 1429 } | 1435 } |
| 1430 } | 1436 } |
| 1431 // The cache is null terminated, therefore the loop above should never | 1437 // The cache is null terminated, therefore the loop above should never |
| 1432 // terminate by itself. | 1438 // terminate by itself. |
| 1433 UNREACHABLE(); | 1439 UNREACHABLE(); |
| 1434 return Code::null(); | 1440 return Code::null(); |
| 1435 } | 1441 } |
| 1436 | 1442 |
| 1437 } // namespace dart | 1443 } // namespace dart |
| OLD | NEW |