Commit 65128ab2 authored by epertoso's avatar epertoso Committed by Commit bot

[turbofan] Add liveness analysis to the BytecodeGraphBuilder.

This is analogous to the variable liveness analysis we do in the AstGraphBuilder, but on the bytecode registers.

BUG=

Review-Url: https://codereview.chromium.org/2307863002
Cr-Commit-Position: refs/heads/master@{#39248}
parent c20e02e3
This diff is collapsed.
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include "src/compiler/bytecode-branch-analysis.h" #include "src/compiler/bytecode-branch-analysis.h"
#include "src/compiler/bytecode-loop-analysis.h" #include "src/compiler/bytecode-loop-analysis.h"
#include "src/compiler/js-graph.h" #include "src/compiler/js-graph.h"
#include "src/compiler/liveness-analyzer.h"
#include "src/compiler/state-values-utils.h"
#include "src/compiler/type-hint-analyzer.h" #include "src/compiler/type-hint-analyzer.h"
#include "src/interpreter/bytecode-array-iterator.h" #include "src/interpreter/bytecode-array-iterator.h"
#include "src/interpreter/bytecode-flags.h" #include "src/interpreter/bytecode-flags.h"
...@@ -115,6 +117,10 @@ class BytecodeGraphBuilder { ...@@ -115,6 +117,10 @@ class BytecodeGraphBuilder {
interpreter::Register first_arg, interpreter::Register first_arg,
size_t arity); size_t arity);
// Computes register liveness and replaces dead ones in frame states with the
// undefined values.
void ClearNonLiveSlotsInFrameStates();
void BuildCreateLiteral(const Operator* op); void BuildCreateLiteral(const Operator* op);
void BuildCreateArguments(CreateArgumentsType type); void BuildCreateArguments(CreateArgumentsType type);
Node* BuildLoadContextSlot(); Node* BuildLoadContextSlot();
...@@ -231,6 +237,12 @@ class BytecodeGraphBuilder { ...@@ -231,6 +237,12 @@ class BytecodeGraphBuilder {
loop_analysis_ = loop_analysis; loop_analysis_ = loop_analysis;
} }
LivenessAnalyzer* liveness_analyzer() { return &liveness_analyzer_; }
bool IsLivenessAnalysisEnabled() const {
return this->is_liveness_analysis_enabled_;
}
#define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name();
BYTECODE_LIST(DECLARE_VISIT_BYTECODE) BYTECODE_LIST(DECLARE_VISIT_BYTECODE)
#undef DECLARE_VISIT_BYTECODE #undef DECLARE_VISIT_BYTECODE
...@@ -268,6 +280,13 @@ class BytecodeGraphBuilder { ...@@ -268,6 +280,13 @@ class BytecodeGraphBuilder {
// Control nodes that exit the function body. // Control nodes that exit the function body.
ZoneVector<Node*> exit_controls_; ZoneVector<Node*> exit_controls_;
bool const is_liveness_analysis_enabled_;
StateValuesCache state_values_cache_;
// Analyzer of register liveness.
LivenessAnalyzer liveness_analyzer_;
static int const kBinaryOperationHintIndex = 1; static int const kBinaryOperationHintIndex = 1;
static int const kCountOperationHintIndex = 0; static int const kCountOperationHintIndex = 0;
static int const kBinaryOperationSmiHintIndex = 2; static int const kBinaryOperationSmiHintIndex = 2;
......
...@@ -482,11 +482,6 @@ ...@@ -482,11 +482,6 @@
# BUG(4751). Flaky with Ignition. # BUG(4751). Flaky with Ignition.
'test-cpu-profiler/JsNativeJsSample': [SKIP], 'test-cpu-profiler/JsNativeJsSample': [SKIP],
# TODO(bmeurer): TurboFan embeds strong references to all kinds of objects
# via deoptimization data (Crankshaft also does this, but lack proper test
# coverage).
'test-heap/ObjectsInOptimizedCodeAreWeak': [FAIL],
# TurboFan cpu profiler result is different. # TurboFan cpu profiler result is different.
'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL],
'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL],
......
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