From 29ad06f684433127ed819ece6c23cb4a237df5c1 Mon Sep 17 00:00:00 2001 From: "hpayer@chromium.org" Date: Wed, 17 Jul 2013 08:44:10 +0000 Subject: [PATCH] More aggressively inline optimized code. BUG= R=danno@chromium.org, mstarzinger@chromium.org, titzer@chromium.org Review URL: https://codereview.chromium.org/19504006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15703 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler.h | 2 -- src/debug.cc | 2 +- src/flag-definitions.h | 3 ++- src/hydrogen.cc | 4 ++-- src/isolate.cc | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/compiler.h b/src/compiler.h index 161f404..332d575 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -560,8 +560,6 @@ class OptimizingCompiler: public ZoneObject { class Compiler : public AllStatic { public: - static const int kMaxInliningLevels = 3; - // Call count before primitive functions trigger their own optimization. static const int kCallsUntilPrimitiveOpt = 200; diff --git a/src/debug.cc b/src/debug.cc index 41eac5f..04f8a7a 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1906,7 +1906,7 @@ static void CollectActiveFunctionsFromThread( for (JavaScriptFrameIterator it(isolate, top); !it.done(); it.Advance()) { JavaScriptFrame* frame = it.frame(); if (frame->is_optimized()) { - List functions(Compiler::kMaxInliningLevels + 1); + List functions(FLAG_max_inlining_levels + 1); frame->GetFunctions(&functions); for (int i = 0; i < functions.length(); i++) { JSFunction* function = functions[i]; diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 50d9669..6d791ed 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -219,11 +219,12 @@ DEFINE_bool(use_canonicalizing, true, "use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true, "use function inlining") DEFINE_bool(use_escape_analysis, false, "use hydrogen escape analysis") DEFINE_bool(use_allocation_folding, true, "use allocation folding") +DEFINE_int(max_inlining_levels, 5, "maximum number of inlining levels") DEFINE_int(max_inlined_source_size, 600, "maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196, "maximum number of AST nodes considered for a single inlining") -DEFINE_int(max_inlined_nodes_cumulative, 196, +DEFINE_int(max_inlined_nodes_cumulative, 400, "maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true, "loop invariant code motion") DEFINE_bool(fast_math, true, "faster (but maybe less accurate) math functions") diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 54b5c12..409a0d4 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -6340,11 +6340,11 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind, #endif - // Don't inline deeper than kMaxInliningLevels calls. + // Don't inline deeper than the maximum number of inlining levels. HEnvironment* env = environment(); int current_level = 1; while (env->outer() != NULL) { - if (current_level == Compiler::kMaxInliningLevels) { + if (current_level == FLAG_max_inlining_levels) { TraceInline(target, caller, "inline depth limit reached"); return false; } diff --git a/src/isolate.cc b/src/isolate.cc index 8d15566..f0ad02d 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -669,7 +669,7 @@ Handle Isolate::CaptureSimpleStackTrace(Handle error_object, JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame); // Set initial size to the maximum inlining level + 1 for the outermost // function. - List frames(Compiler::kMaxInliningLevels + 1); + List frames(FLAG_max_inlining_levels + 1); frame->Summarize(&frames); for (int i = frames.length() - 1; i >= 0; i--) { if (cursor + 4 > elements->length()) { @@ -752,7 +752,7 @@ Handle Isolate::CaptureCurrentStackTrace( JavaScriptFrame* frame = it.frame(); // Set initial size to the maximum inlining level + 1 for the outermost // function. - List frames(Compiler::kMaxInliningLevels + 1); + List frames(FLAG_max_inlining_levels + 1); frame->Summarize(&frames); for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { // Create a JSObject to hold the information for the StackFrame. -- 2.7.4