Commit 1b330286 authored by Benedikt Meurer's avatar Benedikt Meurer

[turbofan] Don't take into account source size for inlining heuristics.

The source size is not a real indicator for whether or not to inline a
certain function.

R=ishell@chromium.org, jarin@chromium.org
BUG=v8:3354,v8:5267

Review URL: https://codereview.chromium.org/2361813002 .

Cr-Commit-Position: refs/heads/master@{#39659}
parent d2626e30
...@@ -49,11 +49,6 @@ bool CanInlineFunction(Handle<JSFunction> function) { ...@@ -49,11 +49,6 @@ bool CanInlineFunction(Handle<JSFunction> function) {
// Don't inline builtins. // Don't inline builtins.
if (function->shared()->IsBuiltin()) return false; if (function->shared()->IsBuiltin()) return false;
// Quick check on source code length to avoid parsing large candidate.
if (function->shared()->SourceSize() > FLAG_max_inlined_source_size) {
return false;
}
// Quick check on the size of the AST to avoid parsing large candidate. // Quick check on the size of the AST to avoid parsing large candidate.
if (function->shared()->ast_node_count() > FLAG_max_inlined_nodes) { if (function->shared()->ast_node_count() > FLAG_max_inlined_nodes) {
return false; return false;
...@@ -287,9 +282,7 @@ void JSInliningHeuristic::PrintCandidates() { ...@@ -287,9 +282,7 @@ void JSInliningHeuristic::PrintCandidates() {
candidate.node->op()->mnemonic(), candidate.frequency); candidate.node->op()->mnemonic(), candidate.frequency);
for (int i = 0; i < candidate.num_functions; ++i) { for (int i = 0; i < candidate.num_functions; ++i) {
Handle<JSFunction> function = candidate.functions[i]; Handle<JSFunction> function = candidate.functions[i];
PrintF(" - size[source]:%d, size[ast]:%d, name: %s\n", PrintF(" - size:%d, name: %s\n", function->shared()->ast_node_count(),
function->shared()->SourceSize(),
function->shared()->ast_node_count(),
function->shared()->DebugName()->ToCString().get()); function->shared()->DebugName()->ToCString().get());
} }
} }
......
...@@ -2583,6 +2583,7 @@ TEST(TrackHeapAllocationsWithInlining) { ...@@ -2583,6 +2583,7 @@ TEST(TrackHeapAllocationsWithInlining) {
} }
TEST(TrackHeapAllocationsWithoutInlining) { TEST(TrackHeapAllocationsWithoutInlining) {
i::FLAG_turbo_inlining = false;
i::FLAG_max_inlined_source_size = 0; // Disable inlining i::FLAG_max_inlined_source_size = 0; // Disable inlining
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
LocalContext env; LocalContext env;
......
...@@ -25,10 +25,11 @@ function checkStackTrace(expected) { ...@@ -25,10 +25,11 @@ function checkStackTrace(expected) {
var CAN_INLINE_COMMENT = "// Let it be inlined."; var CAN_INLINE_COMMENT = "// Let it be inlined.";
var DONT_INLINE_COMMENT = (function() { var DONT_INLINE_COMMENT = (function() {
var line = "// Don't inline. Don't inline. Don't inline. Don't inline."; var line = "1";
for (var i = 0; i < 4; i++) { for (var i = 0; i < 200; ++i) {
line += "\n " + line; line += "," + i;
} }
line += ";\n";
return line; return line;
})(); })();
......
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