[turbofan] remove schedule from InstructionSequence
authordcarney@chromium.org <dcarney@chromium.org>
Mon, 20 Oct 2014 10:19:15 +0000 (10:19 +0000)
committerdcarney@chromium.org <dcarney@chromium.org>
Mon, 20 Oct 2014 10:19:15 +0000 (10:19 +0000)
R=bmeurer@chromium.org

BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24726 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

12 files changed:
src/compiler/code-generator.h
src/compiler/graph-visualizer.cc
src/compiler/instruction-selector.cc
src/compiler/instruction-selector.h
src/compiler/instruction.cc
src/compiler/instruction.h
src/compiler/pipeline.cc
src/compiler/schedule.cc
src/compiler/schedule.h
test/cctest/compiler/test-codegen-deopt.cc
test/cctest/compiler/test-instruction.cc
test/unittests/compiler/instruction-selector-unittest.cc

index 69d9f63..8b1c9d5 100644 (file)
@@ -29,7 +29,6 @@ class CodeGenerator FINAL : public GapResolver::Assembler {
   Frame* frame() const { return code()->frame(); }
   Isolate* isolate() const { return zone()->isolate(); }
   Linkage* linkage() const { return code()->linkage(); }
-  Schedule* schedule() const { return code()->schedule(); }
 
  private:
   MacroAssembler* masm() { return &masm_; }
index 97fb832..8cd9a71 100644 (file)
@@ -593,9 +593,11 @@ void GraphC1Visualizer::PrintSchedule(const char* phase,
 
     PrintIntProperty("loop_depth", current->loop_depth());
 
-    if (instructions->code_start(current) >= 0) {
-      int first_index = instructions->first_instruction_index(current);
-      int last_index = instructions->last_instruction_index(current);
+    const InstructionBlock* instruction_block =
+        instructions->InstructionBlockAt(current->GetRpoNumber());
+    if (instruction_block->code_start() >= 0) {
+      int first_index = instruction_block->first_instruction_index();
+      int last_index = instruction_block->last_instruction_index();
       PrintIntProperty("first_lir_id", LifetimePosition::FromInstructionIndex(
                                            first_index).Value());
       PrintIntProperty("last_lir_id", LifetimePosition::FromInstructionIndex(
@@ -674,8 +676,8 @@ void GraphC1Visualizer::PrintSchedule(const char* phase,
 
     if (instructions != NULL) {
       Tag LIR_tag(this, "LIR");
-      for (int j = instructions->first_instruction_index(current);
-           j <= instructions->last_instruction_index(current); j++) {
+      for (int j = instruction_block->first_instruction_index();
+           j <= instruction_block->last_instruction_index(); j++) {
         PrintIndent();
         os_ << j << " " << *instructions->InstructionAt(j) << " <|@\n";
       }
index 1575093..b0a6fce 100644 (file)
@@ -14,12 +14,14 @@ namespace internal {
 namespace compiler {
 
 InstructionSelector::InstructionSelector(InstructionSequence* sequence,
+                                         Schedule* schedule,
                                          SourcePositionTable* source_positions,
                                          Features features)
     : zone_(sequence->isolate()),
       sequence_(sequence),
       source_positions_(source_positions),
       features_(features),
+      schedule_(schedule),
       current_block_(NULL),
       instructions_(zone()),
       defined_(sequence->node_count(), false, zone()),
@@ -55,8 +57,10 @@ void InstructionSelector::SelectInstructions() {
   // Schedule the selected instructions.
   for (BasicBlockVectorIter i = blocks->begin(); i != blocks->end(); ++i) {
     BasicBlock* block = *i;
-    size_t end = sequence()->code_end(block);
-    size_t start = sequence()->code_start(block);
+    InstructionBlock* instruction_block =
+        sequence()->InstructionBlockAt(block->GetRpoNumber());
+    size_t end = instruction_block->code_end();
+    size_t start = instruction_block->code_start();
     sequence()->StartBlock(block);
     while (start-- > end) {
       sequence()->AddInstruction(instructions_[start]);
@@ -383,8 +387,10 @@ void InstructionSelector::VisitBlock(BasicBlock* block) {
   }
 
   // We're done with the block.
-  sequence()->set_code_start(block, static_cast<int>(instructions_.size()));
-  sequence()->set_code_end(block, current_block_end);
+  InstructionBlock* instruction_block =
+      sequence()->InstructionBlockAt(block->GetRpoNumber());
+  instruction_block->set_code_start(static_cast<int>(instructions_.size()));
+  instruction_block->set_code_end(current_block_end);
 
   current_block_ = NULL;
 }
@@ -856,14 +862,12 @@ void InstructionSelector::VisitPhi(Node* node) {
   PhiInstruction* phi = new (instruction_zone())
       PhiInstruction(instruction_zone(), sequence()->GetVirtualRegister(node));
   sequence()->InstructionBlockAt(current_block_->GetRpoNumber())->AddPhi(phi);
-  Node::Inputs inputs = node->inputs();
-  size_t j = 0;
-  for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
-       ++iter, ++j) {
-    MarkAsUsed(*iter);
-    // TODO(mstarzinger): Use a ValueInputIterator instead.
-    if (j >= current_block_->PredecessorCount()) continue;
-    phi->operands().push_back(sequence()->GetVirtualRegister(*iter));
+  const int input_count = node->op()->InputCount();
+  phi->operands().reserve(static_cast<size_t>(input_count));
+  for (int i = 0; i < input_count; ++i) {
+    Node* const input = node->InputAt(i);
+    MarkAsUsed(input);
+    phi->operands().push_back(sequence()->GetVirtualRegister(input));
   }
 }
 
index 805b282..6d00b04 100644 (file)
@@ -25,7 +25,7 @@ class InstructionSelector FINAL {
   // Forward declarations.
   class Features;
 
-  InstructionSelector(InstructionSequence* sequence,
+  InstructionSelector(InstructionSequence* sequence, Schedule* schedule,
                       SourcePositionTable* source_positions,
                       Features features = SupportedFeatures());
 
@@ -184,7 +184,7 @@ class InstructionSelector FINAL {
   // ===========================================================================
 
   Linkage* linkage() const { return sequence()->linkage(); }
-  Schedule* schedule() const { return sequence()->schedule(); }
+  Schedule* schedule() const { return schedule_; }
   InstructionSequence* sequence() const { return sequence_; }
   Zone* instruction_zone() const { return sequence()->zone(); }
   Zone* zone() { return &zone_; }
@@ -195,6 +195,7 @@ class InstructionSelector FINAL {
   InstructionSequence* sequence_;
   SourcePositionTable* source_positions_;
   Features features_;
+  Schedule* schedule_;
   BasicBlock* current_block_;
   ZoneDeque<Instruction*> instructions_;
   BoolVector defined_;
index 3419570..891a1e7 100644 (file)
@@ -335,6 +335,7 @@ InstructionBlock::InstructionBlock(Zone* zone, const BasicBlock* block)
       predecessors_(static_cast<int>(block->PredecessorCount()),
                     BasicBlock::RpoNumber::Invalid(), zone),
       phis_(zone),
+      id_(block->id()),
       rpo_number_(block->GetRpoNumber()),
       loop_header_(GetRpo(block->loop_header())),
       loop_end_(GetLoopEndRpo(block)),
@@ -379,15 +380,14 @@ static void InitializeInstructionBlocks(Zone* zone, const Schedule* schedule,
 }
 
 
-InstructionSequence::InstructionSequence(Linkage* linkage, Graph* graph,
-                                         Schedule* schedule)
-    : zone_(schedule->zone()),  // TODO(dcarney): new zone.
+InstructionSequence::InstructionSequence(Linkage* linkage, const Graph* graph,
+                                         const Schedule* schedule)
+    : zone_(graph->zone()->isolate()),
       node_count_(graph->NodeCount()),
       node_map_(zone()->NewArray<int>(node_count_)),
       instruction_blocks_(static_cast<int>(schedule->rpo_order()->size()), NULL,
                           zone()),
       linkage_(linkage),
-      schedule_(schedule),
       constants_(ConstantMap::key_compare(),
                  ConstantMap::allocator_type(zone())),
       immediates_(zone()),
@@ -419,25 +419,28 @@ Label* InstructionSequence::GetLabel(BasicBlock::RpoNumber rpo) {
 
 BlockStartInstruction* InstructionSequence::GetBlockStart(
     BasicBlock::RpoNumber rpo) {
+  InstructionBlock* block = InstructionBlockAt(rpo);
   BlockStartInstruction* block_start =
-      BlockStartInstruction::cast(InstructionAt(code_start(rpo)));
+      BlockStartInstruction::cast(InstructionAt(block->code_start()));
   DCHECK_EQ(rpo.ToInt(), block_start->rpo_number().ToInt());
   return block_start;
 }
 
 
-void InstructionSequence::StartBlock(BasicBlock* block) {
-  set_code_start(block, static_cast<int>(instructions_.size()));
+void InstructionSequence::StartBlock(BasicBlock* basic_block) {
+  InstructionBlock* block = InstructionBlockAt(basic_block->GetRpoNumber());
+  block->set_code_start(static_cast<int>(instructions_.size()));
   BlockStartInstruction* block_start =
-      BlockStartInstruction::New(zone(), block);
+      BlockStartInstruction::New(zone(), basic_block);
   AddInstruction(block_start);
 }
 
 
-void InstructionSequence::EndBlock(BasicBlock* block) {
+void InstructionSequence::EndBlock(BasicBlock* basic_block) {
   int end = static_cast<int>(instructions_.size());
-  DCHECK(code_start(block) >= 0 && code_start(block) < end);
-  set_code_end(block, end);
+  InstructionBlock* block = InstructionBlockAt(basic_block->GetRpoNumber());
+  DCHECK(block->code_start() >= 0 && block->code_start() < end);
+  block->set_code_end(end);
 }
 
 
@@ -459,19 +462,6 @@ int InstructionSequence::AddInstruction(Instruction* instr) {
 }
 
 
-BasicBlock* InstructionSequence::GetBasicBlock(int instruction_index) {
-  // TODO(turbofan): Optimize this.
-  for (;;) {
-    DCHECK_LE(0, instruction_index);
-    Instruction* instruction = InstructionAt(instruction_index--);
-    if (instruction->IsBlockStart()) {
-      return schedule()->rpo_order()->at(
-          BlockStartInstruction::cast(instruction)->rpo_number().ToSize());
-    }
-  }
-}
-
-
 const InstructionBlock* InstructionSequence::GetInstructionBlock(
     int instruction_index) const {
   // TODO(turbofan): Optimize this.
@@ -614,53 +604,50 @@ std::ostream& operator<<(std::ostream& os, const InstructionSequence& code) {
     os << "CST#" << i << ": v" << it->first << " = " << it->second << "\n";
   }
   for (int i = 0; i < code.BasicBlockCount(); i++) {
-    BasicBlock* block = code.BlockAt(i);
+    BasicBlock::RpoNumber rpo = BasicBlock::RpoNumber::FromInt(i);
+    const InstructionBlock* block = code.InstructionBlockAt(rpo);
+    CHECK(block->rpo_number() == rpo);
 
     os << "RPO#" << block->rpo_number() << ": B" << block->id();
-    CHECK(block->rpo_number() == i);
     if (block->IsLoopHeader()) {
       os << " loop blocks: [" << block->rpo_number() << ", "
          << block->loop_end() << ")";
     }
-    os << "  instructions: [" << code.code_start(block) << ", "
-       << code.code_end(block) << ")\n  predecessors:";
+    os << "  instructions: [" << block->code_start() << ", "
+       << block->code_end() << ")\n  predecessors:";
 
-    for (BasicBlock::Predecessors::iterator iter = block->predecessors_begin();
-         iter != block->predecessors_end(); ++iter) {
-      os << " B" << (*iter)->id();
+    for (auto pred : block->predecessors()) {
+      const InstructionBlock* pred_block = code.InstructionBlockAt(pred);
+      os << " B" << pred_block->id();
     }
     os << "\n";
 
-    for (BasicBlock::const_iterator j = block->begin(); j != block->end();
-         ++j) {
-      Node* phi = *j;
-      if (phi->opcode() != IrOpcode::kPhi) continue;
-      os << "     phi: v" << phi->id() << " =";
-      Node::Inputs inputs = phi->inputs();
-      for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
-           ++iter) {
-        os << " v" << (*iter)->id();
+    for (auto phi : block->phis()) {
+      os << "     phi: v" << phi->virtual_register() << " =";
+      for (auto op_vreg : phi->operands()) {
+        os << " v" << op_vreg;
       }
       os << "\n";
     }
 
     ScopedVector<char> buf(32);
-    for (int j = code.first_instruction_index(block);
-         j <= code.last_instruction_index(block); j++) {
+    for (int j = block->first_instruction_index();
+         j <= block->last_instruction_index(); j++) {
       // TODO(svenpanne) Add some basic formatting to our streams.
       SNPrintF(buf, "%5d", j);
       os << "   " << buf.start() << ": " << *code.InstructionAt(j) << "\n";
     }
 
-    os << "  " << block->control();
+    // TODO(dcarney): add this back somehow?
+    // os << "  " << block->control();
 
-    if (block->control_input() != NULL) {
-      os << " v" << block->control_input()->id();
-    }
+    // if (block->control_input() != NULL) {
+    //   os << " v" << block->control_input()->id();
+    // }
 
-    for (BasicBlock::Successors::iterator iter = block->successors_begin();
-         iter != block->successors_end(); ++iter) {
-      os << " B" << (*iter)->id();
+    for (auto succ : block->successors()) {
+      const InstructionBlock* succ_block = code.InstructionBlockAt(succ);
+      os << " B" << succ_block->id();
     }
     os << "\n";
   }
index 0c7ce81..de73ed2 100644 (file)
@@ -755,7 +755,7 @@ std::ostream& operator<<(std::ostream& os, const Constant& constant);
 
 
 // TODO(dcarney): this is a temporary hack.  turn into an actual instruction.
-class PhiInstruction : public ZoneObject {
+class PhiInstruction FINAL : public ZoneObject {
  public:
   PhiInstruction(Zone* zone, int virtual_register)
       : virtual_register_(virtual_register), operands_(zone) {}
@@ -771,7 +771,7 @@ class PhiInstruction : public ZoneObject {
 
 
 // Analogue of BasicBlock for Instructions instead of Nodes.
-class InstructionBlock : public ZoneObject {
+class InstructionBlock FINAL : public ZoneObject {
  public:
   explicit InstructionBlock(Zone* zone, const BasicBlock* block);
 
@@ -795,6 +795,7 @@ class InstructionBlock : public ZoneObject {
   int32_t code_end() const { return code_end_; }
   void set_code_end(int32_t end) { code_end_ = end; }
 
+  BasicBlock::Id id() const { return id_; }
   BasicBlock::RpoNumber rpo_number() const { return rpo_number_; }
   BasicBlock::RpoNumber loop_header() const { return loop_header_; }
   BasicBlock::RpoNumber loop_end() const {
@@ -820,6 +821,7 @@ class InstructionBlock : public ZoneObject {
   Successors successors_;
   Predecessors predecessors_;
   PhiInstructions phis_;
+  BasicBlock::Id id_;
   // TODO(dcarney): probably dont't need this.
   BasicBlock::RpoNumber rpo_number_;
   BasicBlock::RpoNumber loop_header_;
@@ -842,7 +844,8 @@ typedef ZoneVector<InstructionBlock*> InstructionBlocks;
 // TODO(titzer): s/IsDouble/IsFloat64/
 class InstructionSequence FINAL {
  public:
-  InstructionSequence(Linkage* linkage, Graph* graph, Schedule* schedule);
+  InstructionSequence(Linkage* linkage, const Graph* graph,
+                      const Schedule* schedule);
 
   int NextVirtualRegister() { return next_virtual_register_++; }
   int VirtualRegisterCount() const { return next_virtual_register_; }
@@ -853,17 +856,13 @@ class InstructionSequence FINAL {
     return static_cast<int>(instruction_blocks_.size());
   }
 
-  BasicBlock* BlockAt(int rpo_number) const {
-    return (*schedule_->rpo_order())[rpo_number];
-  }
-
   InstructionBlock* InstructionBlockAt(BasicBlock::RpoNumber rpo_number) {
-    return GetBlock(rpo_number);
+    return instruction_blocks_[rpo_number.ToSize()];
   }
 
   const InstructionBlock* InstructionBlockAt(
       BasicBlock::RpoNumber rpo_number) const {
-    return GetBlock(rpo_number);
+    return instruction_blocks_[rpo_number.ToSize()];
   }
 
   // TODO(dcarney): move to register allocator.
@@ -874,7 +873,6 @@ class InstructionSequence FINAL {
     return instruction_blocks_[index.ToInt()];
   }
 
-  BasicBlock* GetBasicBlock(int instruction_index);
   const InstructionBlock* GetInstructionBlock(int instruction_index) const;
 
   int GetVirtualRegister(const Node* node);
@@ -907,44 +905,15 @@ class InstructionSequence FINAL {
   }
 
   Frame* frame() { return &frame_; }
-  Isolate* isolate() const { return zone()->isolate(); }
+  Isolate* isolate() { 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 zone_; }
+  Zone* zone() { return &zone_; }
 
   // Used by the instruction selector while adding instructions.
   int AddInstruction(Instruction* instr);
   void StartBlock(BasicBlock* block);
   void EndBlock(BasicBlock* block);
-  void set_code_start(BasicBlock* block, int start) {
-    return GetBlock(block->GetRpoNumber())->set_code_start(start);
-  }
-  void set_code_end(BasicBlock* block, int end) {
-    return GetBlock(block->GetRpoNumber())->set_code_end(end);
-  }
-  // TODO(dcarney): use RpoNumber for all of the below.
-  int code_start(BasicBlock::RpoNumber rpo_number) const {
-    return GetBlock(rpo_number)->code_start();
-  }
-  int code_start(BasicBlock* block) const {
-    return GetBlock(block->GetRpoNumber())->code_start();
-  }
-  int code_end(BasicBlock* block) const {
-    return GetBlock(block->GetRpoNumber())->code_end();
-  }
-  int first_instruction_index(BasicBlock* block) const {
-    return GetBlock(block->GetRpoNumber())->first_instruction_index();
-  }
-  int last_instruction_index(BasicBlock* block) const {
-    return GetBlock(block->GetRpoNumber())->last_instruction_index();
-  }
-  int first_instruction_index(InstructionBlock* block) const {
-    return GetBlock(block->rpo_number())->first_instruction_index();
-  }
-  int last_instruction_index(InstructionBlock* block) const {
-    return GetBlock(block->rpo_number())->last_instruction_index();
-  }
 
   int AddConstant(Node* node, Constant constant) {
     int virtual_register = GetVirtualRegister(node);
@@ -988,21 +957,16 @@ class InstructionSequence FINAL {
   int GetFrameStateDescriptorCount();
 
  private:
-  InstructionBlock* GetBlock(BasicBlock::RpoNumber rpo_number) const {
-    return instruction_blocks_[rpo_number.ToSize()];
-  }
-
   friend std::ostream& operator<<(std::ostream& os,
                                   const InstructionSequence& code);
 
   typedef std::set<int, std::less<int>, ZoneIntAllocator> VirtualRegisterSet;
 
-  Zone* zone_;
+  Zone zone_;
   int node_count_;
   int* node_map_;
   InstructionBlocks instruction_blocks_;
   Linkage* linkage_;
-  Schedule* schedule_;
   ConstantMap constants_;
   ConstantDeque immediates_;
   InstructionDeque instructions_;
index 6459678..3a3460f 100644 (file)
@@ -457,7 +457,7 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph,
 
   // Select and schedule instructions covering the scheduled graph.
   {
-    InstructionSelector selector(&sequence, source_positions);
+    InstructionSelector selector(&sequence, schedule, source_positions);
     selector.SelectInstructions();
   }
 
index 62f625e..723415a 100644 (file)
@@ -105,6 +105,11 @@ std::ostream& operator<<(std::ostream& os, const BasicBlock::Id& id) {
 }
 
 
+std::ostream& operator<<(std::ostream& os, const BasicBlock::RpoNumber& rpo) {
+  return os << rpo.ToSize();
+}
+
+
 Schedule::Schedule(Zone* zone, size_t node_count_hint)
     : zone_(zone),
       all_blocks_(zone),
index 3a12a52..ea17405 100644 (file)
@@ -182,6 +182,7 @@ class BasicBlock FINAL : public ZoneObject {
 
 std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c);
 std::ostream& operator<<(std::ostream& os, const BasicBlock::Id& id);
+std::ostream& operator<<(std::ostream& os, const BasicBlock::RpoNumber& rpo);
 
 typedef ZoneVector<BasicBlock*> BasicBlockVector;
 typedef BasicBlockVector::iterator BasicBlockVectorIter;
index 26e3a83..301ef70 100644 (file)
@@ -68,7 +68,7 @@ class DeoptCodegenTester {
     code = new v8::internal::compiler::InstructionSequence(linkage, graph,
                                                            schedule);
     SourcePositionTable source_positions(graph);
-    InstructionSelector selector(code, &source_positions);
+    InstructionSelector selector(code, schedule, &source_positions);
     selector.SelectInstructions();
 
     if (FLAG_trace_turbo) {
index d0e4762..6d86bf9 100644 (file)
@@ -93,6 +93,21 @@ class InstructionTester : public HandleAndZoneScope {
     unallocated->set_virtual_register(vreg);
     return unallocated;
   }
+
+  InstructionBlock* BlockAt(BasicBlock* block) {
+    return code->InstructionBlockAt(block->GetRpoNumber());
+  }
+  BasicBlock* GetBasicBlock(int instruction_index) {
+    const InstructionBlock* block =
+        code->GetInstructionBlock(instruction_index);
+    return schedule.rpo_order()->at(block->rpo_number().ToSize());
+  }
+  int first_instruction_index(BasicBlock* block) {
+    return BlockAt(block)->first_instruction_index();
+  }
+  int last_instruction_index(BasicBlock* block) {
+    return BlockAt(block)->last_instruction_index();
+  }
 };
 
 
@@ -121,7 +136,8 @@ TEST(InstructionBasic) {
   for (BasicBlockVectorIter i = blocks->begin(); i != blocks->end();
        i++, index++) {
     BasicBlock* block = *i;
-    CHECK_EQ(block, R.code->BlockAt(index));
+    CHECK_EQ(block->rpo_number(), R.BlockAt(block)->rpo_number().ToInt());
+    CHECK_EQ(block->id().ToInt(), R.BlockAt(block)->id().ToInt());
     CHECK_EQ(-1, block->loop_end());
   }
 }
@@ -159,29 +175,29 @@ TEST(InstructionGetBasicBlock) {
   R.code->StartBlock(b3);
   R.code->EndBlock(b3);
 
-  CHECK_EQ(b0, R.code->GetBasicBlock(i0));
-  CHECK_EQ(b0, R.code->GetBasicBlock(i1));
+  CHECK_EQ(b0, R.GetBasicBlock(i0));
+  CHECK_EQ(b0, R.GetBasicBlock(i1));
 
-  CHECK_EQ(b1, R.code->GetBasicBlock(i2));
-  CHECK_EQ(b1, R.code->GetBasicBlock(i3));
-  CHECK_EQ(b1, R.code->GetBasicBlock(i4));
-  CHECK_EQ(b1, R.code->GetBasicBlock(i5));
+  CHECK_EQ(b1, R.GetBasicBlock(i2));
+  CHECK_EQ(b1, R.GetBasicBlock(i3));
+  CHECK_EQ(b1, R.GetBasicBlock(i4));
+  CHECK_EQ(b1, R.GetBasicBlock(i5));
 
-  CHECK_EQ(b2, R.code->GetBasicBlock(i6));
-  CHECK_EQ(b2, R.code->GetBasicBlock(i7));
-  CHECK_EQ(b2, R.code->GetBasicBlock(i8));
+  CHECK_EQ(b2, R.GetBasicBlock(i6));
+  CHECK_EQ(b2, R.GetBasicBlock(i7));
+  CHECK_EQ(b2, R.GetBasicBlock(i8));
 
-  CHECK_EQ(b0, R.code->GetBasicBlock(R.code->first_instruction_index(b0)));
-  CHECK_EQ(b0, R.code->GetBasicBlock(R.code->last_instruction_index(b0)));
+  CHECK_EQ(b0, R.GetBasicBlock(R.first_instruction_index(b0)));
+  CHECK_EQ(b0, R.GetBasicBlock(R.last_instruction_index(b0)));
 
-  CHECK_EQ(b1, R.code->GetBasicBlock(R.code->first_instruction_index(b1)));
-  CHECK_EQ(b1, R.code->GetBasicBlock(R.code->last_instruction_index(b1)));
+  CHECK_EQ(b1, R.GetBasicBlock(R.first_instruction_index(b1)));
+  CHECK_EQ(b1, R.GetBasicBlock(R.last_instruction_index(b1)));
 
-  CHECK_EQ(b2, R.code->GetBasicBlock(R.code->first_instruction_index(b2)));
-  CHECK_EQ(b2, R.code->GetBasicBlock(R.code->last_instruction_index(b2)));
+  CHECK_EQ(b2, R.GetBasicBlock(R.first_instruction_index(b2)));
+  CHECK_EQ(b2, R.GetBasicBlock(R.last_instruction_index(b2)));
 
-  CHECK_EQ(b3, R.code->GetBasicBlock(R.code->first_instruction_index(b3)));
-  CHECK_EQ(b3, R.code->GetBasicBlock(R.code->last_instruction_index(b3)));
+  CHECK_EQ(b3, R.GetBasicBlock(R.first_instruction_index(b3)));
+  CHECK_EQ(b3, R.GetBasicBlock(R.last_instruction_index(b3)));
 }
 
 
index 5bbf0ce..97ae5b4 100644 (file)
@@ -40,7 +40,8 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build(
   Linkage linkage(&info, call_descriptor());
   InstructionSequence sequence(&linkage, graph(), schedule);
   SourcePositionTable source_position_table(graph());
-  InstructionSelector selector(&sequence, &source_position_table, features);
+  InstructionSelector selector(&sequence, schedule, &source_position_table,
+                               features);
   selector.SelectInstructions();
   if (FLAG_trace_turbo) {
     OFStream out(stdout);