Commit 2da3e84e authored by jarin@chromium.org's avatar jarin@chromium.org

Improve memory usage in Turbofan.

BUG=
R=bmeurer@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24198 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 17a01814
......@@ -14,8 +14,9 @@ namespace compiler {
template <class Visitor>
void Graph::VisitNodeUsesFrom(Node* node, Visitor* visitor) {
Zone tmp_zone(zone()->isolate());
GenericGraphVisit::Visit<Visitor, NodeUseIterationTraits<Node> >(
this, zone(), node, visitor);
this, &tmp_zone, node, visitor);
}
......@@ -27,8 +28,9 @@ void Graph::VisitNodeUsesFromStart(Visitor* visitor) {
template <class Visitor>
void Graph::VisitNodeInputsFromEnd(Visitor* visitor) {
Zone tmp_zone(zone()->isolate());
GenericGraphVisit::Visit<Visitor, NodeInputIterationTraits<Node> >(
this, zone(), end(), visitor);
this, &tmp_zone, end(), visitor);
}
}
}
......
......@@ -155,7 +155,7 @@ typedef BasicBlockVector::reverse_iterator BasicBlockVectorRIter;
// by the graph's dependencies. A schedule is required to generate code.
class Schedule : public GenericGraph<BasicBlock> {
public:
explicit Schedule(Zone* zone)
explicit Schedule(Zone* zone, size_t node_count_hint = 0)
: GenericGraph<BasicBlock>(zone),
zone_(zone),
all_blocks_(zone),
......@@ -163,6 +163,7 @@ class Schedule : public GenericGraph<BasicBlock> {
rpo_order_(zone) {
SetStart(NewBasicBlock()); // entry.
SetEnd(NewBasicBlock()); // exit.
nodeid_to_block_.reserve(node_count_hint);
}
// Return the block which contains {node}, if any.
......
......@@ -239,7 +239,8 @@ Schedule* Scheduler::ComputeSchedule(Graph* graph) {
bool had_floating_control = false;
do {
Zone tmp_zone(graph->zone()->isolate());
schedule = new (graph->zone()) Schedule(graph->zone());
schedule = new (graph->zone())
Schedule(graph->zone(), static_cast<size_t>(graph->NodeCount()));
Scheduler scheduler(&tmp_zone, graph, schedule);
scheduler.BuildCFG();
......
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