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..5bff3adebf0c74e25d977af346582c977cfc6c01 100644 |
--- a/runtime/vm/flow_graph_inliner.cc |
+++ b/runtime/vm/flow_graph_inliner.cc |
@@ -1515,9 +1515,11 @@ bool PolymorphicInliner::CheckInlinedDuplicate(const Function& target) { |
} |
// Create a new target with the join as unconditional successor. |
TargetEntryInstr* new_target = |
- new TargetEntryInstr(AllocateBlockId(), old_target->try_index()); |
+ new TargetEntryInstr(AllocateBlockId(), old_target->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
new_target->InheritDeoptTarget(zone(), new_join); |
- GotoInstr* new_goto = new (Z) GotoInstr(new_join); |
+ GotoInstr* new_goto = |
+ new (Z) GotoInstr(new_join, Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
ditto
|
new_goto->InheritDeoptTarget(zone(), new_join); |
new_target->LinkTo(new_goto); |
new_target->set_last_instruction(new_goto); |
@@ -1657,7 +1659,8 @@ bool PolymorphicInliner::TryInlineRecognizedMethod(intptr_t receiver_cid, |
new (Z) InlineExitCollector(owner_->caller_graph(), call_); |
ReturnInstr* result = new (Z) |
- ReturnInstr(call_->instance_call()->token_pos(), new (Z) Value(last)); |
+ ReturnInstr(call_->instance_call()->token_pos(), new (Z) Value(last), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
should be call_->deopt_id() I think because we use
|
owner_->caller_graph()->AppendTo( |
last, result, |
call_->env(), // Return can become deoptimization target. |
@@ -1687,8 +1690,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()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
entry->InheritDeoptTarget(zone(), call_); |
// This function uses a cursor (a pointer to the 'current' instruction) to |
@@ -1759,7 +1762,8 @@ 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::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
goto_join->InheritDeoptTarget(zone(), join); |
cursor->LinkTo(goto_join); |
current_block->set_last_instruction(goto_join); |
@@ -1790,13 +1794,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::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:03
kNoDeoptId because InheritDeoptTarget below.
|
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::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
below_target->InheritDeoptTarget(zone(), call_); |
current_block->AddDominatedBlock(below_target); |
cursor = current_block = below_target; |
@@ -1806,13 +1810,14 @@ 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::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
} 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); |
+ new Value(load_cid), new Value(cid_constant), false, |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
/* number_check = */ false
because comment moved
|
+ Thread::Current()->GetNextDeoptId()); // No number check. |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because StrictCompareInstr never deopts
|
+ branch = new BranchInstr(compare, Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:03
kNoDeoptId because InheritDeoptTarget below.
|
} |
branch->InheritDeoptTarget(zone(), call_); |
@@ -1843,9 +1848,11 @@ 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::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:03
kNoDeoptId because InheritDeoptTarget below.
|
true_target->InheritDeoptTarget(zone(), join); |
- GotoInstr* goto_join = new GotoInstr(join); |
+ GotoInstr* goto_join = |
+ new GotoInstr(join, Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
goto_join->InheritDeoptTarget(zone(), join); |
true_target->LinkTo(goto_join); |
true_target->set_last_instruction(goto_join); |
@@ -1856,8 +1863,8 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() { |
// 3. Prepare to handle a match failure on the next iteration or the |
// fall-through code below for non-inlined variants. |
- TargetEntryInstr* false_target = |
- new TargetEntryInstr(AllocateBlockId(), try_idx); |
+ TargetEntryInstr* false_target = new TargetEntryInstr( |
+ AllocateBlockId(), try_idx, Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
false_target->InheritDeoptTarget(zone(), call_); |
*branch->false_successor_address() = false_target; |
cid_test_entry_block->AddDominatedBlock(false_target); |
@@ -1867,14 +1874,17 @@ 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::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
+ TargetEntryInstr* false_target2 = new TargetEntryInstr( |
+ AllocateBlockId(), try_idx, Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:03
kNoDeoptId because InheritDeoptTarget below.
|
*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::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
+ GotoInstr* goto_2 = |
+ new GotoInstr(join, Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
false_target->LinkTo(goto_1); |
false_target2->LinkTo(goto_2); |
false_target->set_last_instruction(goto_1); |
@@ -1909,7 +1919,8 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() { |
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)); |
+ call_->instance_call()->token_pos(), new Value(fallback_call), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
fallback_return->InheritDeoptTargetAfter(owner_->caller_graph(), call_, |
fallback_call); |
AppendInstruction(AppendInstruction(cursor, fallback_call), |
@@ -2294,7 +2305,8 @@ 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()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:01
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
@@ -2343,7 +2355,8 @@ static bool InlineSetIndexed(FlowGraph* flow_graph, |
Definition* stored_value = call->ArgumentAt(2); |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
if (flow_graph->isolate()->type_checks()) { |
@@ -2480,7 +2493,8 @@ static bool InlineDoubleOp(FlowGraph* flow_graph, |
Definition* right = call->ArgumentAt(1); |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
// Arguments are checked. No need for class check. |
BinaryDoubleOpInstr* double_bin_op = new (Z) |
@@ -2504,7 +2518,8 @@ static bool InlineDoubleTestOp(FlowGraph* flow_graph, |
} |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:03
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
// Arguments are checked. No need for class check. |
@@ -2526,7 +2541,8 @@ static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph, |
Definition* right = call->ArgumentAt(1); |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:01
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
// Right arguments is known to be smi: other._bitAndFromSmi(this); |
BinarySmiOpInstr* smi_op = |
@@ -2550,7 +2566,8 @@ static bool InlineGrowableArraySetter(FlowGraph* flow_graph, |
Definition* value = call->ArgumentAt(1); |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:03
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
// This is an internal method, no need to check argument types. |
@@ -2636,7 +2653,8 @@ static bool InlineByteArrayBaseLoad(FlowGraph* flow_graph, |
Definition* array = receiver; |
Definition* index = call->ArgumentAt(1); |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
@@ -2679,7 +2697,8 @@ static bool InlineByteArrayBaseStore(FlowGraph* flow_graph, |
Definition* array = receiver; |
Definition* index = call->ArgumentAt(1); |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
@@ -2845,7 +2864,8 @@ static bool InlineStringBaseCharAt(FlowGraph* flow_graph, |
Definition* index = call->ArgumentAt(1); |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:01
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
*last = PrepareInlineStringIndexOp(flow_graph, call, cid, str, index, *entry); |
@@ -2873,7 +2893,8 @@ static bool InlineStringCodeUnitAt(FlowGraph* flow_graph, |
Definition* index = call->ArgumentAt(1); |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
*last = PrepareInlineStringIndexOp(flow_graph, call, cid, str, index, *entry); |
@@ -2986,7 +3007,8 @@ static bool InlineFloat32x4Method(FlowGraph* flow_graph, |
} |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:03
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
switch (kind) { |
@@ -3104,7 +3126,8 @@ static bool InlineSimdShuffleMethod(FlowGraph* flow_graph, |
return false; |
} |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:03
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
Definition* mask_definition = call->ArgumentAt(1); |
@@ -3132,7 +3155,8 @@ static bool InlineSimdShuffleMixMethod(FlowGraph* flow_graph, |
return false; |
} |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:01
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
Definition* mask_definition = call->ArgumentAt(2); |
@@ -3161,7 +3185,8 @@ static bool InlineInt32x4Method(FlowGraph* flow_graph, |
return false; |
} |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:01
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
switch (kind) { |
@@ -3217,7 +3242,8 @@ static bool InlineFloat64x2Method(FlowGraph* flow_graph, |
return false; |
} |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:03
kNoDeoptId because InheritDeoptTarget below.
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
switch (kind) { |
@@ -3268,7 +3294,8 @@ static bool InlineSimdConstructor(FlowGraph* flow_graph, |
return false; |
} |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
Vyacheslav Egorov (Google)
2017/05/23 12:00:02
kNoDeoptId because InheritDeoptTarget below.
same
|
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
switch (kind) { |
@@ -3349,7 +3376,8 @@ static bool InlineMathCFunction(FlowGraph* flow_graph, |
return false; |
} |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
(*entry)->InheritDeoptTarget(Z, call); |
Instruction* cursor = *entry; |
@@ -3711,7 +3739,8 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph, |
case MethodRecognizer::kObjectConstructor: { |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
(*entry)->InheritDeoptTarget(Z, call); |
ASSERT(!call->HasUses()); |
*last = NULL; // Empty body. |
@@ -3725,11 +3754,13 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph, |
intptr_t length = Smi::Cast(num_elements->BoundConstant()).Value(); |
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()); |
+ *entry = new (Z) TargetEntryInstr( |
+ flow_graph->allocate_block_id(), call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
(*entry)->InheritDeoptTarget(Z, call); |
*last = |
- new (Z) CreateArrayInstr(call->token_pos(), type, num_elements); |
+ new (Z) CreateArrayInstr(call->token_pos(), type, num_elements, |
+ Thread::Current()->GetNextDeoptId()); |
flow_graph->AppendTo( |
*entry, *last, |
call->deopt_id() != Thread::kNoDeoptId ? call->env() : NULL, |
@@ -3758,7 +3789,8 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph, |
if (!type.IsNull()) { |
*entry = new (Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
- call->GetBlock()->try_index()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
(*entry)->InheritDeoptTarget(Z, call); |
*last = new (Z) ConstantInstr(type); |
flow_graph->AppendTo( |
@@ -3774,7 +3806,8 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph, |
// 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()); |
+ call->GetBlock()->try_index(), |
+ Thread::Current()->GetNextDeoptId()); |
(*entry)->InheritDeoptTarget(Z, call); |
Definition* str = call->ArgumentAt(0); |
Definition* index = call->ArgumentAt(1); |