Skip to content

Commit c94bebf

Browse files
Shuffle around deopt id allocation to give the flow graph builder a chance to record other data as they are allocated.
We'll use deopt-id -> context-level or deopt-id -> scope mappings to find what variables are in scope for the debugger and async stack trace machinery. [email protected] Review-Url: https://codereview.chromium.org/2896903002 .
1 parent 7fa25e0 commit c94bebf

23 files changed

+554
-403
lines changed

runtime/vm/aot_optimizer.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ bool AotOptimizer::TryReplaceWithEqualityOp(InstanceCallInstr* call,
710710
StrictCompareInstr* comp = new (Z)
711711
StrictCompareInstr(call->token_pos(), Token::kEQ_STRICT,
712712
new (Z) Value(left), new (Z) Value(right),
713-
false); // No number check.
713+
/* number_check = */ false, Thread::kNoDeoptId);
714714
ReplaceCall(call, comp);
715715
return true;
716716
}
@@ -1441,10 +1441,9 @@ void AotOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) {
14411441
ConstantInstr* cid =
14421442
flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(type_cid)));
14431443

1444-
StrictCompareInstr* check_cid =
1445-
new (Z) StrictCompareInstr(call->token_pos(), Token::kEQ_STRICT,
1446-
new (Z) Value(left_cid), new (Z) Value(cid),
1447-
false); // No number check.
1444+
StrictCompareInstr* check_cid = new (Z) StrictCompareInstr(
1445+
call->token_pos(), Token::kEQ_STRICT, new (Z) Value(left_cid),
1446+
new (Z) Value(cid), /* number_check = */ false, Thread::kNoDeoptId);
14481447
ReplaceCall(call, check_cid);
14491448
return;
14501449
}

runtime/vm/branch_optimizer.cc

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ JoinEntryInstr* BranchSimplifier::ToJoinEntry(Zone* zone,
6565
// Convert a target block into a join block. Branches will be duplicated
6666
// so the former true and false targets become joins of the control flows
6767
// from all the duplicated branches.
68-
JoinEntryInstr* join =
69-
new (zone) JoinEntryInstr(target->block_id(), target->try_index());
68+
JoinEntryInstr* join = new (zone) JoinEntryInstr(
69+
target->block_id(), target->try_index(), Thread::kNoDeoptId);
7070
join->InheritDeoptTarget(zone, target);
7171
join->LinkTo(target->next());
7272
join->set_last_instruction(target->last_instruction());
@@ -82,7 +82,8 @@ BranchInstr* BranchSimplifier::CloneBranch(Zone* zone,
8282
ComparisonInstr* comparison = branch->comparison();
8383
ComparisonInstr* new_comparison =
8484
comparison->CopyWithNewOperands(new_left, new_right);
85-
BranchInstr* new_branch = new (zone) BranchInstr(new_comparison);
85+
BranchInstr* new_branch =
86+
new (zone) BranchInstr(new_comparison, Thread::kNoDeoptId);
8687
return new_branch;
8788
}
8889

@@ -183,20 +184,24 @@ void BranchSimplifier::Simplify(FlowGraph* flow_graph) {
183184

184185
// Connect the branch to the true and false joins, via empty target
185186
// blocks.
186-
TargetEntryInstr* true_target = new (zone) TargetEntryInstr(
187-
flow_graph->max_block_id() + 1, block->try_index());
187+
TargetEntryInstr* true_target =
188+
new (zone) TargetEntryInstr(flow_graph->max_block_id() + 1,
189+
block->try_index(), Thread::kNoDeoptId);
188190
true_target->InheritDeoptTarget(zone, join_true);
189-
TargetEntryInstr* false_target = new (zone) TargetEntryInstr(
190-
flow_graph->max_block_id() + 2, block->try_index());
191+
TargetEntryInstr* false_target =
192+
new (zone) TargetEntryInstr(flow_graph->max_block_id() + 2,
193+
block->try_index(), Thread::kNoDeoptId);
191194
false_target->InheritDeoptTarget(zone, join_false);
192195
flow_graph->set_max_block_id(flow_graph->max_block_id() + 2);
193196
*new_branch->true_successor_address() = true_target;
194197
*new_branch->false_successor_address() = false_target;
195-
GotoInstr* goto_true = new (zone) GotoInstr(join_true);
198+
GotoInstr* goto_true =
199+
new (zone) GotoInstr(join_true, Thread::kNoDeoptId);
196200
goto_true->InheritDeoptTarget(zone, join_true);
197201
true_target->LinkTo(goto_true);
198202
true_target->set_last_instruction(goto_true);
199-
GotoInstr* goto_false = new (zone) GotoInstr(join_false);
203+
GotoInstr* goto_false =
204+
new (zone) GotoInstr(join_false, Thread::kNoDeoptId);
200205
goto_false->InheritDeoptTarget(zone, join_false);
201206
false_target->LinkTo(goto_false);
202207
false_target->set_last_instruction(goto_false);
@@ -295,8 +300,9 @@ void IfConverter::Simplify(FlowGraph* flow_graph) {
295300

296301
ComparisonInstr* new_comparison = comparison->CopyWithNewOperands(
297302
comparison->left()->Copy(zone), comparison->right()->Copy(zone));
298-
IfThenElseInstr* if_then_else = new (zone) IfThenElseInstr(
299-
new_comparison, if_true->Copy(zone), if_false->Copy(zone));
303+
IfThenElseInstr* if_then_else = new (zone)
304+
IfThenElseInstr(new_comparison, if_true->Copy(zone),
305+
if_false->Copy(zone), Thread::kNoDeoptId);
300306
flow_graph->InsertBefore(branch, if_then_else, NULL,
301307
FlowGraph::kValue);
302308

runtime/vm/constant_propagator.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,8 @@ void ConstantPropagator::EliminateRedundantBranches() {
15511551
// Drop the comparison, which does not have side effects
15521552
JoinEntryInstr* join = if_true->AsJoinEntry();
15531553
if (join->phis() == NULL) {
1554-
GotoInstr* jump = new (Z) GotoInstr(if_true->AsJoinEntry());
1554+
GotoInstr* jump =
1555+
new (Z) GotoInstr(if_true->AsJoinEntry(), Thread::kNoDeoptId);
15551556
jump->InheritDeoptTarget(Z, branch);
15561557

15571558
Instruction* previous = branch->previous();
@@ -1694,16 +1695,16 @@ void ConstantPropagator::Transform() {
16941695
ASSERT(reachable_->Contains(if_false->preorder_number()));
16951696
ASSERT(if_false->parallel_move() == NULL);
16961697
ASSERT(if_false->loop_info() == NULL);
1697-
join =
1698-
new (Z) JoinEntryInstr(if_false->block_id(), if_false->try_index());
1698+
join = new (Z) JoinEntryInstr(
1699+
if_false->block_id(), if_false->try_index(), Thread::kNoDeoptId);
16991700
join->InheritDeoptTarget(Z, if_false);
17001701
if_false->UnuseAllInputs();
17011702
next = if_false->next();
17021703
} else if (!reachable_->Contains(if_false->preorder_number())) {
17031704
ASSERT(if_true->parallel_move() == NULL);
17041705
ASSERT(if_true->loop_info() == NULL);
1705-
join =
1706-
new (Z) JoinEntryInstr(if_true->block_id(), if_true->try_index());
1706+
join = new (Z) JoinEntryInstr(if_true->block_id(), if_true->try_index(),
1707+
Thread::kNoDeoptId);
17071708
join->InheritDeoptTarget(Z, if_true);
17081709
if_true->UnuseAllInputs();
17091710
next = if_true->next();
@@ -1714,7 +1715,7 @@ void ConstantPropagator::Transform() {
17141715
// Drop the comparison, which does not have side effects as long
17151716
// as it is a strict compare (the only one we can determine is
17161717
// constant with the current analysis).
1717-
GotoInstr* jump = new (Z) GotoInstr(join);
1718+
GotoInstr* jump = new (Z) GotoInstr(join, Thread::kNoDeoptId);
17181719
jump->InheritDeoptTarget(Z, branch);
17191720

17201721
Instruction* previous = branch->previous();

runtime/vm/flow_graph.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,8 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis,
10181018
for (intptr_t i = parameter_count(); i < variable_count(); ++i) {
10191019
if (i == CurrentContextEnvIndex()) {
10201020
if (function().IsClosureFunction()) {
1021-
CurrentContextInstr* context = new CurrentContextInstr();
1021+
CurrentContextInstr* context =
1022+
new CurrentContextInstr(Thread::kNoDeoptId);
10221023
context->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
10231024
AddToInitialDefinitions(context);
10241025
env.Add(context);

0 commit comments

Comments
 (0)