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() {
// Limit the number of times we re-compile a functions with
// the optimizing compiler.
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) {
return AbortOptimization();
}
......
......@@ -410,10 +410,6 @@ class OptimizingCompiler: public ZoneObject {
class Compiler : public AllStatic {
public:
// Default maximum number of function optimization attempts before we
// give up.
static const int kDefaultMaxOptCount = 10;
static const int kMaxInliningLevels = 3;
// Call count before primitive functions trigger their own optimization.
......
......@@ -324,6 +324,8 @@ DEFINE_bool(always_full_compiler, false,
"try to use the dedicated run-once backend for all code")
DEFINE_bool(trace_bailout, false,
"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
DEFINE_bool(compilation_cache, true, "enable compilation cache")
......
......@@ -2029,7 +2029,7 @@ void HGlobalValueNumberer::ProcessLoopBlock(
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) {
if (code()->kind() == Code::FUNCTION) {
code()->set_profiler_ticks(0);
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.
set_optimization_disabled(false);
code()->set_optimizable(true);
......
......@@ -304,7 +304,7 @@ void RuntimeProfiler::OptimizeNow() {
// Do not record non-optimizable functions.
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,
// then check if the function is hot and try to reenable optimization.
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