[turbofan] Add IsInlineable predicate to SharedFunctionInfoRef

Bug: v8:7790

R=neis@chromium.org

Change-Id: I10085cff40e14ea63074e29649af55fa2c0ea462
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1514494
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Auto-Submit: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60157}
This commit is contained in:
Maya Lekova 2019-03-11 13:38:50 +01:00 committed by Commit Bot
parent 708c91154c
commit 333fd4d026
3 changed files with 21 additions and 14 deletions

View File

@ -520,18 +520,19 @@ class ScopeInfoRef : public HeapObjectRef {
int ContextLength() const;
};
#define BROKER_SFI_FIELDS(V) \
V(int, internal_formal_parameter_count) \
V(bool, has_duplicate_parameters) \
V(int, function_map_index) \
V(FunctionKind, kind) \
V(LanguageMode, language_mode) \
V(bool, native) \
V(bool, HasBreakInfo) \
V(bool, HasBuiltinId) \
V(bool, construct_as_builtin) \
V(bool, HasBytecodeArray) \
V(bool, is_safe_to_skip_arguments_adaptor)
#define BROKER_SFI_FIELDS(V) \
V(int, internal_formal_parameter_count) \
V(bool, has_duplicate_parameters) \
V(int, function_map_index) \
V(FunctionKind, kind) \
V(LanguageMode, language_mode) \
V(bool, native) \
V(bool, HasBreakInfo) \
V(bool, HasBuiltinId) \
V(bool, construct_as_builtin) \
V(bool, HasBytecodeArray) \
V(bool, is_safe_to_skip_arguments_adaptor) \
V(bool, IsInlineable)
class SharedFunctionInfoRef : public HeapObjectRef {
public:
@ -540,6 +541,7 @@ class SharedFunctionInfoRef : public HeapObjectRef {
int builtin_id() const;
BytecodeArrayRef GetBytecodeArray() const;
#define DECL_ACCESSOR(type, name) type name() const;
BROKER_SFI_FIELDS(DECL_ACCESSOR)
#undef DECL_ACCESSOR

View File

@ -106,7 +106,8 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
candidate.functions[i].is_null()
? candidate.shared_info
: handle(candidate.functions[i]->shared(), isolate());
candidate.can_inline_function[i] = shared->IsInlineable();
SharedFunctionInfoRef sfi_ref(broker(), shared);
candidate.can_inline_function[i] = sfi_ref.IsInlineable();
// Do not allow direct recursion i.e. f() -> f(). We still allow indirect
// recurion like f() -> g() -> f(). The indirect recursion is helpful in
// cases where f() is a small dispatch function that calls the appropriate

View File

@ -24,7 +24,8 @@ class JSInliningHeuristic final : public AdvancedReducer {
candidates_(local_zone),
seen_(local_zone),
source_positions_(source_positions),
jsgraph_(jsgraph) {}
jsgraph_(jsgraph),
broker_(broker) {}
const char* reducer_name() const override { return "JSInliningHeuristic"; }
@ -84,6 +85,8 @@ class JSInliningHeuristic final : public AdvancedReducer {
CommonOperatorBuilder* common() const;
Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; }
// TODO(neis): Make heap broker a component of JSGraph?
JSHeapBroker* broker() const { return broker_; }
Isolate* isolate() const { return jsgraph_->isolate(); }
SimplifiedOperatorBuilder* simplified() const;
@ -93,6 +96,7 @@ class JSInliningHeuristic final : public AdvancedReducer {
ZoneSet<NodeId> seen_;
SourcePositionTable* source_positions_;
JSGraph* const jsgraph_;
JSHeapBroker* const broker_;
int cumulative_count_ = 0;
};