Reviewers: Benedikt Meurer,
Message:
Could you take a look, please?
Description:
Improve memory usage in Turbofan.
BUG=
Please review this at https://codereview.chromium.org/602643002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+8, -4 lines):
M src/compiler/graph-inl.h
M src/compiler/schedule.h
M src/compiler/scheduler.cc
Index: src/compiler/graph-inl.h
diff --git a/src/compiler/graph-inl.h b/src/compiler/graph-inl.h
index
571ffb3c5b6f114d571ebf387f2235da516f271c..efebf7bcb9b866327fd861eecb43cd3b68c87fde
100644
--- a/src/compiler/graph-inl.h
+++ b/src/compiler/graph-inl.h
@@ -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);
}
}
}
Index: src/compiler/schedule.h
diff --git a/src/compiler/schedule.h b/src/compiler/schedule.h
index
070691e4c6e8af7d6293875bae714abfeead9cb9..0ea499cf15f8b096fca89f39300431f917f415b6
100644
--- a/src/compiler/schedule.h
+++ b/src/compiler/schedule.h
@@ -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.
Index: src/compiler/scheduler.cc
diff --git a/src/compiler/scheduler.cc b/src/compiler/scheduler.cc
index
402995006b410b9f2fc45df9b53f36b00f677acc..58878a0776bfeb483cb68811df0066db32bbf586
100644
--- a/src/compiler/scheduler.cc
+++ b/src/compiler/scheduler.cc
@@ -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();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.