Commit a5c29021 authored by jarin's avatar jarin Committed by Commit bot

[turbofan] Change map to vector in loop variable analysis.

This recovers about 50% of the regression in compilation time.

BUG=chromium:638208

Review-Url: https://codereview.chromium.org/2274053002
Cr-Commit-Position: refs/heads/master@{#38854}
parent 920f5fcd
...@@ -28,7 +28,7 @@ LoopVariableOptimizer::LoopVariableOptimizer(Graph* graph, ...@@ -28,7 +28,7 @@ LoopVariableOptimizer::LoopVariableOptimizer(Graph* graph,
: graph_(graph), : graph_(graph),
common_(common), common_(common),
zone_(zone), zone_(zone),
limits_(zone), limits_(graph->NodeCount(), zone),
induction_vars_(zone) {} induction_vars_(zone) {}
void LoopVariableOptimizer::Run() { void LoopVariableOptimizer::Run() {
...@@ -40,14 +40,13 @@ void LoopVariableOptimizer::Run() { ...@@ -40,14 +40,13 @@ void LoopVariableOptimizer::Run() {
queue.pop(); queue.pop();
queued.Set(node, false); queued.Set(node, false);
DCHECK(limits_.find(node->id()) == limits_.end()); DCHECK_NULL(limits_[node->id()]);
bool all_inputs_visited = true; bool all_inputs_visited = true;
int inputs_end = (node->opcode() == IrOpcode::kLoop) int inputs_end = (node->opcode() == IrOpcode::kLoop)
? kFirstBackedge ? kFirstBackedge
: node->op()->ControlInputCount(); : node->op()->ControlInputCount();
for (int i = 0; i < inputs_end; i++) { for (int i = 0; i < inputs_end; i++) {
auto input = limits_.find(NodeProperties::GetControlInput(node, i)->id()); if (limits_[NodeProperties::GetControlInput(node, i)->id()] == nullptr) {
if (input == limits_.end()) {
all_inputs_visited = false; all_inputs_visited = false;
break; break;
} }
...@@ -55,7 +54,7 @@ void LoopVariableOptimizer::Run() { ...@@ -55,7 +54,7 @@ void LoopVariableOptimizer::Run() {
if (!all_inputs_visited) continue; if (!all_inputs_visited) continue;
VisitNode(node); VisitNode(node);
DCHECK(limits_.find(node->id()) != limits_.end()); DCHECK_NOT_NULL(limits_[node->id()]);
// Queue control outputs. // Queue control outputs.
for (Edge edge : node->use_edges()) { for (Edge edge : node->use_edges()) {
......
...@@ -106,7 +106,7 @@ class LoopVariableOptimizer { ...@@ -106,7 +106,7 @@ class LoopVariableOptimizer {
Graph* graph_; Graph* graph_;
CommonOperatorBuilder* common_; CommonOperatorBuilder* common_;
Zone* zone_; Zone* zone_;
ZoneMap<int, const VariableLimits*> limits_; ZoneVector<const VariableLimits*> limits_;
ZoneMap<int, InductionVariable*> induction_vars_; ZoneMap<int, InductionVariable*> induction_vars_;
}; };
......
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