From b7d3d51a62eb94056f80bd8b8480b07951879ea9 Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Mon, 30 Jun 2014 08:59:23 +0000 Subject: [PATCH] Remove kDontInline and simplify compiler hints. R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/359733004 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22081 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ast.cc | 10 ++++------ src/ast.h | 1 - src/compiler.cc | 6 ++---- src/hydrogen.cc | 5 ++--- src/objects-inl.h | 1 - src/objects.h | 9 --------- 6 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/ast.cc b/src/ast.cc index edea0f5f7e..9cce1da71d 100644 --- a/src/ast.cc +++ b/src/ast.cc @@ -1028,7 +1028,6 @@ CaseClause::CaseClause(Zone* zone, void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ increase_node_count(); \ set_dont_optimize_reason(k##NodeType); \ - add_flag(kDontInline); \ add_flag(kDontSelfOptimize); \ } #define DONT_SELFOPTIMIZE_NODE(NodeType) \ @@ -1046,7 +1045,6 @@ CaseClause::CaseClause(Zone* zone, void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ increase_node_count(); \ set_dont_optimize_reason(k##NodeType); \ - add_flag(kDontInline); \ add_flag(kDontSelfOptimize); \ add_flag(kDontCache); \ } @@ -1079,7 +1077,8 @@ REGULAR_NODE(ThisFunction) REGULAR_NODE_WITH_FEEDBACK_SLOTS(Call) REGULAR_NODE_WITH_FEEDBACK_SLOTS(CallNew) // In theory, for VariableProxy we'd have to add: -// if (node->var()->IsLookupSlot()) add_flag(kDontInline); +// if (node->var()->IsLookupSlot()) +// set_dont_optimize_reason(kReferenceToAVariableWhichRequiresDynamicLookup); // But node->var() is usually not bound yet at VariableProxy creation time, and // LOOKUP variables only result from constructs that cannot be inlined anyway. REGULAR_NODE(VariableProxy) @@ -1111,9 +1110,8 @@ DONT_CACHE_NODE(ModuleLiteral) void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { increase_node_count(); if (node->is_jsruntime()) { - // Don't try to inline JS runtime calls because we don't (currently) even - // optimize them. - add_flag(kDontInline); + // Don't try to optimize JS runtime calls because we bailout on them. + set_dont_optimize_reason(kCallToAJavaScriptRuntimeFunction); } } diff --git a/src/ast.h b/src/ast.h index 1396bf4aaa..aecee37b60 100644 --- a/src/ast.h +++ b/src/ast.h @@ -149,7 +149,6 @@ typedef ZoneList > ZoneObjectList; enum AstPropertiesFlag { - kDontInline, kDontSelfOptimize, kDontSoftInline, kDontCache diff --git a/src/compiler.cc b/src/compiler.cc index 6b2fba4393..bf9d598941 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -580,8 +580,7 @@ static void UpdateSharedFunctionInfo(CompilationInfo* info) { // Check the function has compiled code. ASSERT(shared->is_compiled()); - shared->set_dont_optimize_reason(lit->dont_optimize_reason()); - shared->set_dont_inline(lit->flags()->Contains(kDontInline)); + shared->set_bailout_reason(lit->dont_optimize_reason()); shared->set_ast_node_count(lit->ast_node_count()); shared->set_strict_mode(lit->strict_mode()); } @@ -613,8 +612,7 @@ static void SetFunctionInfo(Handle function_info, function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); function_info->set_ast_node_count(lit->ast_node_count()); function_info->set_is_function(lit->is_function()); - function_info->set_dont_optimize_reason(lit->dont_optimize_reason()); - function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); + function_info->set_bailout_reason(lit->dont_optimize_reason()); function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); function_info->set_is_generator(lit->is_generator()); } diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 1b6cb11c54..ec5bb9bc8f 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -7576,7 +7576,7 @@ int HOptimizedGraphBuilder::InliningAstSize(Handle target) { TraceInline(target, caller, "target not inlineable"); return kNotInlinable; } - if (target_shared->dont_inline()) { + if (target_shared->DisableOptimizationReason() != kNoReason) { TraceInline(target, caller, "target contains unsupported syntax [early]"); return kNotInlinable; } @@ -7663,8 +7663,7 @@ bool HOptimizedGraphBuilder::TryInline(Handle target, TraceInline(target, caller, "target AST is too large [late]"); return false; } - AstProperties::Flags* flags(function->flags()); - if (flags->Contains(kDontInline) || function->dont_optimize()) { + if (function->dont_optimize()) { TraceInline(target, caller, "target contains unsupported syntax [late]"); return false; } diff --git a/src/objects-inl.h b/src/objects-inl.h index 812bc184b1..16d0acd6e3 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -5447,7 +5447,6 @@ BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) -BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_inline, kDontInline) BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_cache, kDontCache) BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_flush, kDontFlush) BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_generator, kIsGenerator) diff --git a/src/objects.h b/src/objects.h index 50499db3ed..a494778a98 100644 --- a/src/objects.h +++ b/src/objects.h @@ -7223,9 +7223,6 @@ class SharedFunctionInfo: public HeapObject { // Is this a function or top-level/eval code. DECL_BOOLEAN_ACCESSORS(is_function) - // Indicates that the function cannot be inlined. - DECL_BOOLEAN_ACCESSORS(dont_inline) - // Indicates that code for this function cannot be cached. DECL_BOOLEAN_ACCESSORS(dont_cache) @@ -7287,11 +7284,6 @@ class SharedFunctionInfo: public HeapObject { reason)); } - void set_dont_optimize_reason(BailoutReason reason) { - set_bailout_reason(reason); - set_dont_inline(reason != kNoReason); - } - // Check whether or not this function is inlineable. bool IsInlineable(); @@ -7434,7 +7426,6 @@ class SharedFunctionInfo: public HeapObject { kIsAnonymous, kNameShouldPrintAsAnonymous, kIsFunction, - kDontInline, kDontCache, kDontFlush, kIsGenerator,