Revision: 23103
Author:   [email protected]
Date:     Wed Aug 13 12:36:09 2014 UTC
Log:      Allow use of phase-local zone in GenericGraphVisit.

[email protected], [email protected]

Review URL: https://codereview.chromium.org/467103003
http://code.google.com/p/v8/source/detail?r=23103

Modified:
 /branches/bleeding_edge/src/compiler/generic-algorithm.h
 /branches/bleeding_edge/src/compiler/graph-inl.h
 /branches/bleeding_edge/src/compiler/graph-visualizer.cc
 /branches/bleeding_edge/src/compiler/scheduler.cc
 /branches/bleeding_edge/src/compiler/scheduler.h

=======================================
--- /branches/bleeding_edge/src/compiler/generic-algorithm.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/compiler/generic-algorithm.h Wed Aug 13 12:36:09 2014 UTC
@@ -38,10 +38,9 @@
   //   void PostEdge(Traits::Node* from, int index, Traits::Node* to);
   // }
   template <class Visitor, class Traits, class RootIterator>
-  static void Visit(GenericGraphBase* graph, RootIterator root_begin,
-                    RootIterator root_end, Visitor* visitor) {
-    // TODO(bmeurer): Pass "local" zone as parameter.
-    Zone* zone = graph->zone();
+  static void Visit(GenericGraphBase* graph, Zone* zone,
+                    RootIterator root_begin, RootIterator root_end,
+                    Visitor* visitor) {
     typedef typename Traits::Node Node;
     typedef typename Traits::Iterator Iterator;
     typedef std::pair<Iterator, Iterator> NodeState;
@@ -97,10 +96,10 @@
   }

   template <class Visitor, class Traits>
- static void Visit(GenericGraphBase* graph, typename Traits::Node* current,
-                    Visitor* visitor) {
+  static void Visit(GenericGraphBase* graph, Zone* zone,
+                    typename Traits::Node* current, Visitor* visitor) {
     typename Traits::Node* array[] = {current};
-    Visit<Visitor, Traits>(graph, &array[0], &array[1], visitor);
+    Visit<Visitor, Traits>(graph, zone, &array[0], &array[1], visitor);
   }

   template <class B, class S>
=======================================
--- /branches/bleeding_edge/src/compiler/graph-inl.h Wed Jul 30 13:54:45 2014 UTC +++ /branches/bleeding_edge/src/compiler/graph-inl.h Wed Aug 13 12:36:09 2014 UTC
@@ -14,8 +14,8 @@

 template <class Visitor>
 void Graph::VisitNodeUsesFrom(Node* node, Visitor* visitor) {
- GenericGraphVisit::Visit<Visitor, NodeUseIterationTraits<Node> >(this, node, - visitor);
+  GenericGraphVisit::Visit<Visitor, NodeUseIterationTraits<Node> >(
+      this, zone(), node, visitor);
 }


@@ -28,7 +28,7 @@
 template <class Visitor>
 void Graph::VisitNodeInputsFromEnd(Visitor* visitor) {
   GenericGraphVisit::Visit<Visitor, NodeInputIterationTraits<Node> >(
-      this, end(), visitor);
+      this, zone(), end(), visitor);
 }
 }
 }
=======================================
--- /branches/bleeding_edge/src/compiler/graph-visualizer.cc Thu Aug 7 09:14:47 2014 UTC +++ /branches/bleeding_edge/src/compiler/graph-visualizer.cc Wed Aug 13 12:36:09 2014 UTC
@@ -24,7 +24,7 @@

 class GraphVisualizer : public NullNodeVisitor {
  public:
-  GraphVisualizer(OStream& os, const Graph* graph);  // NOLINT
+  GraphVisualizer(OStream& os, Zone* zone, const Graph* graph);  // NOLINT

   void Print();

@@ -35,6 +35,7 @@
   void AnnotateNode(Node* node);
   void PrintEdge(Node* from, int index, Node* to);

+  Zone* zone_;
   NodeSet all_nodes_;
   NodeSet white_nodes_;
   bool use_to_def_;
@@ -225,8 +226,8 @@
   // Visit all uses of white nodes.
   use_to_def_ = false;
   GenericGraphVisit::Visit<GraphVisualizer, NodeUseIterationTraits<Node> >(
-      const_cast<Graph*>(graph_), white_nodes_.begin(), white_nodes_.end(),
-      this);
+      const_cast<Graph*>(graph_), zone_, white_nodes_.begin(),
+      white_nodes_.end(), this);

   os_ << "  DEAD_INPUT [\n"
       << "    style=\"filled\" \n"
@@ -246,18 +247,19 @@
 }


-GraphVisualizer::GraphVisualizer(OStream& os, const Graph* graph) // NOLINT
-    : all_nodes_(NodeSet::key_compare(),
-                 NodeSet::allocator_type(graph->zone())),
-      white_nodes_(NodeSet::key_compare(),
-                   NodeSet::allocator_type(graph->zone())),
+GraphVisualizer::GraphVisualizer(OStream& os, Zone* zone,
+                                 const Graph* graph)  // NOLINT
+    : zone_(zone),
+      all_nodes_(NodeSet::key_compare(), NodeSet::allocator_type(zone)),
+      white_nodes_(NodeSet::key_compare(), NodeSet::allocator_type(zone)),
       use_to_def_(true),
       os_(os),
       graph_(graph) {}


 OStream& operator<<(OStream& os, const AsDOT& ad) {
-  GraphVisualizer(os, &ad.graph).Print();
+  Zone tmp_zone(ad.graph.zone()->isolate());
+  GraphVisualizer(os, &tmp_zone, &ad.graph).Print();
   return os;
 }
 }
=======================================
--- /branches/bleeding_edge/src/compiler/scheduler.cc Mon Aug 11 13:10:54 2014 UTC +++ /branches/bleeding_edge/src/compiler/scheduler.cc Wed Aug 13 12:36:09 2014 UTC
@@ -16,7 +16,8 @@
 namespace compiler {

 Scheduler::Scheduler(Zone* zone, Graph* graph, Schedule* schedule)
-    : graph_(graph),
+    : zone_(zone),
+      graph_(graph),
       schedule_(schedule),
       branches_(NodeVector::allocator_type(zone)),
       calls_(NodeVector::allocator_type(zone)),
@@ -624,7 +625,7 @@
        i != schedule_root_nodes_.end(); ++i) {
     GenericGraphVisit::Visit<ScheduleLateNodeVisitor,
                              NodeInputIterationTraits<Node> >(
-        graph_, *i, &schedule_late_visitor);
+        graph_, zone_, *i, &schedule_late_visitor);
   }

// Add collected nodes for basic blocks to their blocks in the right order.
=======================================
--- /branches/bleeding_edge/src/compiler/scheduler.h Mon Aug 11 13:10:54 2014 UTC +++ /branches/bleeding_edge/src/compiler/scheduler.h Wed Aug 13 12:36:09 2014 UTC
@@ -29,6 +29,7 @@
   static BasicBlockVector* ComputeSpecialRPO(Schedule* schedule);

  private:
+  Zone* zone_;
   Graph* graph_;
   Schedule* schedule_;
   NodeVector branches_;

--
--
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.

Reply via email to