Replaced the --limit-inling flag by three separate flags and bumped hard limits.

This change makes experiments with inlining limits much easier. Note that the
default values for the limits keep their old values for now. Renamed things a
bit for more consistency.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11397 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3760893e
...@@ -6321,7 +6321,11 @@ static void SetFlagsFromString(const char* flags) { ...@@ -6321,7 +6321,11 @@ static void SetFlagsFromString(const char* flags) {
void Testing::PrepareStressRun(int run) { void Testing::PrepareStressRun(int run) {
static const char* kLazyOptimizations = static const char* kLazyOptimizations =
"--prepare-always-opt --nolimit-inlining --noalways-opt"; "--prepare-always-opt "
"--max-inlined-source-size=999999 "
"--max-inlined-nodes=999999 "
"--max-inlined-nodes-cumulative=999999 "
"--noalways-opt";
static const char* kForcedOptimizations = "--always-opt"; static const char* kForcedOptimizations = "--always-opt";
// If deoptimization stressed turn on frequent deoptimization. If no value // If deoptimization stressed turn on frequent deoptimization. If no value
......
...@@ -165,7 +165,12 @@ DEFINE_bool(eliminate_dead_phis, true, "eliminate dead phis") ...@@ -165,7 +165,12 @@ DEFINE_bool(eliminate_dead_phis, true, "eliminate dead phis")
DEFINE_bool(use_gvn, true, "use hydrogen global value numbering") DEFINE_bool(use_gvn, true, "use hydrogen global value numbering")
DEFINE_bool(use_canonicalizing, true, "use hydrogen instruction canonicalizing") DEFINE_bool(use_canonicalizing, true, "use hydrogen instruction canonicalizing")
DEFINE_bool(use_inlining, true, "use function inlining") DEFINE_bool(use_inlining, true, "use function inlining")
DEFINE_bool(limit_inlining, true, "limit code size growth from inlining") 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,
"maximum cumulative number of AST nodes considered for inlining")
DEFINE_bool(loop_invariant_code_motion, true, "loop invariant code motion") DEFINE_bool(loop_invariant_code_motion, true, "loop invariant code motion")
DEFINE_bool(collect_megamorphic_maps_from_stub_cache, DEFINE_bool(collect_megamorphic_maps_from_stub_cache,
true, true,
......
...@@ -5355,8 +5355,8 @@ bool HGraphBuilder::TryInline(CallKind call_kind, ...@@ -5355,8 +5355,8 @@ bool HGraphBuilder::TryInline(CallKind call_kind,
// 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 (target_shared->SourceSize() >
|| target_shared->SourceSize() > kUnlimitedMaxSourceSize) { Min(FLAG_max_inlined_source_size, kUnlimitedMaxInlinedSourceSize)) {
TraceInline(target, caller, "target text too big"); TraceInline(target, caller, "target text too big");
return false; return false;
} }
...@@ -5372,8 +5372,7 @@ bool HGraphBuilder::TryInline(CallKind call_kind, ...@@ -5372,8 +5372,7 @@ bool HGraphBuilder::TryInline(CallKind call_kind,
} }
int nodes_added = target_shared->ast_node_count(); int nodes_added = target_shared->ast_node_count();
if ((FLAG_limit_inlining && nodes_added > kMaxInlinedSize) || if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) {
nodes_added > kUnlimitedMaxInlinedSize) {
TraceInline(target, caller, "target AST is too large [early]"); TraceInline(target, caller, "target AST is too large [early]");
return false; return false;
} }
...@@ -5415,8 +5414,8 @@ bool HGraphBuilder::TryInline(CallKind call_kind, ...@@ -5415,8 +5414,8 @@ bool HGraphBuilder::TryInline(CallKind call_kind,
} }
// 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 (inlined_count_ > Min(FLAG_max_inlined_nodes_cumulative,
inlined_count_ > kUnlimitedMaxInlinedNodes) { kUnlimitedMaxInlinedNodesCumulative)) {
TraceInline(target, caller, "cumulative AST node limit reached"); TraceInline(target, caller, "cumulative AST node limit reached");
return false; return false;
} }
...@@ -5443,8 +5442,7 @@ bool HGraphBuilder::TryInline(CallKind call_kind, ...@@ -5443,8 +5442,7 @@ bool HGraphBuilder::TryInline(CallKind call_kind,
// The following conditions must be checked again after re-parsing, because // The following conditions must be checked again after re-parsing, because
// earlier the information might not have been complete due to lazy parsing. // earlier the information might not have been complete due to lazy parsing.
nodes_added = function->ast_node_count(); nodes_added = function->ast_node_count();
if ((FLAG_limit_inlining && nodes_added > kMaxInlinedSize) || if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) {
nodes_added > kUnlimitedMaxInlinedSize) {
TraceInline(target, caller, "target AST is too large [late]"); TraceInline(target, caller, "target AST is too large [late]");
return false; return false;
} }
......
...@@ -868,15 +868,11 @@ class HGraphBuilder: public AstVisitor { ...@@ -868,15 +868,11 @@ class HGraphBuilder: public AstVisitor {
static const int kMaxLoadPolymorphism = 4; static const int kMaxLoadPolymorphism = 4;
static const int kMaxStorePolymorphism = 4; static const int kMaxStorePolymorphism = 4;
static const int kMaxInlinedNodes = 196;
static const int kMaxInlinedSize = 196;
static const int kMaxSourceSize = 600;
// Even in the 'unlimited' case we have to have some limit in order not to // Even in the 'unlimited' case we have to have some limit in order not to
// overflow the stack. // overflow the stack.
static const int kUnlimitedMaxInlinedNodes = 1000; static const int kUnlimitedMaxInlinedSourceSize = 100000;
static const int kUnlimitedMaxInlinedSize = 1000; static const int kUnlimitedMaxInlinedNodes = 10000;
static const int kUnlimitedMaxSourceSize = 600; static const int kUnlimitedMaxInlinedNodesCumulative = 10000;
// Simple accessors. // Simple accessors.
void set_function_state(FunctionState* state) { function_state_ = state; } void set_function_state(FunctionState* state) { function_state_ = state; }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --inline-construct --nolimit-inlining // Flags: --allow-natives-syntax --inline-construct --max-inlined-source-size=999999 --max-inlined-nodes=999999 --max-inlined-nodes-cumulative=999999
// Test that huge constructors (more than 256 this assignments) are // Test that huge constructors (more than 256 this assignments) are
// handled correctly. // handled correctly.
......
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