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

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

Issue 2606273002: [Turbofan] Run escape analysis concurrently. (Closed)
Patch Set: REBASE. Created 3 years, 12 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 | « no previous file | src/compiler/escape-analysis-reducer.cc » ('j') | src/compiler/pipeline.cc » ('J')
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 273aca1ecd963813cfdfd1c2688ed14a35b34288..b46efdf0772ab7251db4119cd0b4f64fa3db0c14 100644
--- a/src/compiler/escape-analysis.cc
+++ b/src/compiler/escape-analysis.cc
@@ -200,7 +200,7 @@ class VirtualObject : public ZoneObject {
return true;
}
bool UpdateFrom(const VirtualObject& other);
- bool MergeFrom(MergeCache* cache, Node* at, Graph* graph,
+ bool MergeFrom(MergeCache* cache, Zone* zone, Node* at, Graph* graph,
CommonOperatorBuilder* common);
void SetObjectState(Node* node) { object_state_ = node; }
Node* GetObjectState() const { return object_state_; }
@@ -217,8 +217,8 @@ class VirtualObject : public ZoneObject {
void id(NodeId id) { id_ = id; }
private:
- bool MergeFields(size_t i, Node* at, MergeCache* cache, Graph* graph,
- CommonOperatorBuilder* common);
+ bool MergeFields(size_t i, Zone* zone, Node* at, MergeCache* cache,
+ Graph* graph, CommonOperatorBuilder* common);
NodeId id_;
StatusFlags status_;
@@ -432,10 +432,23 @@ bool IsEquivalentPhi(Node* phi, ZoneVector<Node*>& inputs) {
return true;
}
+Type* GetTypeForPhi(Node* phi, Zone* zone) {
+ int arity = phi->op()->ValueInputCount();
+ Type* type = Type::None();
+ for (int i = 1; i < arity; ++i) {
+ Node* inner_node = NodeProperties::GetValueInput(phi, i);
+ Type* inner_type = NodeProperties::IsTyped(inner_node)
+ ? NodeProperties::GetType(inner_node)
+ : Type::None();
+ type = Type::Union(type, inner_type, zone);
+ }
+ return type;
+}
} // namespace
-bool VirtualObject::MergeFields(size_t i, Node* at, MergeCache* cache,
- Graph* graph, CommonOperatorBuilder* common) {
+bool VirtualObject::MergeFields(size_t i, Zone* zone, Node* at,
+ MergeCache* cache, Graph* graph,
+ CommonOperatorBuilder* common) {
bool changed = false;
int value_input_count = static_cast<int>(cache->fields().size());
Node* rep = GetField(i);
@@ -446,6 +459,8 @@ bool VirtualObject::MergeFields(size_t i, Node* at, MergeCache* cache,
common->Phi(MachineRepresentation::kTagged, value_input_count),
value_input_count + 1, &cache->fields().front());
SetField(i, phi, true);
+ NodeProperties::SetType(phi, GetTypeForPhi(phi, zone));
+
#ifdef DEBUG
if (FLAG_trace_turbo_escape) {
PrintF(" Creating Phi #%d as merge of", phi->id());
@@ -470,8 +485,8 @@ bool VirtualObject::MergeFields(size_t i, Node* at, MergeCache* cache,
return changed;
}
-bool VirtualObject::MergeFrom(MergeCache* cache, Node* at, Graph* graph,
- CommonOperatorBuilder* common) {
+bool VirtualObject::MergeFrom(MergeCache* cache, Zone* zone, Node* at,
+ Graph* graph, CommonOperatorBuilder* common) {
DCHECK(at->opcode() == IrOpcode::kEffectPhi ||
at->opcode() == IrOpcode::kPhi);
bool changed = false;
@@ -487,7 +502,7 @@ bool VirtualObject::MergeFrom(MergeCache* cache, Node* at, Graph* graph,
: at->op()->ValueInputCount();
if (cache->fields().size() == arity &&
(GetField(i) || !IsCreatedPhi(i))) {
- changed = MergeFields(i, at, cache, graph, common) || changed;
+ changed = MergeFields(i, zone, at, cache, graph, common) || changed;
} else {
if (GetField(i) != nullptr) {
TRACE(" Field %zu cleared\n", i);
@@ -544,7 +559,8 @@ bool VirtualState::MergeFrom(MergeCache* cache, Zone* zone, Graph* graph,
PrintF("\n");
}
#endif // DEBUG
- changed = mergeObject->MergeFrom(cache, at, graph, common) || changed;
+ changed =
+ mergeObject->MergeFrom(cache, zone, at, graph, common) || changed;
} else {
if (mergeObject) {
TRACE(" Alias %d, virtual object removed\n", alias);
@@ -866,7 +882,11 @@ EscapeAnalysis::EscapeAnalysis(Graph* graph, CommonOperatorBuilder* common,
virtual_states_(zone),
replacements_(zone),
cycle_detection_(zone),
- cache_(nullptr) {}
+ cache_(nullptr) {
+ // Type slot_not_analyzed_ manually.
+ double v = OpParameter<double>(slot_not_analyzed_);
+ NodeProperties::SetType(slot_not_analyzed_, Type::Range(v, v, zone));
+}
EscapeAnalysis::~EscapeAnalysis() {}
@@ -1403,6 +1423,7 @@ void EscapeAnalysis::ProcessLoadFromPhi(int offset, Node* from, Node* load,
Node* phi = graph()->NewNode(
common()->Phi(MachineRepresentation::kTagged, value_input_count),
value_input_count + 1, &cache_->fields().front());
+ NodeProperties::SetType(phi, GetTypeForPhi(phi, zone()));
status_analysis_->ResizeStatusVector();
SetReplacement(load, phi);
TRACE(" got phi created.\n");
@@ -1596,6 +1617,7 @@ Node* EscapeAnalysis::GetOrCreateObjectState(Node* effect, Node* node) {
Node* new_object_state =
graph()->NewNode(common()->ObjectState(input_count), input_count,
&cache_->fields().front());
+ NodeProperties::SetType(new_object_state, Type::Internal());
vobj->SetObjectState(new_object_state);
TRACE(
"Creating object state #%d for vobj %p (from node #%d) at effect "
« no previous file with comments | « no previous file | src/compiler/escape-analysis-reducer.cc » ('j') | src/compiler/pipeline.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698