mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:30:32 +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() {
|
void FlowGraphBuilder::PruneUnreachable() {
|
||||||
ASSERT(osr_id_ != Compiler::kNoOSRDeoptId);
|
ASSERT(osr_id_ != Compiler::kNoOSRDeoptId);
|
||||||
BitVector* block_marks = new(Z) BitVector(Z, last_used_block_id_ + 1);
|
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);
|
block_marks);
|
||||||
ASSERT(found);
|
ASSERT(found);
|
||||||
}
|
}
|
||||||
|
|
|
@ -975,8 +975,7 @@ bool BlockEntryInstr::DiscoverBlock(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BlockEntryInstr::PruneUnreachable(FlowGraphBuilder* builder,
|
bool BlockEntryInstr::PruneUnreachable(GraphEntryInstr* graph_entry,
|
||||||
GraphEntryInstr* graph_entry,
|
|
||||||
Instruction* parent,
|
Instruction* parent,
|
||||||
intptr_t osr_id,
|
intptr_t osr_id,
|
||||||
BitVector* block_marks) {
|
BitVector* block_marks) {
|
||||||
|
@ -1012,8 +1011,7 @@ bool BlockEntryInstr::PruneUnreachable(FlowGraphBuilder* builder,
|
||||||
|
|
||||||
// Recursively search the successors.
|
// Recursively search the successors.
|
||||||
for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) {
|
for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) {
|
||||||
if (instr->SuccessorAt(i)->PruneUnreachable(builder,
|
if (instr->SuccessorAt(i)->PruneUnreachable(graph_entry,
|
||||||
graph_entry,
|
|
||||||
instr,
|
instr,
|
||||||
osr_id,
|
osr_id,
|
||||||
block_marks)) {
|
block_marks)) {
|
||||||
|
|
|
@ -1176,8 +1176,7 @@ class BlockEntryInstr : public Instruction {
|
||||||
|
|
||||||
// Perform a depth first search to prune code not reachable from an OSR
|
// Perform a depth first search to prune code not reachable from an OSR
|
||||||
// entry point.
|
// entry point.
|
||||||
bool PruneUnreachable(FlowGraphBuilder* builder,
|
bool PruneUnreachable(GraphEntryInstr* graph_entry,
|
||||||
GraphEntryInstr* graph_entry,
|
|
||||||
Instruction* parent,
|
Instruction* parent,
|
||||||
intptr_t osr_id,
|
intptr_t osr_id,
|
||||||
BitVector* block_marks);
|
BitVector* block_marks);
|
||||||
|
|
|
@ -2750,7 +2750,7 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfFunction(FunctionNode* function,
|
||||||
const Function& dart_function = parsed_function_->function();
|
const Function& dart_function = parsed_function_->function();
|
||||||
TargetEntryInstr* normal_entry = BuildTargetEntry();
|
TargetEntryInstr* normal_entry = BuildTargetEntry();
|
||||||
graph_entry_ = new (Z)
|
graph_entry_ = new (Z)
|
||||||
GraphEntryInstr(*parsed_function_, normal_entry, Compiler::kNoOSRDeoptId);
|
GraphEntryInstr(*parsed_function_, normal_entry, osr_id_);
|
||||||
|
|
||||||
SetupDefaultParameterValues(function);
|
SetupDefaultParameterValues(function);
|
||||||
|
|
||||||
|
@ -2917,6 +2917,15 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfFunction(FunctionNode* function,
|
||||||
}
|
}
|
||||||
normal_entry->LinkTo(body.entry);
|
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);
|
return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue