Commit 657052e8 authored by dcarney@chromium.org's avatar dcarney@chromium.org

[turbofan] remove graph from InstructionSequence

R=bmeurer@chromium.org

BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24545 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f92dc9a1
......@@ -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(); }
......
......@@ -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(); }
......
......@@ -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() {
......
......@@ -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_; }
......
......@@ -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;
}
}
......
......@@ -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_;
......
......@@ -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());
......
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