Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 39a68cc6e1e946b1b006c1ef2caa4d5dbcc390a9..44783e51155cc79fa5a1853406bce87ea6d77bbb 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -4646,11 +4646,27 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) { |
| Handle<JSFunction> target = expr->target(); |
| Handle<SharedFunctionInfo> target_shared(target->shared()); |
| - // Do a quick check on source code length to avoid parsing large |
| - // inlining candidates. |
| - if (FLAG_limit_inlining && target->shared()->SourceSize() > kMaxSourceSize) { |
| - TraceInline(target, caller, "target text too big"); |
| - return false; |
| + int ast_node_count = target_shared->ast_node_count(); |
|
Kevin Millikin (Chromium)
2011/11/24 13:15:56
Move this inside the if where it's used.
ulan
2011/11/25 09:11:15
Now I use to increment "inlined_count_".
|
| + |
| + if (FLAG_limit_inlining) { |
| + if (ast_node_count > kMaxInlinedSize) { |
|
Kevin Millikin (Chromium)
2011/11/24 13:15:56
All of these need some comment about what we're tr
ulan
2011/11/25 09:11:15
Done.
|
| + TraceInline(target, caller, "target AST is too large"); |
| + return false; |
| + } |
| + |
| + if (target->shared()->SourceSize() > kMaxSourceSize) { |
|
Kevin Millikin (Chromium)
2011/11/24 13:15:56
I wonder if we can just get rid of this now?
ulan
2011/11/25 09:11:15
Unfortunately, removing it regresses the delta blu
|
| + TraceInline(target, caller, "target text too big"); |
| + return false; |
| + } |
| + |
| + if (inlined_count_ > kMaxInlinedNodesSoft) { |
|
Kevin Millikin (Chromium)
2011/11/24 13:15:56
OK, but the logic is hard to follow because it doe
ulan
2011/11/25 09:11:15
Done.
|
| + if (ast_node_count > kMaxInlinedPrimitiveSize || |
| + inlined_count_ > kMaxInlinedNodesHard || |
| + !target_shared->is_primitive()) { |
| + TraceInline(target, caller, "cumulative AST node limit reached"); |
| + return false; |
| + } |
| + } |
| } |
| // Target must be inlineable. |
| @@ -4693,12 +4709,6 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) { |
| } |
| } |
| - // We don't want to add more than a certain number of nodes from inlining. |
| - if (FLAG_limit_inlining && inlined_count_ > kMaxInlinedNodes) { |
| - TraceInline(target, caller, "cumulative AST node limit reached"); |
| - return false; |
| - } |
| - |
| int count_before = AstNode::Count(); |
|
Kevin Millikin (Chromium)
2011/11/24 13:15:56
Please remove this, because it's only used to comp
ulan
2011/11/25 09:11:15
Done.
|
| // Parse and allocate variables. |
| @@ -4722,10 +4732,6 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) { |
| // Count the number of AST nodes added by inlining this call. |
| int nodes_added = AstNode::Count() - count_before; |
| - if (FLAG_limit_inlining && nodes_added > kMaxInlinedSize) { |
| - TraceInline(target, caller, "target AST is too large"); |
| - return false; |
| - } |
| // Don't inline functions that uses the arguments object or that |
| // have a mismatching number of parameters. |