Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: src/compiler/escape-analysis.cc

Issue 1659503002: [turbofan] Improve some heuristics in escape analysis (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Maybe this works on w64, too Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/escape-analysis.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/escape-analysis.cc
diff --git a/src/compiler/escape-analysis.cc b/src/compiler/escape-analysis.cc
index efd80dff9450f1e36bb2179c6f2d0e430a2b736c..ccb2346ded7d4bbd40ff5c105ffbe05524389df2 100644
--- a/src/compiler/escape-analysis.cc
+++ b/src/compiler/escape-analysis.cc
@@ -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;
- status_analysis_.ResizeStatusVector();
- RunObjectAnalysis();
- status_analysis_.RunStatusAnalysis();
+ 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()];
« no previous file with comments | « src/compiler/escape-analysis.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698