Change the maximum optimization count into a commandline flag.

This is needed for some unit tests, which otherwise do not test what people
think they do. ;-)

Review URL: https://chromiumcodereview.appspot.com/10823362

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12318 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f5f8ebd4
...@@ -240,7 +240,7 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() { ...@@ -240,7 +240,7 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
// Limit the number of times we re-compile a functions with // Limit the number of times we re-compile a functions with
// the optimizing compiler. // the optimizing compiler.
const int kMaxOptCount = const int kMaxOptCount =
FLAG_deopt_every_n_times == 0 ? Compiler::kDefaultMaxOptCount : 1000; FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000;
if (info()->shared_info()->opt_count() > kMaxOptCount) { if (info()->shared_info()->opt_count() > kMaxOptCount) {
return AbortOptimization(); return AbortOptimization();
} }
......
...@@ -410,10 +410,6 @@ class OptimizingCompiler: public ZoneObject { ...@@ -410,10 +410,6 @@ class OptimizingCompiler: public ZoneObject {
class Compiler : public AllStatic { class Compiler : public AllStatic {
public: public:
// Default maximum number of function optimization attempts before we
// give up.
static const int kDefaultMaxOptCount = 10;
static const int kMaxInliningLevels = 3; static const int kMaxInliningLevels = 3;
// Call count before primitive functions trigger their own optimization. // Call count before primitive functions trigger their own optimization.
......
...@@ -324,6 +324,8 @@ DEFINE_bool(always_full_compiler, false, ...@@ -324,6 +324,8 @@ DEFINE_bool(always_full_compiler, false,
"try to use the dedicated run-once backend for all code") "try to use the dedicated run-once backend for all code")
DEFINE_bool(trace_bailout, false, DEFINE_bool(trace_bailout, false,
"print reasons for falling back to using the classic V8 backend") "print reasons for falling back to using the classic V8 backend")
DEFINE_int(max_opt_count, 10,
"maximum number of optimization attempts before giving up.")
// compilation-cache.cc // compilation-cache.cc
DEFINE_bool(compilation_cache, true, "enable compilation cache") DEFINE_bool(compilation_cache, true, "enable compilation cache")
......
...@@ -2029,7 +2029,7 @@ void HGlobalValueNumberer::ProcessLoopBlock( ...@@ -2029,7 +2029,7 @@ void HGlobalValueNumberer::ProcessLoopBlock(
bool HGlobalValueNumberer::AllowCodeMotion() { bool HGlobalValueNumberer::AllowCodeMotion() {
return info()->shared_info()->opt_count() + 1 < Compiler::kDefaultMaxOptCount; return info()->shared_info()->opt_count() + 1 < FLAG_max_opt_count;
} }
......
...@@ -7935,7 +7935,7 @@ void SharedFunctionInfo::ResetForNewContext(int new_ic_age) { ...@@ -7935,7 +7935,7 @@ void SharedFunctionInfo::ResetForNewContext(int new_ic_age) {
if (code()->kind() == Code::FUNCTION) { if (code()->kind() == Code::FUNCTION) {
code()->set_profiler_ticks(0); code()->set_profiler_ticks(0);
if (optimization_disabled() && if (optimization_disabled() &&
opt_count() >= Compiler::kDefaultMaxOptCount) { opt_count() >= FLAG_max_opt_count) {
// Re-enable optimizations if they were disabled due to opt_count limit. // Re-enable optimizations if they were disabled due to opt_count limit.
set_optimization_disabled(false); set_optimization_disabled(false);
code()->set_optimizable(true); code()->set_optimizable(true);
......
...@@ -304,7 +304,7 @@ void RuntimeProfiler::OptimizeNow() { ...@@ -304,7 +304,7 @@ void RuntimeProfiler::OptimizeNow() {
// Do not record non-optimizable functions. // Do not record non-optimizable functions.
if (shared->optimization_disabled()) { if (shared->optimization_disabled()) {
if (shared->deopt_count() >= Compiler::kDefaultMaxOptCount) { if (shared->deopt_count() >= FLAG_max_opt_count) {
// If optimization was disabled due to many deoptimizations, // If optimization was disabled due to many deoptimizations,
// then check if the function is hot and try to reenable optimization. // then check if the function is hot and try to reenable optimization.
int ticks = shared_code->profiler_ticks(); int ticks = shared_code->profiler_ticks();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment