mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Add support for OSR in kernel-based FlowGraphBuilder
R=vegorov@google.com Review URL: https://codereview.chromium.org/2464953002 .
This commit is contained in:
parent
be11752b14
commit
e984271b94
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue