Refactor construction of polymorphic loads, stores, and calls.

Rather than passing in a pair of unequal-length lists, pass the default
subgraph separately.  Construct the typecase from the top down rather than
the bottom up, so it doesn't need an intermediate zone list.

Also, change a basic block's 'last' instruction field to really be its last
instruction by correctly updating it when inserting and removing
instructions.

Review URL: http://codereview.chromium.org/6516016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6783 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9adaeb6a
......@@ -465,9 +465,16 @@ void HInstruction::PrintTo(StringStream* stream) const {
void HInstruction::Unlink() {
ASSERT(IsLinked());
ASSERT(!IsControlInstruction()); // Must never move control instructions.
ASSERT(!IsBlockEntry()); // Doesn't make sense to delete these.
ASSERT(previous_ != NULL);
previous_->next_ = next_;
if (next_ == NULL) {
ASSERT(block()->last() == this);
block()->set_last(previous_);
} else {
next_->previous_ = previous_;
}
clear_block();
if (previous_ != NULL) previous_->next_ = next_;
if (next_ != NULL) next_->previous_ = previous_;
}
......
This diff is collapsed.
......@@ -60,6 +60,8 @@ class HBasicBlock: public ZoneObject {
HGraph* graph() const { return graph_; }
const ZoneList<HPhi*>* phis() const { return &phis_; }
HInstruction* first() const { return first_; }
HInstruction* last() const { return last_; }
void set_last(HInstruction* instr) { last_ = instr; }
HInstruction* GetLastInstruction();
HControlInstruction* end() const { return end_; }
HLoopInformation* loop_information() const { return loop_information_; }
......@@ -148,7 +150,7 @@ class HBasicBlock: public ZoneObject {
HGraph* graph_;
ZoneList<HPhi*> phis_;
HInstruction* first_;
HInstruction* last_; // Last non-control instruction of the block.
HInstruction* last_;
HControlInstruction* end_;
HLoopInformation* loop_information_;
ZoneList<HBasicBlock*> predecessors_;
......@@ -826,9 +828,10 @@ class HGraphBuilder: public AstVisitor {
bool smi_and_map_check);
HBasicBlock* BuildTypeSwitch(ZoneMapList* maps,
ZoneList<HSubgraph*>* subgraphs,
HValue* receiver,
HBasicBlock* BuildTypeSwitch(HValue* receiver,
ZoneMapList* maps,
ZoneList<HSubgraph*>* body_graphs,
HSubgraph* default_graph,
int join_id);
TypeFeedbackOracle* oracle_;
......
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