Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 2896903002: Shuffle around deopt id allocation to give the flow graph builder a chance to record other data as … (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_inliner.cc
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index f885e255adc09b208d497b96bd139085283809ad..81a2f383f01bf96cbbc63dcfd76e1a6a4b68be26 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -1514,10 +1514,10 @@ bool PolymorphicInliner::CheckInlinedDuplicate(const Function& target) {
new_join->AddDominatedBlock(block);
}
// Create a new target with the join as unconditional successor.
- TargetEntryInstr* new_target =
- new TargetEntryInstr(AllocateBlockId(), old_target->try_index());
+ TargetEntryInstr* new_target = new TargetEntryInstr(
+ AllocateBlockId(), old_target->try_index(), Thread::kNoDeoptId);
new_target->InheritDeoptTarget(zone(), new_join);
- GotoInstr* new_goto = new (Z) GotoInstr(new_join);
+ GotoInstr* new_goto = new (Z) GotoInstr(new_join, Thread::kNoDeoptId);
new_goto->InheritDeoptTarget(zone(), new_join);
new_target->LinkTo(new_goto);
new_target->set_last_instruction(new_goto);
@@ -1656,8 +1656,9 @@ bool PolymorphicInliner::TryInlineRecognizedMethod(intptr_t receiver_cid,
InlineExitCollector* exit_collector =
new (Z) InlineExitCollector(owner_->caller_graph(), call_);
- ReturnInstr* result = new (Z)
- ReturnInstr(call_->instance_call()->token_pos(), new (Z) Value(last));
+ ReturnInstr* result =
+ new (Z) ReturnInstr(call_->instance_call()->token_pos(),
+ new (Z) Value(last), Thread::kNoDeoptId);
owner_->caller_graph()->AppendTo(
last, result,
call_->env(), // Return can become deoptimization target.
@@ -1687,8 +1688,8 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
const intptr_t try_idx = call_->GetBlock()->try_index();
// Start with a fresh target entry.
- TargetEntryInstr* entry =
- new (Z) TargetEntryInstr(AllocateBlockId(), try_idx);
+ TargetEntryInstr* entry = new (Z) TargetEntryInstr(
+ AllocateBlockId(), try_idx, Thread::Current()->GetNextDeoptId());
entry->InheritDeoptTarget(zone(), call_);
// This function uses a cursor (a pointer to the 'current' instruction) to
@@ -1759,7 +1760,7 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
// the join.
JoinEntryInstr* join = callee_entry->AsJoinEntry();
ASSERT(join->dominator() != NULL);
- GotoInstr* goto_join = new GotoInstr(join);
+ GotoInstr* goto_join = new GotoInstr(join, Thread::kNoDeoptId);
goto_join->InheritDeoptTarget(zone(), join);
cursor->LinkTo(goto_join);
current_block->set_last_instruction(goto_join);
@@ -1790,13 +1791,13 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
new Value(load_cid), new Value(cid_constant_end), kSmiCid,
call_->deopt_id());
BranchInstr* branch_top = upper_limit_branch =
- new BranchInstr(compare_top);
+ new BranchInstr(compare_top, Thread::kNoDeoptId);
branch_top->InheritDeoptTarget(zone(), call_);
cursor = AppendInstruction(cursor, branch_top);
current_block->set_last_instruction(branch_top);
- TargetEntryInstr* below_target =
- new TargetEntryInstr(AllocateBlockId(), try_idx);
+ TargetEntryInstr* below_target = new TargetEntryInstr(
+ AllocateBlockId(), try_idx, Thread::kNoDeoptId);
below_target->InheritDeoptTarget(zone(), call_);
current_block->AddDominatedBlock(below_target);
cursor = current_block = below_target;
@@ -1806,13 +1807,13 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
call_->instance_call()->token_pos(), Token::kGTE,
new Value(load_cid), new Value(cid_constant), kSmiCid,
call_->deopt_id());
- branch = new BranchInstr(compare_bottom);
+ branch = new BranchInstr(compare_bottom, Thread::kNoDeoptId);
} else {
StrictCompareInstr* compare = new StrictCompareInstr(
call_->instance_call()->token_pos(), Token::kEQ_STRICT,
new Value(load_cid), new Value(cid_constant),
- false); // No number check.
- branch = new BranchInstr(compare);
+ /* number_check = */ false, Thread::kNoDeoptId);
+ branch = new BranchInstr(compare, Thread::kNoDeoptId);
}
branch->InheritDeoptTarget(zone(), call_);
@@ -1843,9 +1844,10 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
JoinEntryInstr* join = callee_entry->AsJoinEntry();
ASSERT(join != NULL);
ASSERT(join->dominator() != NULL);
- true_target = new TargetEntryInstr(AllocateBlockId(), try_idx);
+ true_target = new TargetEntryInstr(AllocateBlockId(), try_idx,
+ Thread::kNoDeoptId);
true_target->InheritDeoptTarget(zone(), join);
- GotoInstr* goto_join = new GotoInstr(join);
+ GotoInstr* goto_join = new GotoInstr(join, Thread::kNoDeoptId);
goto_join->InheritDeoptTarget(zone(), join);
true_target->LinkTo(goto_join);
true_target->set_last_instruction(goto_join);
@@ -1857,7 +1859,7 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
// fall-through code below for non-inlined variants.
TargetEntryInstr* false_target =
- new TargetEntryInstr(AllocateBlockId(), try_idx);
+ new TargetEntryInstr(AllocateBlockId(), try_idx, Thread::kNoDeoptId);
false_target->InheritDeoptTarget(zone(), call_);
*branch->false_successor_address() = false_target;
cid_test_entry_block->AddDominatedBlock(false_target);
@@ -1867,14 +1869,15 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
if (test_is_range) {
// If we tested against a range of Cids there are two different tests
// that can go to the no-cid-match target.
- JoinEntryInstr* join = new JoinEntryInstr(AllocateBlockId(), try_idx);
- TargetEntryInstr* false_target2 =
- new TargetEntryInstr(AllocateBlockId(), try_idx);
+ JoinEntryInstr* join =
+ new JoinEntryInstr(AllocateBlockId(), try_idx, Thread::kNoDeoptId);
+ TargetEntryInstr* false_target2 = new TargetEntryInstr(
+ AllocateBlockId(), try_idx, Thread::kNoDeoptId);
*upper_limit_branch->false_successor_address() = false_target2;
cid_test_entry_block->AddDominatedBlock(false_target2);
cid_test_entry_block->AddDominatedBlock(join);
- GotoInstr* goto_1 = new GotoInstr(join);
- GotoInstr* goto_2 = new GotoInstr(join);
+ GotoInstr* goto_1 = new GotoInstr(join, Thread::kNoDeoptId);
+ GotoInstr* goto_2 = new GotoInstr(join, Thread::kNoDeoptId);
false_target->LinkTo(goto_1);
false_target2->LinkTo(goto_2);
false_target->set_last_instruction(goto_1);
@@ -1908,8 +1911,9 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
owner_->caller_graph()->alloc_ssa_temp_index());
fallback_call->InheritDeoptTarget(zone(), call_);
fallback_call->set_total_call_count(call_->CallCount());
- ReturnInstr* fallback_return = new ReturnInstr(
- call_->instance_call()->token_pos(), new Value(fallback_call));
+ ReturnInstr* fallback_return =
+ new ReturnInstr(call_->instance_call()->token_pos(),
+ new Value(fallback_call), Thread::kNoDeoptId);
fallback_return->InheritDeoptTargetAfter(owner_->caller_graph(), call_,
fallback_call);
AppendInstruction(AppendInstruction(cursor, fallback_call),
@@ -2293,8 +2297,9 @@ static bool InlineGetIndexed(FlowGraph* flow_graph,
Definition* array = receiver;
Definition* index = call->ArgumentAt(1);
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
@@ -2342,8 +2347,9 @@ static bool InlineSetIndexed(FlowGraph* flow_graph,
Definition* index = call->ArgumentAt(1);
Definition* stored_value = call->ArgumentAt(2);
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
if (flow_graph->isolate()->type_checks()) {
@@ -2479,8 +2485,9 @@ static bool InlineDoubleOp(FlowGraph* flow_graph,
Definition* left = receiver;
Definition* right = call->ArgumentAt(1);
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
// Arguments are checked. No need for class check.
BinaryDoubleOpInstr* double_bin_op = new (Z)
@@ -2503,8 +2510,9 @@ static bool InlineDoubleTestOp(FlowGraph* flow_graph,
return false;
}
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
// Arguments are checked. No need for class check.
@@ -2525,8 +2533,9 @@ static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph,
Definition* left = receiver;
Definition* right = call->ArgumentAt(1);
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
// Right arguments is known to be smi: other._bitAndFromSmi(this);
BinarySmiOpInstr* smi_op =
@@ -2549,8 +2558,9 @@ static bool InlineGrowableArraySetter(FlowGraph* flow_graph,
Definition* array = receiver;
Definition* value = call->ArgumentAt(1);
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
// This is an internal method, no need to check argument types.
@@ -2635,8 +2645,9 @@ static bool InlineByteArrayBaseLoad(FlowGraph* flow_graph,
ASSERT(array_cid != kIllegalCid);
Definition* array = receiver;
Definition* index = call->ArgumentAt(1);
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
@@ -2678,8 +2689,9 @@ static bool InlineByteArrayBaseStore(FlowGraph* flow_graph,
ASSERT(array_cid != kIllegalCid);
Definition* array = receiver;
Definition* index = call->ArgumentAt(1);
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
@@ -2844,8 +2856,9 @@ static bool InlineStringBaseCharAt(FlowGraph* flow_graph,
Definition* str = receiver;
Definition* index = call->ArgumentAt(1);
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
*last = PrepareInlineStringIndexOp(flow_graph, call, cid, str, index, *entry);
@@ -2872,8 +2885,9 @@ static bool InlineStringCodeUnitAt(FlowGraph* flow_graph,
Definition* str = receiver;
Definition* index = call->ArgumentAt(1);
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
*last = PrepareInlineStringIndexOp(flow_graph, call, cid, str, index, *entry);
@@ -2985,8 +2999,9 @@ static bool InlineFloat32x4Method(FlowGraph* flow_graph,
return false;
}
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
switch (kind) {
@@ -3103,8 +3118,9 @@ static bool InlineSimdShuffleMethod(FlowGraph* flow_graph,
if (!ShouldInlineSimd()) {
return false;
}
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
Definition* mask_definition = call->ArgumentAt(1);
@@ -3131,8 +3147,9 @@ static bool InlineSimdShuffleMixMethod(FlowGraph* flow_graph,
if (!ShouldInlineSimd()) {
return false;
}
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
Definition* mask_definition = call->ArgumentAt(2);
@@ -3160,8 +3177,9 @@ static bool InlineInt32x4Method(FlowGraph* flow_graph,
if (!ShouldInlineSimd()) {
return false;
}
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
switch (kind) {
@@ -3216,8 +3234,9 @@ static bool InlineFloat64x2Method(FlowGraph* flow_graph,
if (!ShouldInlineSimd()) {
return false;
}
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
switch (kind) {
@@ -3267,8 +3286,9 @@ static bool InlineSimdConstructor(FlowGraph* flow_graph,
if (!ShouldInlineSimd()) {
return false;
}
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
switch (kind) {
@@ -3348,8 +3368,9 @@ static bool InlineMathCFunction(FlowGraph* flow_graph,
if (!CanUnboxDouble()) {
return false;
}
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Instruction* cursor = *entry;
@@ -3710,8 +3731,9 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph,
return InlineMathCFunction(flow_graph, call, kind, entry, last);
case MethodRecognizer::kObjectConstructor: {
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
ASSERT(!call->HasUses());
*last = NULL; // Empty body.
@@ -3726,10 +3748,11 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph,
if (length >= 0 && length <= Array::kMaxElements) {
Value* type = new (Z) Value(call->ArgumentAt(0));
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ call->GetBlock()->try_index(),
+ Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
- *last =
- new (Z) CreateArrayInstr(call->token_pos(), type, num_elements);
+ *last = new (Z) CreateArrayInstr(call->token_pos(), type,
+ num_elements, Thread::kNoDeoptId);
flow_graph->AppendTo(
*entry, *last,
call->deopt_id() != Thread::kNoDeoptId ? call->env() : NULL,
@@ -3757,8 +3780,9 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph,
}
if (!type.IsNull()) {
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
*last = new (Z) ConstantInstr(type);
flow_graph->AppendTo(
@@ -3773,8 +3797,9 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph,
case MethodRecognizer::kOneByteStringSetAt: {
// This is an internal method, no need to check argument types nor
// range.
- *entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(),
- call->GetBlock()->try_index());
+ *entry = new (Z)
+ TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index(), Thread::kNoDeoptId);
(*entry)->InheritDeoptTarget(Z, call);
Definition* str = call->ArgumentAt(0);
Definition* index = call->ArgumentAt(1);
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698