Chromium Code Reviews| 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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 | 1163 |
| 1164 // Only unoptimized code has invocation counter threshold checking. | 1164 // Only unoptimized code has invocation counter threshold checking. |
| 1165 // Once the invocation counter threshold is reached any entry into the | 1165 // Once the invocation counter threshold is reached any entry into the |
| 1166 // unoptimized code is redirected to this function. | 1166 // unoptimized code is redirected to this function. |
| 1167 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 1167 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
| 1168 ASSERT(arguments.Count() == | 1168 ASSERT(arguments.Count() == |
| 1169 kOptimizeInvokedFunctionRuntimeEntry.argument_count()); | 1169 kOptimizeInvokedFunctionRuntimeEntry.argument_count()); |
| 1170 const Function& function = Function::CheckedHandle(arguments.At(0)); | 1170 const Function& function = Function::CheckedHandle(arguments.At(0)); |
| 1171 if (isolate->debugger()->IsActive()) { | |
|
srdjan
2012/03/13 17:11:35
Maybe add comment why we should not optimize when
hausner
2012/03/13 20:45:03
Done.
| |
| 1172 function.set_usage_counter(0); | |
| 1173 return; | |
| 1174 } | |
| 1171 if (function.deoptimization_counter() >= | 1175 if (function.deoptimization_counter() >= |
| 1172 FLAG_deoptimization_counter_threshold) { | 1176 FLAG_deoptimization_counter_threshold) { |
| 1173 // TODO(srdjan): Investigate excessive deoptimization. | 1177 // TODO(srdjan): Investigate excessive deoptimization. |
| 1174 function.set_usage_counter(0); | 1178 function.set_usage_counter(0); |
| 1175 return; | 1179 return; |
| 1176 } | 1180 } |
| 1177 if (function.HasOptimizedCode()) { | 1181 if (function.HasOptimizedCode()) { |
| 1178 // The caller has been already optimized. | 1182 // The caller has been already optimized. |
| 1179 // TODO(srdjan): This is a significant slowdown, the caller is probably in | 1183 // TODO(srdjan): This is a significant slowdown, the caller is probably in |
| 1180 // a loop. Maybe test if the code has been optimized before calling. | 1184 // 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... | |
| 1392 } | 1396 } |
| 1393 } | 1397 } |
| 1394 } | 1398 } |
| 1395 // The cache is null terminated, therefore the loop above should never | 1399 // The cache is null terminated, therefore the loop above should never |
| 1396 // terminate by itself. | 1400 // terminate by itself. |
| 1397 UNREACHABLE(); | 1401 UNREACHABLE(); |
| 1398 return Code::null(); | 1402 return Code::null(); |
| 1399 } | 1403 } |
| 1400 | 1404 |
| 1401 } // namespace dart | 1405 } // namespace dart |
| OLD | NEW |