Reviewers: Benedikt Meurer,

Message:
Committed patchset #2 (id:170001) manually as 24545 (presubmit successful).

Description:
[turbofan] remove graph from InstructionSequence

[email protected]

BUG=

Committed: https://code.google.com/p/v8/source/detail?r=24545

Please review this at https://codereview.chromium.org/652643002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+11, -13 lines):
  M src/compiler/code-generator.h
  M src/compiler/instruction.h
  M src/compiler/instruction.cc
  M src/compiler/instruction-selector.h
  M src/compiler/instruction-selector.cc
  M src/compiler/instruction-selector-impl.h
  M test/cctest/compiler/test-instruction.cc


Index: src/compiler/code-generator.h
diff --git a/src/compiler/code-generator.h b/src/compiler/code-generator.h
index 6bf96accc8de566387eedfdc5aad977217a2533b..e740dd3a26641f7a86b13f333325a5f1672c2450 100644
--- a/src/compiler/code-generator.h
+++ b/src/compiler/code-generator.h
@@ -27,7 +27,6 @@ class CodeGenerator FINAL : public GapResolver::Assembler {

   InstructionSequence* code() const { return code_; }
   Frame* frame() const { return code()->frame(); }
-  Graph* graph() const { return code()->graph(); }
   Isolate* isolate() const { return zone()->isolate(); }
   Linkage* linkage() const { return code()->linkage(); }
   Schedule* schedule() const { return code()->schedule(); }
Index: src/compiler/instruction-selector-impl.h
diff --git a/src/compiler/instruction-selector-impl.h b/src/compiler/instruction-selector-impl.h index 600ac399da7544368b54380e7021d36f8f06eeb4..1c8c17533055578b1252acfb6023d81d39e4cc23 100644
--- a/src/compiler/instruction-selector-impl.h
+++ b/src/compiler/instruction-selector-impl.h
@@ -134,7 +134,6 @@ class OperandGenerator {
   }

  protected:
-  Graph* graph() const { return selector()->graph(); }
   InstructionSelector* selector() const { return selector_; }
   InstructionSequence* sequence() const { return selector()->sequence(); }
   Isolate* isolate() const { return zone()->isolate(); }
Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc index 791aa2911c9decdc19596b50c817d888eb2b7ddd..72a7ed27399e7e3ddc57390376b629c7564ec984 100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -22,8 +22,8 @@ InstructionSelector::InstructionSelector(InstructionSequence* sequence,
       features_(features),
       current_block_(NULL),
       instructions_(zone()),
-      defined_(graph()->NodeCount(), false, zone()),
-      used_(graph()->NodeCount(), false, zone()) {}
+      defined_(sequence->node_count(), false, zone()),
+      used_(sequence->node_count(), false, zone()) {}


 void InstructionSelector::SelectInstructions() {
Index: src/compiler/instruction-selector.h
diff --git a/src/compiler/instruction-selector.h b/src/compiler/instruction-selector.h index 9178262c9a8b0380fb859c5a48b1620da5a30a87..5d64ec85aa0011d57d0d4ea25c137c837213fbc1 100644
--- a/src/compiler/instruction-selector.h
+++ b/src/compiler/instruction-selector.h
@@ -193,7 +193,6 @@ class InstructionSelector FINAL {

// ===========================================================================

-  Graph* graph() const { return sequence()->graph(); }
   Linkage* linkage() const { return sequence()->linkage(); }
   Schedule* schedule() const { return sequence()->schedule(); }
   InstructionSequence* sequence() const { return sequence_; }
Index: src/compiler/instruction.cc
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc
index 635a6bde27808a49363d79770635139b2d03a8c4..4a1cd1a12aff178a517b1feba35cad72d10ae002 100644
--- a/src/compiler/instruction.cc
+++ b/src/compiler/instruction.cc
@@ -318,8 +318,9 @@ std::ostream& operator<<(std::ostream& os, const Constant& constant) {

 InstructionSequence::InstructionSequence(Linkage* linkage, Graph* graph,
                                          Schedule* schedule)
-    : graph_(graph),
-      node_map_(zone()->NewArray<int>(graph->NodeCount())),
+    : zone_(schedule->zone()),
+      node_count_(graph->NodeCount()),
+      node_map_(zone()->NewArray<int>(node_count_)),
       linkage_(linkage),
       schedule_(schedule),
       constants_(ConstantMap::key_compare(),
@@ -331,7 +332,7 @@ InstructionSequence::InstructionSequence(Linkage* linkage, Graph* graph, doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
       deoptimization_entries_(zone()) {
-  for (int i = 0; i < graph->NodeCount(); ++i) {
+  for (int i = 0; i < node_count_; ++i) {
     node_map_[i] = -1;
   }
 }
Index: src/compiler/instruction.h
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h
index b769a1db0999ec2873291ae64c43ca92787cbc65..2bb2b72c1b89380ddb97b7bd21c9a0d24753b931 100644
--- a/src/compiler/instruction.h
+++ b/src/compiler/instruction.h
@@ -767,7 +767,7 @@ class InstructionSequence FINAL {
   int NextVirtualRegister() { return next_virtual_register_++; }
   int VirtualRegisterCount() const { return next_virtual_register_; }

-  int ValueCount() const { return graph_->NodeCount(); }
+  int node_count() const { return node_count_; }

   int BasicBlockCount() const {
     return static_cast<int>(schedule_->rpo_order()->size());
@@ -815,12 +815,11 @@ class InstructionSequence FINAL {
   }

   Frame* frame() { return &frame_; }
-  Graph* graph() const { return graph_; }
   Isolate* isolate() const { return zone()->isolate(); }
   Linkage* linkage() const { return linkage_; }
   Schedule* schedule() const { return schedule_; }
   const PointerMapDeque* pointer_maps() const { return &pointer_maps_; }
-  Zone* zone() const { return graph_->zone(); }
+  Zone* zone() const { return zone_; }

   // Used by the code generator while adding instructions.
   int AddInstruction(Instruction* instr, BasicBlock* block);
@@ -874,7 +873,8 @@ class InstructionSequence FINAL {

typedef std::set<int, std::less<int>, ZoneIntAllocator> VirtualRegisterSet;

-  Graph* graph_;
+  Zone* zone_;
+  int node_count_;
   int* node_map_;
   Linkage* linkage_;
   Schedule* schedule_;
Index: test/cctest/compiler/test-instruction.cc
diff --git a/test/cctest/compiler/test-instruction.cc b/test/cctest/compiler/test-instruction.cc index a9feaac2c854476862c889a10322f4f7f2abcb37..073d584489f565180c7a27e7846977dd85dd28ec 100644
--- a/test/cctest/compiler/test-instruction.cc
+++ b/test/cctest/compiler/test-instruction.cc
@@ -112,7 +112,7 @@ TEST(InstructionBasic) {

   R.allocCode();

-  CHECK_EQ(R.graph.NodeCount(), R.code->ValueCount());
+  CHECK_EQ(R.graph.NodeCount(), R.code->node_count());

   BasicBlockVector* blocks = R.schedule.rpo_order();
   CHECK_EQ(static_cast<int>(blocks->size()), R.code->BasicBlockCount());


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