Commit 6298f4fc authored by sigurds's avatar sigurds Committed by Commit bot

[turbofan] Improve some heuristics in escape analysis

BUG=v8:4586
LOG=n

Review URL: https://codereview.chromium.org/1659503002

Cr-Commit-Position: refs/heads/master@{#33648}
parent 2f813aa6
......@@ -94,7 +94,7 @@ class VirtualObject : public ZoneObject {
Node** fields_array() { return &fields_.front(); }
size_t field_count() { return fields_.size(); }
bool ResizeFields(size_t field_count) {
if (field_count != fields_.size()) {
if (field_count > fields_.size()) {
fields_.resize(field_count);
phi_.resize(field_count);
return true;
......@@ -758,21 +758,31 @@ EscapeAnalysis::EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common,
common_(common),
virtual_states_(zone),
replacements_(zone),
cache_(new (zone) MergeCache(zone)) {}
cache_(nullptr) {}
EscapeAnalysis::~EscapeAnalysis() {}
void EscapeAnalysis::Run() {
replacements_.resize(graph()->NodeCount());
status_analysis_.AssignAliases();
if (status_analysis_.AliasCount() == 0) return;
if (status_analysis_.AliasCount() > 0) {
cache_ = new (zone()) MergeCache(zone());
replacements_.resize(graph()->NodeCount());
status_analysis_.ResizeStatusVector();
RunObjectAnalysis();
status_analysis_.RunStatusAnalysis();
}
}
void EscapeStatusAnalysis::AssignAliases() {
stack_.reserve(graph()->NodeCount() * 0.2);
size_t max_size = 1024;
size_t min_size = 32;
size_t stack_size = std::min(
std::max(
std::min(graph()->NodeCount() / 5, graph()->NodeCount() / 20 + 128),
min_size),
max_size);
stack_.reserve(stack_size);
ResizeStatusVector();
stack_.push_back(graph()->end());
CHECK_LT(graph()->NodeCount(), kUntrackable);
......@@ -808,11 +818,6 @@ void EscapeStatusAnalysis::AssignAliases() {
aliases_[node->id()] = aliases_[allocate->id()];
TRACE(" @%d:%s#%u", aliases_[node->id()], node->op()->mnemonic(),
node->id());
} else {
aliases_[node->id()] = NextAlias();
TRACE(" @%d:%s#%u", aliases_[node->id()], node->op()->mnemonic(),
node->id());
}
break;
}
......@@ -992,7 +997,7 @@ void EscapeAnalysis::ProcessAllocationUsers(Node* node) {
case IrOpcode::kStateValues:
case IrOpcode::kReferenceEqual:
case IrOpcode::kFinishRegion:
case IrOpcode::kPhi:
case IrOpcode::kObjectIsSmi:
break;
default:
VirtualState* state = virtual_states_[node->id()];
......
......@@ -73,7 +73,6 @@ class EscapeStatusAnalysis {
static const Alias kUntrackable;
bool IsNotReachable(Node* node);
ZoneVector<Node*>& stack() { return stack_; }
private:
void Process(Node* node);
......@@ -170,7 +169,6 @@ class EscapeAnalysis {
Graph* graph() const { return status_analysis_.graph(); }
Zone* zone() const { return status_analysis_.zone(); }
CommonOperatorBuilder* common() const { return common_; }
ZoneVector<Node*>& stack() { return status_analysis_.stack(); }
bool IsEffectBranchPoint(Node* node) {
return status_analysis_.IsEffectBranchPoint(node);
}
......
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