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

Unified Diff: runtime/vm/flow_graph_builder.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.h ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 96ccbae3562bb5b7cee53b84b8a0d4e22f4f8a7d..8973cc48c5be045cc6f5d1a8fe64ff35a8170d6f 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -173,8 +173,8 @@ intptr_t FlowGraphBuilder::context_level() const {
JoinEntryInstr* NestedStatement::BreakTargetFor(SourceLabel* label) {
if (label != label_) return NULL;
if (break_target_ == NULL) {
- break_target_ = new (owner()->zone())
- JoinEntryInstr(owner()->AllocateBlockId(), try_index());
+ break_target_ = new (owner()->zone()) JoinEntryInstr(
+ owner()->AllocateBlockId(), try_index(), owner()->GetNextDeoptId());
}
return break_target_;
}
@@ -246,8 +246,8 @@ class NestedLoop : public NestedStatement {
JoinEntryInstr* NestedLoop::ContinueTargetFor(SourceLabel* label) {
if (label != this->label()) return NULL;
if (continue_target_ == NULL) {
- continue_target_ = new (owner()->zone())
- JoinEntryInstr(owner()->AllocateBlockId(), try_index());
+ continue_target_ = new (owner()->zone()) JoinEntryInstr(
+ owner()->AllocateBlockId(), try_index(), owner()->GetNextDeoptId());
}
return continue_target_;
}
@@ -289,8 +289,8 @@ JoinEntryInstr* NestedSwitch::ContinueTargetFor(SourceLabel* label) {
for (intptr_t i = 0; i < case_labels_.length(); ++i) {
if (label != case_labels_[i]) continue;
if (case_targets_[i] == NULL) {
- case_targets_[i] = new (owner()->zone())
- JoinEntryInstr(owner()->AllocateBlockId(), try_index());
+ case_targets_[i] = new (owner()->zone()) JoinEntryInstr(
+ owner()->AllocateBlockId(), try_index(), owner()->GetNextDeoptId());
}
return case_targets_[i];
}
@@ -442,7 +442,8 @@ Definition* InlineExitCollector::JoinReturns(BlockEntryInstr** exit_block,
// Create a join of the returns.
intptr_t join_id = caller_graph_->max_block_id() + 1;
caller_graph_->set_max_block_id(join_id);
- JoinEntryInstr* join = new (Z) JoinEntryInstr(join_id, try_index);
+ JoinEntryInstr* join = new (Z)
+ JoinEntryInstr(join_id, try_index, Thread::Current()->GetNextDeoptId());
// The dominator set of the join is the intersection of the dominator
// sets of all the predecessors. If we keep the dominator sets ordered
@@ -460,7 +461,8 @@ Definition* InlineExitCollector::JoinReturns(BlockEntryInstr** exit_block,
GrowableArray<BlockEntryInstr*> join_dominators;
for (intptr_t i = 0; i < num_exits; ++i) {
// Add the control-flow edge.
- GotoInstr* goto_instr = new (Z) GotoInstr(join);
+ GotoInstr* goto_instr =
+ new (Z) GotoInstr(join, Thread::Current()->GetNextDeoptId());
goto_instr->InheritDeoptTarget(zone(), ReturnAt(i));
LastInstructionAt(i)->LinkTo(goto_instr);
ExitBlockAt(i)->set_last_instruction(LastInstructionAt(i)->next());
@@ -546,16 +548,19 @@ void InlineExitCollector::ReplaceCall(TargetEntryInstr* callee_entry) {
// goes to the rest of the caller graph. It is removed as unreachable code
// by the constant propagation.
TargetEntryInstr* false_block = new (Z) TargetEntryInstr(
- caller_graph_->allocate_block_id(), call_block->try_index());
+ caller_graph_->allocate_block_id(), call_block->try_index(),
+ Thread::Current()->GetNextDeoptId());
false_block->InheritDeoptTargetAfter(caller_graph_, call_, NULL);
false_block->LinkTo(call_->next());
call_block->ReplaceAsPredecessorWith(false_block);
ConstantInstr* true_const = caller_graph_->GetConstant(Bool::True());
- BranchInstr* branch = new (Z) BranchInstr(new (Z) StrictCompareInstr(
- TokenPosition::kNoSource, Token::kEQ_STRICT, new (Z) Value(true_const),
- new (Z) Value(true_const),
- false)); // No number check.
+ BranchInstr* branch = new (Z)
+ BranchInstr(new (Z) StrictCompareInstr(
+ TokenPosition::kNoSource, Token::kEQ_STRICT,
+ new (Z) Value(true_const), new (Z) Value(true_const),
+ false, Thread::Current()->GetNextDeoptId()),
+ Thread::Current()->GetNextDeoptId()); // No number check.
branch->InheritDeoptTarget(zone(), call_);
*branch->true_successor_address() = callee_entry;
*branch->false_successor_address() = false_block;
@@ -699,7 +704,8 @@ void EffectGraphVisitor::AddInstruction(Instruction* instruction) {
void EffectGraphVisitor::AddReturnExit(TokenPosition token_pos, Value* value) {
ASSERT(is_open());
- ReturnInstr* return_instr = new (Z) ReturnInstr(token_pos, value);
+ ReturnInstr* return_instr =
+ new (Z) ReturnInstr(token_pos, value, owner()->GetNextDeoptId());
AddInstruction(return_instr);
InlineExitCollector* exit_collector = owner()->exit_collector();
if (exit_collector != NULL) {
@@ -712,7 +718,7 @@ void EffectGraphVisitor::AddReturnExit(TokenPosition token_pos, Value* value) {
void EffectGraphVisitor::Goto(JoinEntryInstr* join) {
ASSERT(is_open());
if (is_empty()) {
- entry_ = new (Z) GotoInstr(join);
+ entry_ = new (Z) GotoInstr(join, owner()->GetNextDeoptId());
} else {
exit()->Goto(join);
}
@@ -761,8 +767,9 @@ void EffectGraphVisitor::Join(const TestGraphVisitor& test_fragment,
} else if (false_exit == NULL) {
exit_ = true_exit;
} else {
- JoinEntryInstr* join = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ JoinEntryInstr* join =
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
true_exit->Goto(join);
false_exit->Goto(join);
exit_ = join;
@@ -792,10 +799,11 @@ void EffectGraphVisitor::TieLoop(
Append(test_preamble_fragment);
Append(test_fragment);
} else {
- JoinEntryInstr* join = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
- CheckStackOverflowInstr* check =
- new (Z) CheckStackOverflowInstr(token_pos, owner()->loop_depth());
+ JoinEntryInstr* join =
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
+ CheckStackOverflowInstr* check = new (Z) CheckStackOverflowInstr(
+ token_pos, owner()->loop_depth(), owner()->GetNextDeoptId());
join->LinkTo(check);
if (!test_preamble_fragment.is_empty()) {
check->LinkTo(test_preamble_fragment.entry());
@@ -929,7 +937,8 @@ void TestGraphVisitor::ConnectBranchesTo(
ASSERT(!branches.is_empty());
for (intptr_t i = 0; i < branches.length(); i++) {
TargetEntryInstr* target = new (Z)
- TargetEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ TargetEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
*(branches[i]) = target;
target->Goto(join);
}
@@ -952,13 +961,15 @@ BlockEntryInstr* TestGraphVisitor::CreateSuccessorFor(
if (branches.length() == 1) {
TargetEntryInstr* target = new (Z)
- TargetEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ TargetEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
*(branches[0]) = target;
return target;
}
JoinEntryInstr* join =
- new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
ConnectBranchesTo(branches, join);
return join;
}
@@ -977,13 +988,14 @@ BlockEntryInstr* TestGraphVisitor::CreateFalseSuccessor() const {
void TestGraphVisitor::ReturnValue(Value* value) {
Isolate* isolate = Isolate::Current();
if (isolate->type_checks() || isolate->asserts()) {
- value = Bind(new (Z) AssertBooleanInstr(condition_token_pos(), value));
+ value = Bind(new (Z) AssertBooleanInstr(condition_token_pos(), value,
+ owner()->GetNextDeoptId()));
}
Value* constant_true = Bind(new (Z) ConstantInstr(Bool::True()));
StrictCompareInstr* comp = new (Z) StrictCompareInstr(
- condition_token_pos(), Token::kEQ_STRICT, value, constant_true,
- false); // No number check.
- BranchInstr* branch = new (Z) BranchInstr(comp);
+ condition_token_pos(), Token::kEQ_STRICT, value, constant_true, false,
+ owner()->GetNextDeoptId()); // No number check.
+ BranchInstr* branch = new (Z) BranchInstr(comp, owner()->GetNextDeoptId());
AddInstruction(branch);
CloseFragment();
@@ -993,7 +1005,7 @@ void TestGraphVisitor::ReturnValue(Value* value) {
void TestGraphVisitor::MergeBranchWithStrictCompare(StrictCompareInstr* comp) {
- BranchInstr* branch = new (Z) BranchInstr(comp);
+ BranchInstr* branch = new (Z) BranchInstr(comp, owner()->GetNextDeoptId());
AddInstruction(branch);
CloseFragment();
true_successor_addresses_.Add(branch->true_successor_address());
@@ -1006,8 +1018,8 @@ void TestGraphVisitor::MergeBranchWithNegate(BooleanNegateInstr* neg) {
Value* constant_true = Bind(new (Z) ConstantInstr(Bool::True()));
StrictCompareInstr* comp = new (Z) StrictCompareInstr(
condition_token_pos(), Token::kNE_STRICT, neg->value(), constant_true,
- false); // No number check.
- BranchInstr* branch = new (Z) BranchInstr(comp);
+ false, owner()->GetNextDeoptId()); // No number check.
+ BranchInstr* branch = new (Z) BranchInstr(comp, owner()->GetNextDeoptId());
AddInstruction(branch);
CloseFragment();
true_successor_addresses_.Add(branch->true_successor_address());
@@ -1141,11 +1153,11 @@ void EffectGraphVisitor::VisitReturnNode(ReturnNode* node) {
ZoneGrowableArray<PushArgumentInstr*>* no_arguments =
new (Z) ZoneGrowableArray<PushArgumentInstr*>(0);
const int kTypeArgsLen = 0;
- StaticCallInstr* call_async_clear_thread_stack_trace =
- new (Z) StaticCallInstr(node->token_pos().ToSynthetic(),
- async_clear_thread_stack_trace, kTypeArgsLen,
- Object::null_array(), no_arguments,
- owner()->ic_data_array());
+ StaticCallInstr* call_async_clear_thread_stack_trace = new (Z)
+ StaticCallInstr(node->token_pos().ToSynthetic(),
+ async_clear_thread_stack_trace, kTypeArgsLen,
+ Object::null_array(), no_arguments,
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
Do(call_async_clear_thread_stack_trace);
}
@@ -1180,7 +1192,8 @@ void EffectGraphVisitor::VisitReturnNode(ReturnNode* node) {
const int kTypeArgsLen = 0;
StaticCallInstr* call = new (Z) StaticCallInstr(
node->token_pos().ToSynthetic(), complete_on_async_return, kTypeArgsLen,
- Object::null_array(), arguments, owner()->ic_data_array());
+ Object::null_array(), arguments, owner()->ic_data_array(),
+ owner()->GetNextDeoptId());
Do(call);
// Rebind the return value for the actual return call to be null.
@@ -1198,8 +1211,9 @@ void EffectGraphVisitor::VisitReturnNode(ReturnNode* node) {
if ((function.IsAsyncClosure() || function.IsSyncGenClosure() ||
function.IsAsyncGenClosure()) &&
(node->return_type() == ReturnNode::kContinuationTarget)) {
- JoinEntryInstr* const join = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ JoinEntryInstr* const join =
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
owner()->await_joins()->Add(join);
exit_ = join;
}
@@ -1242,7 +1256,8 @@ void ValueGraphVisitor::VisitTypeNode(TypeNode* node) {
function_type_arguments = BuildFunctionTypeArguments(token_pos);
}
ReturnDefinition(new (Z) InstantiateTypeInstr(
- token_pos, type, instantiator_type_arguments, function_type_arguments));
+ token_pos, type, instantiator_type_arguments, function_type_arguments,
+ owner()->GetNextDeoptId()));
}
@@ -1332,8 +1347,8 @@ void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) {
ValueGraphVisitor for_right(owner());
node->right()->Visit(&for_right);
Value* right_value = for_right.value();
- for_right.Do(
- new (Z) AssertBooleanInstr(node->right()->token_pos(), right_value));
+ for_right.Do(new (Z) AssertBooleanInstr(
+ node->right()->token_pos(), right_value, owner()->GetNextDeoptId()));
if (node->kind() == Token::kAND) {
Join(for_left, for_right, empty);
} else {
@@ -1368,9 +1383,10 @@ void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) {
const String& name = Symbols::Token(node->kind());
const intptr_t kTypeArgsLen = 0;
const intptr_t kNumArgsChecked = 2;
- InstanceCallInstr* call = new (Z) InstanceCallInstr(
- node->token_pos(), name, node->kind(), arguments, kTypeArgsLen,
- Object::null_array(), kNumArgsChecked, owner()->ic_data_array());
+ InstanceCallInstr* call = new (Z)
+ InstanceCallInstr(node->token_pos(), name, node->kind(), arguments,
+ kTypeArgsLen, Object::null_array(), kNumArgsChecked,
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
ReturnDefinition(call);
}
@@ -1393,13 +1409,13 @@ void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) {
Value* right_value = for_right.value();
Isolate* isolate = Isolate::Current();
if (isolate->type_checks() || isolate->asserts()) {
- right_value = for_right.Bind(
- new (Z) AssertBooleanInstr(node->right()->token_pos(), right_value));
+ right_value = for_right.Bind(new (Z) AssertBooleanInstr(
+ node->right()->token_pos(), right_value, owner()->GetNextDeoptId()));
}
Value* constant_true = for_right.Bind(new (Z) ConstantInstr(Bool::True()));
Value* compare = for_right.Bind(new (Z) StrictCompareInstr(
- node->token_pos(), Token::kEQ_STRICT, right_value, constant_true,
- false)); // No number check.
+ node->token_pos(), Token::kEQ_STRICT, right_value, constant_true, false,
+ owner()->GetNextDeoptId())); // No number check.
for_right.Do(BuildStoreExprTemp(compare, node->token_pos()));
if (node->kind() == Token::kAND) {
@@ -1535,7 +1551,7 @@ void EffectGraphVisitor::BuildTypeTest(ComparisonNode* node) {
Library::PrivateCoreLibName(Symbols::_simpleInstanceOf()), node->kind(),
arguments, kTypeArgsLen,
Object::null_array(), // No argument names.
- kNumArgsChecked, owner()->ic_data_array());
+ kNumArgsChecked, owner()->ic_data_array(), owner()->GetNextDeoptId());
if (negate_result) {
result = new (Z) BooleanNegateInstr(Bind(result));
}
@@ -1560,7 +1576,7 @@ void EffectGraphVisitor::BuildTypeTest(ComparisonNode* node) {
node->token_pos(), Library::PrivateCoreLibName(Symbols::_instanceOf()),
node->kind(), arguments, kTypeArgsLen,
Object::null_array(), // No argument names.
- kNumArgsChecked, owner()->ic_data_array());
+ kNumArgsChecked, owner()->ic_data_array(), owner()->GetNextDeoptId());
if (negate_result) {
result = new (Z) BooleanNegateInstr(Bind(result));
}
@@ -1599,7 +1615,7 @@ void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) {
node->token_pos(), Library::PrivateCoreLibName(Symbols::_as()),
node->kind(), arguments, kTypeArgsLen,
Object::null_array(), // No argument names.
- kNumArgsChecked, owner()->ic_data_array());
+ kNumArgsChecked, owner()->ic_data_array(), owner()->GetNextDeoptId());
ReturnDefinition(call);
}
@@ -1616,8 +1632,8 @@ StrictCompareInstr* EffectGraphVisitor::BuildStrictCompare(
right->Visit(&for_right_value);
Append(for_right_value);
StrictCompareInstr* comp = new (Z) StrictCompareInstr(
- token_pos, kind, for_left_value.value(), for_right_value.value(),
- true); // Number check.
+ token_pos, kind, for_left_value.value(), for_right_value.value(), true,
+ owner()->GetNextDeoptId()); // Number check.
return comp;
}
@@ -1673,16 +1689,17 @@ void EffectGraphVisitor::VisitComparisonNode(ComparisonNode* node) {
const intptr_t kTypeArgsLen = 0;
const intptr_t kNumArgsChecked = 2;
- Definition* result = new (Z)
- InstanceCallInstr(node->token_pos(), Symbols::EqualOperator(),
- Token::kEQ, // Result is negated later for kNE.
- arguments, kTypeArgsLen, Object::null_array(),
- kNumArgsChecked, owner()->ic_data_array());
+ Definition* result = new (Z) InstanceCallInstr(
+ node->token_pos(), Symbols::EqualOperator(),
+ Token::kEQ, // Result is negated later for kNE.
+ arguments, kTypeArgsLen, Object::null_array(), kNumArgsChecked,
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
if (node->kind() == Token::kNE) {
Isolate* isolate = Isolate::Current();
if (isolate->type_checks() || isolate->asserts()) {
Value* value = Bind(result);
- result = new (Z) AssertBooleanInstr(node->token_pos(), value);
+ result = new (Z) AssertBooleanInstr(node->token_pos(), value,
+ owner()->GetNextDeoptId());
}
Value* value = Bind(result);
result = new (Z) BooleanNegateInstr(value);
@@ -1710,7 +1727,8 @@ void EffectGraphVisitor::VisitComparisonNode(ComparisonNode* node) {
const intptr_t kTypeArgsLen = 0;
InstanceCallInstr* comp = new (Z) InstanceCallInstr(
node->token_pos(), Symbols::Token(node->kind()), node->kind(), arguments,
- kTypeArgsLen, Object::null_array(), 2, owner()->ic_data_array());
+ kTypeArgsLen, Object::null_array(), 2, owner()->ic_data_array(),
+ owner()->GetNextDeoptId());
ReturnDefinition(comp);
}
@@ -1724,8 +1742,8 @@ void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) {
Value* value = for_value.value();
Isolate* isolate = Isolate::Current();
if (isolate->type_checks() || isolate->asserts()) {
- value =
- Bind(new (Z) AssertBooleanInstr(node->operand()->token_pos(), value));
+ value = Bind(new (Z) AssertBooleanInstr(
+ node->operand()->token_pos(), value, owner()->GetNextDeoptId()));
}
BooleanNegateInstr* negate = new (Z) BooleanNegateInstr(value);
ReturnDefinition(negate);
@@ -1742,7 +1760,8 @@ void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) {
const intptr_t kTypeArgsLen = 0;
InstanceCallInstr* call = new (Z) InstanceCallInstr(
node->token_pos(), Symbols::Token(node->kind()), node->kind(), arguments,
- kTypeArgsLen, Object::null_array(), 1, owner()->ic_data_array());
+ kTypeArgsLen, Object::null_array(), 1, owner()->ic_data_array(),
+ owner()->GetNextDeoptId());
ReturnDefinition(call);
}
@@ -1840,8 +1859,9 @@ void EffectGraphVisitor::VisitCaseNode(CaseNode* node) {
// Compute the start of the statements fragment.
JoinEntryInstr* statement_start = NULL;
if (node->label() == NULL) {
- statement_start = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ statement_start =
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
} else {
// The case nodes are nested inside a SequenceNode that is the body of a
// SwitchNode. The SwitchNode on the nesting stack contains the
@@ -1893,7 +1913,8 @@ void EffectGraphVisitor::VisitCaseNode(CaseNode* node) {
} else {
if (statement_exit != NULL) {
JoinEntryInstr* join = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
statement_exit->Goto(join);
next_target->Goto(join);
exit_instruction = join;
@@ -1976,7 +1997,8 @@ void EffectGraphVisitor::VisitDoWhileNode(DoWhileNode* node) {
// Tie do-while loop (test is after the body).
JoinEntryInstr* body_entry_join =
- new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
Goto(body_entry_join);
Instruction* body_exit = AppendFragment(body_entry_join, for_body);
@@ -1984,10 +2006,11 @@ void EffectGraphVisitor::VisitDoWhileNode(DoWhileNode* node) {
if ((body_exit != NULL) || (join != NULL)) {
if (join == NULL) {
join = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
}
- CheckStackOverflowInstr* check = new (Z)
- CheckStackOverflowInstr(node->token_pos(), owner()->loop_depth());
+ CheckStackOverflowInstr* check = new (Z) CheckStackOverflowInstr(
+ node->token_pos(), owner()->loop_depth(), owner()->GetNextDeoptId());
join->LinkTo(check);
check->LinkTo(for_test.entry());
if (body_exit != NULL) {
@@ -2035,8 +2058,9 @@ void EffectGraphVisitor::VisitForNode(ForNode* node) {
// Join the loop body and increment and then tie the loop.
JoinEntryInstr* continue_join = nested_loop.continue_target();
if ((continue_join != NULL) || for_body.is_open()) {
- JoinEntryInstr* loop_entry = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ JoinEntryInstr* loop_entry =
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
if (continue_join != NULL) {
if (for_body.is_open()) for_body.Goto(continue_join);
Instruction* current = AppendFragment(continue_join, for_increment);
@@ -2053,7 +2077,8 @@ void EffectGraphVisitor::VisitForNode(ForNode* node) {
// the context level (if any) matches the that of the increment
// expression.
AddInstruction(new (Z) CheckStackOverflowInstr(
- node->increment()->token_pos(), owner()->loop_depth()));
+ node->increment()->token_pos(), owner()->loop_depth(),
+ owner()->GetNextDeoptId()));
}
if (node->condition() == NULL) {
@@ -2248,8 +2273,8 @@ void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) {
BuildInstantiatedTypeArguments(node->token_pos(), type_args);
Value* num_elements =
Bind(new (Z) ConstantInstr(Smi::ZoneHandle(Z, Smi::New(node->length()))));
- CreateArrayInstr* create =
- new (Z) CreateArrayInstr(node->token_pos(), element_type, num_elements);
+ CreateArrayInstr* create = new (Z) CreateArrayInstr(
+ node->token_pos(), element_type, num_elements, owner()->GetNextDeoptId());
Value* array_val = Bind(create);
{
@@ -2299,16 +2324,16 @@ void EffectGraphVisitor::VisitStringInterpolateNode(
Z, Resolver::ResolveStatic(
cls, Library::PrivateCoreLibName(Symbols::InterpolateSingle()),
kTypeArgsLen, kNumberOfArguments, kNoArgumentNames));
- StaticCallInstr* call = new (Z)
- StaticCallInstr(node->token_pos(), function, kTypeArgsLen,
- kNoArgumentNames, values, owner()->ic_data_array());
+ StaticCallInstr* call = new (Z) StaticCallInstr(
+ node->token_pos(), function, kTypeArgsLen, kNoArgumentNames, values,
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
ReturnDefinition(call);
return;
}
arguments->Visit(&for_argument);
Append(for_argument);
- StringInterpolateInstr* instr =
- new (Z) StringInterpolateInstr(for_argument.value(), node->token_pos());
+ StringInterpolateInstr* instr = new (Z) StringInterpolateInstr(
+ for_argument.value(), node->token_pos(), owner()->GetNextDeoptId());
ReturnDefinition(instr);
}
@@ -2530,7 +2555,7 @@ void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) {
InstanceCallInstr* call = new (Z) InstanceCallInstr(
node->token_pos(), node->function_name(), Token::kILLEGAL, arguments,
node->arguments()->type_args_len(), node->arguments()->names(), 1,
- owner()->ic_data_array());
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
ReturnDefinition(call);
}
}
@@ -2546,7 +2571,8 @@ void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) {
BuildPushArguments(*node->arguments(), arguments);
StaticCallInstr* call = new (Z) StaticCallInstr(
node->token_pos(), node->function(), node->arguments()->type_args_len(),
- node->arguments()->names(), arguments, owner()->ic_data_array());
+ node->arguments()->names(), arguments, owner()->ic_data_array(),
+ owner()->GetNextDeoptId());
if (node->function().recognized_kind() != MethodRecognizer::kUnknown) {
call->set_result_cid(MethodRecognizer::ResultCid(node->function()));
}
@@ -2580,8 +2606,8 @@ void EffectGraphVisitor::BuildClosureCall(ClosureCallNode* node,
function_load->set_is_immutable(true);
Value* function_val = Bind(function_load);
- Definition* closure_call =
- new (Z) ClosureCallInstr(function_val, node, arguments);
+ Definition* closure_call = new (Z) ClosureCallInstr(
+ function_val, node, arguments, owner()->GetNextDeoptId());
if (result_needed) {
Value* result = Bind(closure_call);
Do(new (Z) StoreLocalInstr(*tmp_var, result, ST(node->token_pos())));
@@ -2605,13 +2631,15 @@ void ValueGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) {
void EffectGraphVisitor::VisitInitStaticFieldNode(InitStaticFieldNode* node) {
Value* field = Bind(
new (Z) ConstantInstr(Field::ZoneHandle(Z, node->field().Original())));
- AddInstruction(new (Z) InitStaticFieldInstr(field, node->field()));
+ AddInstruction(new (Z) InitStaticFieldInstr(field, node->field(),
+ owner()->GetNextDeoptId()));
}
void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) {
Value* context = Bind(BuildCurrentContext(node->token_pos()));
- Value* clone = Bind(new (Z) CloneContextInstr(node->token_pos(), context));
+ Value* clone = Bind(new (Z) CloneContextInstr(node->token_pos(), context,
+ owner()->GetNextDeoptId()));
Do(BuildStoreContext(clone, node->token_pos()));
}
@@ -2645,9 +2673,10 @@ void EffectGraphVisitor::BuildConstructorCall(
BuildPushArguments(*node->arguments(), arguments);
const intptr_t kTypeArgsLen = 0;
- Do(new (Z) StaticCallInstr(node->token_pos(), node->constructor(),
- kTypeArgsLen, node->arguments()->names(),
- arguments, owner()->ic_data_array()));
+ Do(new (Z)
+ StaticCallInstr(node->token_pos(), node->constructor(), kTypeArgsLen,
+ node->arguments()->names(), arguments,
+ owner()->ic_data_array(), owner()->GetNextDeoptId()));
}
@@ -2686,9 +2715,10 @@ void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) {
ASSERT(arguments->length() == 1);
BuildPushArguments(*node->arguments(), arguments);
const int kTypeArgsLen = 0;
- StaticCallInstr* call = new (Z) StaticCallInstr(
- node->token_pos(), node->constructor(), kTypeArgsLen,
- node->arguments()->names(), arguments, owner()->ic_data_array());
+ StaticCallInstr* call = new (Z)
+ StaticCallInstr(node->token_pos(), node->constructor(), kTypeArgsLen,
+ node->arguments()->names(), arguments,
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
const intptr_t result_cid = GetResultCidOfListFactory(node);
if (result_cid != kDynamicCid) {
call->set_result_cid(result_cid);
@@ -2830,7 +2860,7 @@ Value* EffectGraphVisitor::BuildInstantiatedTypeArguments(
}
return Bind(new (Z) InstantiateTypeArgumentsInstr(
token_pos, type_arguments, instantiator_class, instantiator_type_args,
- function_type_args));
+ function_type_args, owner()->GetNextDeoptId()));
}
@@ -2919,9 +2949,10 @@ void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) {
const String& name =
String::ZoneHandle(Z, Field::GetterSymbol(node->field_name()));
const intptr_t kTypeArgsLen = 0;
- InstanceCallInstr* call = new (Z) InstanceCallInstr(
- node->token_pos(), name, Token::kGET, arguments, kTypeArgsLen,
- Object::null_array(), 1, owner()->ic_data_array());
+ InstanceCallInstr* call = new (Z)
+ InstanceCallInstr(node->token_pos(), name, Token::kGET, arguments,
+ kTypeArgsLen, Object::null_array(), 1,
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
ReturnDefinition(call);
}
}
@@ -2983,9 +3014,10 @@ void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) {
String::ZoneHandle(Z, Field::SetterSymbol(node->field_name()));
const int kTypeArgsLen = 0;
const intptr_t kNumArgsChecked = 1; // Do not check value type.
- InstanceCallInstr* call = new (Z) InstanceCallInstr(
- token_pos, name, Token::kSET, arguments, kTypeArgsLen,
- Object::null_array(), kNumArgsChecked, owner()->ic_data_array());
+ InstanceCallInstr* call = new (Z)
+ InstanceCallInstr(token_pos, name, Token::kSET, arguments, kTypeArgsLen,
+ Object::null_array(), kNumArgsChecked,
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
ReturnDefinition(call);
}
@@ -3030,7 +3062,8 @@ void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) {
const intptr_t kNumArgsChecked = 1; // Do not check value type.
Do(new (Z) InstanceCallInstr(token_pos, name, Token::kSET, arguments,
kTypeArgsLen, Object::null_array(),
- kNumArgsChecked, owner()->ic_data_array()));
+ kNumArgsChecked, owner()->ic_data_array(),
+ owner()->GetNextDeoptId()));
ReturnDefinition(BuildLoadExprTemp(token_pos));
}
@@ -3093,10 +3126,10 @@ void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) {
}
ASSERT(!getter_function.IsNull());
const intptr_t kTypeArgsLen = 0;
- StaticCallInstr* call =
- new (Z) StaticCallInstr(node->token_pos(), getter_function, kTypeArgsLen,
- Object::null_array(), // No names
- arguments, owner()->ic_data_array());
+ StaticCallInstr* call = new (Z) StaticCallInstr(
+ node->token_pos(), getter_function, kTypeArgsLen,
+ Object::null_array(), // No names
+ arguments, owner()->ic_data_array(), owner()->GetNextDeoptId());
ReturnDefinition(call);
}
@@ -3158,7 +3191,8 @@ void EffectGraphVisitor::BuildStaticSetter(StaticSetterNode* node,
const intptr_t kTypeArgsLen = 0;
call = new (Z) StaticCallInstr(token_pos, setter_function, kTypeArgsLen,
Object::null_array(), // No names.
- arguments, owner()->ic_data_array());
+ arguments, owner()->ic_data_array(),
+ owner()->GetNextDeoptId());
}
if (result_is_needed) {
Do(call);
@@ -3250,8 +3284,9 @@ void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) {
Value* other = Bind(new (Z) LoadLocalInstr(*other_var, token_pos));
// Receiver is not a number because numbers override equality.
const bool kNoNumberCheck = false;
- StrictCompareInstr* compare = new (Z) StrictCompareInstr(
- token_pos, Token::kEQ_STRICT, receiver, other, kNoNumberCheck);
+ StrictCompareInstr* compare = new (Z)
+ StrictCompareInstr(token_pos, Token::kEQ_STRICT, receiver, other,
+ kNoNumberCheck, owner()->GetNextDeoptId());
return ReturnDefinition(compare);
}
case MethodRecognizer::kStringBaseLength:
@@ -3271,9 +3306,9 @@ void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) {
Value* zero_val =
Bind(new (Z) ConstantInstr(Smi::ZoneHandle(Z, Smi::New(0))));
Value* load_val = Bind(load);
- StrictCompareInstr* compare = new (Z)
- StrictCompareInstr(token_pos, Token::kEQ_STRICT, load_val, zero_val,
- false); // No number check.
+ StrictCompareInstr* compare = new (Z) StrictCompareInstr(
+ token_pos, Token::kEQ_STRICT, load_val, zero_val, false,
+ owner()->GetNextDeoptId()); // No number check.
return ReturnDefinition(compare);
}
case MethodRecognizer::kGrowableArrayLength:
@@ -3316,8 +3351,8 @@ void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) {
node->scope()->LookupVariable(Symbols::Length(), true);
Value* length =
Bind(new (Z) LoadLocalInstr(*length_parameter, token_pos));
- CreateArrayInstr* create_array =
- new CreateArrayInstr(token_pos, element_type, length);
+ CreateArrayInstr* create_array = new CreateArrayInstr(
+ token_pos, element_type, length, owner()->GetNextDeoptId());
return ReturnDefinition(create_array);
}
case MethodRecognizer::kBigint_getDigits: {
@@ -3607,7 +3642,7 @@ void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) {
// Generate static call to super operator.
StaticCallInstr* load = new (Z) StaticCallInstr(
node->token_pos(), *super_function, kTypeArgsLen, Object::null_array(),
- arguments, owner()->ic_data_array());
+ arguments, owner()->ic_data_array(), owner()->GetNextDeoptId());
ReturnDefinition(load);
} else {
// Generate dynamic call to index operator.
@@ -3615,7 +3650,7 @@ void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) {
InstanceCallInstr* load = new (Z) InstanceCallInstr(
node->token_pos(), Symbols::IndexToken(), Token::kINDEX, arguments,
kTypeArgsLen, Object::null_array(), checked_argument_count,
- owner()->ic_data_array());
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
ReturnDefinition(load);
}
}
@@ -3681,7 +3716,7 @@ Definition* EffectGraphVisitor::BuildStoreIndexedValues(StoreIndexedNode* node,
StaticCallInstr* store = new (Z) StaticCallInstr(
token_pos, *super_function, kTypeArgsLen, Object::null_array(),
- arguments, owner()->ic_data_array());
+ arguments, owner()->ic_data_array(), owner()->GetNextDeoptId());
if (result_is_needed) {
Do(store);
return BuildLoadExprTemp(token_pos);
@@ -3694,7 +3729,7 @@ Definition* EffectGraphVisitor::BuildStoreIndexedValues(StoreIndexedNode* node,
InstanceCallInstr* store = new (Z) InstanceCallInstr(
token_pos, Symbols::AssignIndexToken(), Token::kASSIGN_INDEX, arguments,
kTypeArgsLen, Object::null_array(), checked_argument_count,
- owner()->ic_data_array());
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
if (result_is_needed) {
Do(store);
return BuildLoadExprTemp(token_pos);
@@ -3865,11 +3900,11 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
ASSERT(!async_set_thread_stack_trace.IsNull());
// Call _asyncSetThreadStackTrace
const intptr_t kTypeArgsLen = 0;
- StaticCallInstr* call_async_set_thread_stack_trace =
- new (Z) StaticCallInstr(node->token_pos().ToSynthetic(),
- async_set_thread_stack_trace, kTypeArgsLen,
- Object::null_array(), arguments,
- owner()->ic_data_array());
+ StaticCallInstr* call_async_set_thread_stack_trace = new (Z)
+ StaticCallInstr(node->token_pos().ToSynthetic(),
+ async_set_thread_stack_trace, kTypeArgsLen,
+ Object::null_array(), arguments,
+ owner()->ic_data_array(), owner()->GetNextDeoptId());
Do(call_async_set_thread_stack_trace);
}
@@ -3903,8 +3938,8 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
// if we inline or not.
if (!function.IsImplicitGetterFunction() &&
!function.IsImplicitSetterFunction()) {
- CheckStackOverflowInstr* check =
- new (Z) CheckStackOverflowInstr(node->token_pos(), 0);
+ CheckStackOverflowInstr* check = new (Z) CheckStackOverflowInstr(
+ node->token_pos(), 0, owner()->GetNextDeoptId());
// If we are inlining don't actually attach the stack check. We must still
// create the stack check in order to allocate a deopt id.
if (!owner()->IsInlining()) {
@@ -3944,8 +3979,9 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
if (is_top_level_sequence &&
(function.IsAsyncClosure() || function.IsSyncGenClosure() ||
function.IsAsyncGenClosure())) {
- JoinEntryInstr* preamble_end = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ JoinEntryInstr* preamble_end =
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
ASSERT(exit() != NULL);
exit()->Goto(preamble_end);
ASSERT(exit()->next()->IsGoto());
@@ -4087,13 +4123,14 @@ void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) {
if (for_try.is_open()) {
JoinEntryInstr* after_try = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), original_handler_index);
+ JoinEntryInstr(owner()->AllocateBlockId(), original_handler_index,
+ owner()->GetNextDeoptId());
for_try.Goto(after_try);
for_try.exit_ = after_try;
}
- JoinEntryInstr* try_entry =
- new (Z) JoinEntryInstr(owner()->AllocateBlockId(), try_handler_index);
+ JoinEntryInstr* try_entry = new (Z) JoinEntryInstr(
+ owner()->AllocateBlockId(), try_handler_index, owner()->GetNextDeoptId());
Goto(try_entry);
AppendFragment(try_entry, for_try);
@@ -4133,7 +4170,8 @@ void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) {
if (for_catch.is_open()) {
JoinEntryInstr* join = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), original_handler_index);
+ JoinEntryInstr(owner()->AllocateBlockId(), original_handler_index,
+ owner()->GetNextDeoptId());
for_catch.Goto(join);
if (is_open()) Goto(join);
exit_ = join;
@@ -4158,7 +4196,8 @@ void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) {
catch_block->rethrow_stacktrace_var(), finally_block->token_pos()));
for_finally.PushArgument(stacktrace);
for_finally.AddInstruction(
- new (Z) ReThrowInstr(catch_block->token_pos(), catch_handler_index));
+ new (Z) ReThrowInstr(catch_block->token_pos(), catch_handler_index,
+ owner()->GetNextDeoptId()));
for_finally.CloseFragment();
}
ASSERT(!for_finally.is_open());
@@ -4221,9 +4260,9 @@ StaticCallInstr* EffectGraphVisitor::BuildStaticNoSuchMethodCall(
ZoneGrowableArray<PushArgumentInstr*>* push_arguments =
new (Z) ZoneGrowableArray<PushArgumentInstr*>(2);
BuildPushArguments(*args, push_arguments);
- return new (Z) StaticCallInstr(args_pos, no_such_method_func, kTypeArgsLen,
- Object::null_array(), push_arguments,
- owner()->ic_data_array());
+ return new (Z) StaticCallInstr(
+ args_pos, no_such_method_func, kTypeArgsLen, Object::null_array(),
+ push_arguments, owner()->ic_data_array(), owner()->GetNextDeoptId());
}
@@ -4289,7 +4328,8 @@ StaticCallInstr* EffectGraphVisitor::BuildThrowNoSuchMethodError(
ASSERT(!func.IsNull());
return new (Z) StaticCallInstr(token_pos, func, kTypeArgsLen,
Object::null_array(), // No names.
- arguments, owner()->ic_data_array());
+ arguments, owner()->ic_data_array(),
+ owner()->GetNextDeoptId());
}
@@ -4309,13 +4349,14 @@ void EffectGraphVisitor::BuildThrowNode(ThrowNode* node) {
PushArgument(for_exception.value());
Instruction* instr = NULL;
if (node->stacktrace() == NULL) {
- instr = new (Z) ThrowInstr(node->token_pos());
+ instr = new (Z) ThrowInstr(node->token_pos(), owner()->GetNextDeoptId());
} else {
ValueGraphVisitor for_stack_trace(owner());
node->stacktrace()->Visit(&for_stack_trace);
Append(for_stack_trace);
PushArgument(for_stack_trace.value());
- instr = new (Z) ReThrowInstr(node->token_pos(), owner()->catch_try_index());
+ instr = new (Z) ReThrowInstr(node->token_pos(), owner()->catch_try_index(),
+ owner()->GetNextDeoptId());
}
AddInstruction(instr);
}
@@ -4355,7 +4396,8 @@ void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) {
// context variable.
JoinEntryInstr* finally_entry =
- new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
EffectGraphVisitor for_finally_block(owner());
for_finally_block.AdjustContextLevel(node->finally_block()->scope());
node->finally_block()->Visit(&for_finally_block);
@@ -4365,8 +4407,9 @@ void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) {
}
if (for_finally_block.is_open()) {
- JoinEntryInstr* after_finally = new (Z)
- JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
+ JoinEntryInstr* after_finally =
+ new (Z) JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index(),
+ owner()->GetNextDeoptId());
for_finally_block.Goto(after_finally);
for_finally_block.exit_ = after_finally;
}
@@ -4396,8 +4439,8 @@ FlowGraph* FlowGraphBuilder::BuildGraph() {
AstPrinter ast_printer;
ast_printer.PrintFunctionScope(parsed_function());
}
- TargetEntryInstr* normal_entry = new (Z)
- TargetEntryInstr(AllocateBlockId(), CatchClauseNode::kInvalidTryIndex);
+ TargetEntryInstr* normal_entry = new (Z) TargetEntryInstr(
+ AllocateBlockId(), CatchClauseNode::kInvalidTryIndex, GetNextDeoptId());
graph_entry_ =
new (Z) GraphEntryInstr(parsed_function(), normal_entry, osr_id_);
EffectGraphVisitor for_effect(this);
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698