Add support for OSR in kernel-based FlowGraphBuilder

R=vegorov@google.com

Review URL: https://codereview.chromium.org/2464953002 .
This commit is contained in:
Martin Kustermann 2016-10-31 19:12:09 +01:00
parent be11752b14
commit e984271b94
4 changed files with 14 additions and 8 deletions

View file

@ -4637,7 +4637,7 @@ FlowGraph* FlowGraphBuilder::BuildGraph() {
void FlowGraphBuilder::PruneUnreachable() {
ASSERT(osr_id_ != Compiler::kNoOSRDeoptId);
BitVector* block_marks = new(Z) BitVector(Z, last_used_block_id_ + 1);
bool found = graph_entry_->PruneUnreachable(this, graph_entry_, NULL, osr_id_,
bool found = graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_,
block_marks);
ASSERT(found);
}

View file

@ -975,8 +975,7 @@ bool BlockEntryInstr::DiscoverBlock(
}
bool BlockEntryInstr::PruneUnreachable(FlowGraphBuilder* builder,
GraphEntryInstr* graph_entry,
bool BlockEntryInstr::PruneUnreachable(GraphEntryInstr* graph_entry,
Instruction* parent,
intptr_t osr_id,
BitVector* block_marks) {
@ -1012,8 +1011,7 @@ bool BlockEntryInstr::PruneUnreachable(FlowGraphBuilder* builder,
// Recursively search the successors.
for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) {
if (instr->SuccessorAt(i)->PruneUnreachable(builder,
graph_entry,
if (instr->SuccessorAt(i)->PruneUnreachable(graph_entry,
instr,
osr_id,
block_marks)) {

View file

@ -1176,8 +1176,7 @@ class BlockEntryInstr : public Instruction {
// Perform a depth first search to prune code not reachable from an OSR
// entry point.
bool PruneUnreachable(FlowGraphBuilder* builder,
GraphEntryInstr* graph_entry,
bool PruneUnreachable(GraphEntryInstr* graph_entry,
Instruction* parent,
intptr_t osr_id,
BitVector* block_marks);

View file

@ -2750,7 +2750,7 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfFunction(FunctionNode* function,
const Function& dart_function = parsed_function_->function();
TargetEntryInstr* normal_entry = BuildTargetEntry();
graph_entry_ = new (Z)
GraphEntryInstr(*parsed_function_, normal_entry, Compiler::kNoOSRDeoptId);
GraphEntryInstr(*parsed_function_, normal_entry, osr_id_);
SetupDefaultParameterValues(function);
@ -2917,6 +2917,15 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfFunction(FunctionNode* function,
}
normal_entry->LinkTo(body.entry);
// When compiling for OSR, use a depth first search to prune instructions
// unreachable from the OSR entry. Catch entries are always considered
// reachable, even if they become unreachable after OSR.
if (osr_id_ != Compiler::kNoOSRDeoptId) {
BitVector* block_marks = new(Z) BitVector(Z, next_block_id_);
bool found = graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_,
block_marks);
ASSERT(found);
}
return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1);
}