Commit d6f476dd authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Fix intermittent stack overflow in Hydrogen code generation in tests.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10511 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8e7c28c5
...@@ -4798,7 +4798,8 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) { ...@@ -4798,7 +4798,8 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) {
// Do a quick check on source code length to avoid parsing large // Do a quick check on source code length to avoid parsing large
// inlining candidates. // inlining candidates.
if (FLAG_limit_inlining && target->shared()->SourceSize() > kMaxSourceSize) { if ((FLAG_limit_inlining && target->shared()->SourceSize() > kMaxSourceSize)
|| target->shared()->SourceSize() > kUnlimitedMaxSourceSize) {
TraceInline(target, caller, "target text too big"); TraceInline(target, caller, "target text too big");
return false; return false;
} }
...@@ -4846,7 +4847,8 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) { ...@@ -4846,7 +4847,8 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) {
} }
// We don't want to add more than a certain number of nodes from inlining. // We don't want to add more than a certain number of nodes from inlining.
if (FLAG_limit_inlining && inlined_count_ > kMaxInlinedNodes) { if ((FLAG_limit_inlining && inlined_count_ > kMaxInlinedNodes) ||
inlined_count_ > kUnlimitedMaxInlinedNodes) {
TraceInline(target, caller, "cumulative AST node limit reached"); TraceInline(target, caller, "cumulative AST node limit reached");
return false; return false;
} }
...@@ -4874,7 +4876,8 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) { ...@@ -4874,7 +4876,8 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) {
// Count the number of AST nodes added by inlining this call. // Count the number of AST nodes added by inlining this call.
int nodes_added = AstNode::Count() - count_before; int nodes_added = AstNode::Count() - count_before;
if (FLAG_limit_inlining && nodes_added > kMaxInlinedSize) { if ((FLAG_limit_inlining && nodes_added > kMaxInlinedSize) ||
nodes_added > kUnlimitedMaxInlinedSize) {
TraceInline(target, caller, "target AST is too large"); TraceInline(target, caller, "target AST is too large");
return false; return false;
} }
......
...@@ -773,6 +773,12 @@ class HGraphBuilder: public AstVisitor { ...@@ -773,6 +773,12 @@ class HGraphBuilder: public AstVisitor {
static const int kMaxInlinedSize = 196; static const int kMaxInlinedSize = 196;
static const int kMaxSourceSize = 600; static const int kMaxSourceSize = 600;
// Even in the 'unlimited' case we have to have some limit in order not to
// overflow the stack.
static const int kUnlimitedMaxInlinedNodes = 1000;
static const int kUnlimitedMaxInlinedSize = 1000;
static const int kUnlimitedMaxSourceSize = 600;
// Simple accessors. // Simple accessors.
void set_function_state(FunctionState* state) { function_state_ = state; } void set_function_state(FunctionState* state) { function_state_ = state; }
......
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