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

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

Issue 1530143002: [turbofan] Fix ASAN bug in escape analysis (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Don't write code in DCHECK :) Created 5 years 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 ebeae3218109786c139b0e31a555d2ce7afce0df..1575d5ae217dc716044995e95535d42fc032d982 100644
--- a/src/compiler/escape-analysis.cc
+++ b/src/compiler/escape-analysis.cc
@@ -390,17 +390,16 @@ bool VirtualState::MergeFrom(MergeCache* cache, Zone* zone, Graph* graph,
graph->NewNode(common->Phi(MachineRepresentation::kTagged, 2),
static_cast<int>(cache->fields().size()),
&cache->fields().front());
- if (mergeObject->SetField(i, phi, true)) {
- if (FLAG_trace_turbo_escape) {
- PrintF(" Creating Phi #%d as merge of", phi->id());
- for (size_t i = 0; i + 1 < cache->fields().size(); i++) {
- PrintF(" #%d (%s)", cache->fields()[i]->id(),
- cache->fields()[i]->op()->mnemonic());
- }
- PrintF("\n");
+ mergeObject->SetField(i, phi, true);
+ if (FLAG_trace_turbo_escape) {
+ PrintF(" Creating Phi #%d as merge of", phi->id());
+ for (size_t i = 0; i + 1 < cache->fields().size(); i++) {
+ PrintF(" #%d (%s)", cache->fields()[i]->id(),
+ cache->fields()[i]->op()->mnemonic());
}
- changed = true;
+ PrintF("\n");
}
+ changed = true;
} else {
DCHECK(rep->opcode() == IrOpcode::kPhi);
for (size_t n = 0; n < cache->fields().size(); ++n) {
@@ -444,10 +443,8 @@ EscapeStatusAnalysis::EscapeStatusAnalysis(EscapeAnalysis* object_analysis,
: object_analysis_(object_analysis),
graph_(graph),
zone_(zone),
- info_(zone),
- queue_(zone) {
- info_.resize(graph->NodeCount());
-}
+ info_(graph->NodeCount(), kUnknown, zone),
+ queue_(zone) {}
EscapeStatusAnalysis::~EscapeStatusAnalysis() {}
@@ -459,9 +456,6 @@ bool EscapeStatusAnalysis::HasEntry(Node* node) {
bool EscapeStatusAnalysis::IsVirtual(Node* node) {
- if (node->id() >= info_.size()) {
- return false;
- }
return info_[node->id()] == kVirtual;
}
@@ -484,8 +478,16 @@ bool EscapeStatusAnalysis::SetEscaped(Node* node) {
}
+void EscapeStatusAnalysis::Resize() {
+ info_.resize(graph()->NodeCount(), kUnknown);
+}
+
+
+size_t EscapeStatusAnalysis::size() { return info_.size(); }
+
+
void EscapeStatusAnalysis::Run() {
- info_.resize(graph()->NodeCount());
+ Resize();
ZoneVector<bool> visited(zone());
visited.resize(graph()->NodeCount());
queue_.push_back(graph()->end());
@@ -967,6 +969,7 @@ bool EscapeAnalysis::ProcessEffectPhi(Node* node) {
if (changed) {
mergeState->LastChangedAt(node);
+ escape_status_.Resize();
}
return changed;
}
@@ -1072,11 +1075,17 @@ Node* EscapeAnalysis::GetReplacement(NodeId id) {
bool EscapeAnalysis::IsVirtual(Node* node) {
+ if (node->id() >= escape_status_.size()) {
+ return false;
+ }
return escape_status_.IsVirtual(node);
}
bool EscapeAnalysis::IsEscaped(Node* node) {
+ if (node->id() >= escape_status_.size()) {
+ return false;
+ }
return escape_status_.IsEscaped(node);
}
@@ -1133,6 +1142,7 @@ void EscapeAnalysis::ProcessLoadFromPhi(int offset, Node* from, Node* node,
Node* phi = graph()->NewNode(
common()->Phi(MachineRepresentation::kTagged, 2),
static_cast<int>(cache_.fields().size()), &cache_.fields().front());
+ escape_status_.Resize();
SetReplacement(node, phi);
state->LastChangedAt(node);
if (FLAG_trace_turbo_escape) {
« 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