| Index: runtime/vm/flow_graph_builder.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_builder.cc (revision 17406)
|
| +++ runtime/vm/flow_graph_builder.cc (working copy)
|
| @@ -204,9 +204,7 @@
|
| temp_index_ = true_fragment.temp_index();
|
| } else {
|
| JoinEntryInstr* join =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth());
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| true_exit->Goto(join);
|
| false_exit->Goto(join);
|
| exit_ = join;
|
| @@ -235,9 +233,7 @@
|
| Append(test_fragment);
|
| } else {
|
| JoinEntryInstr* join =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth() + 1);
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| join->LinkTo(test_fragment.entry());
|
| Goto(join);
|
| body_exit->Goto(join);
|
| @@ -349,9 +345,7 @@
|
| ASSERT(!branches.is_empty());
|
| for (intptr_t i = 0; i < branches.length(); i++) {
|
| TargetEntryInstr* target =
|
| - new TargetEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth());
|
| + new TargetEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| *(branches[i]) = target;
|
| target->Goto(join);
|
| }
|
| @@ -374,17 +368,13 @@
|
|
|
| if (branches.length() == 1) {
|
| TargetEntryInstr* target =
|
| - new TargetEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth());
|
| + new TargetEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| *(branches[0]) = target;
|
| return target;
|
| }
|
|
|
| JoinEntryInstr* join =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth());
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| ConnectBranchesTo(branches, join);
|
| return join;
|
| }
|
| @@ -475,13 +465,11 @@
|
| if ((node->kind() == Token::kAND) || (node->kind() == Token::kOR)) {
|
| TestGraphVisitor for_left(owner(),
|
| temp_index(),
|
| - loop_depth(),
|
| node->left()->token_pos());
|
| node->left()->Visit(&for_left);
|
|
|
| TestGraphVisitor for_right(owner(),
|
| temp_index(),
|
| - loop_depth(),
|
| node->right()->token_pos());
|
| node->right()->Visit(&for_right);
|
|
|
| @@ -520,13 +508,13 @@
|
| // <Statement> ::= Return { value: <Expression>
|
| // inlined_finally_list: <InlinedFinally>* }
|
| void EffectGraphVisitor::VisitReturnNode(ReturnNode* node) {
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->value()->Visit(&for_value);
|
| Append(for_value);
|
|
|
| for (intptr_t i = 0; i < node->inlined_finally_list_length(); i++) {
|
| InlineBailout("EffectGraphVisitor::VisitReturnNode (exception)");
|
| - EffectGraphVisitor for_effect(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_effect(owner(), temp_index());
|
| node->InlinedFinallyNodeAt(i)->Visit(&for_effect);
|
| Append(for_effect);
|
| if (!is_open()) return;
|
| @@ -649,7 +637,7 @@
|
| // type: AbstractType
|
| // dst_name: String }
|
| void EffectGraphVisitor::VisitAssignableNode(AssignableNode* node) {
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->expr()->Visit(&for_value);
|
| Append(for_value);
|
| Definition* checked_value;
|
| @@ -669,7 +657,7 @@
|
|
|
|
|
| void ValueGraphVisitor::VisitAssignableNode(AssignableNode* node) {
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->expr()->Visit(&for_value);
|
| Append(for_value);
|
| ReturnValue(BuildAssignableValue(node->expr()->token_pos(),
|
| @@ -689,12 +677,11 @@
|
| // See ValueGraphVisitor::VisitBinaryOpNode.
|
| TestGraphVisitor for_left(owner(),
|
| temp_index(),
|
| - loop_depth(),
|
| node->left()->token_pos());
|
| node->left()->Visit(&for_left);
|
| - EffectGraphVisitor for_right(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_right(owner(), temp_index());
|
| node->right()->Visit(&for_right);
|
| - EffectGraphVisitor empty(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor empty(owner(), temp_index());
|
| if (node->kind() == Token::kAND) {
|
| Join(for_left, for_right, empty);
|
| } else {
|
| @@ -702,12 +689,12 @@
|
| }
|
| return;
|
| }
|
| - ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_left_value(owner(), temp_index());
|
| node->left()->Visit(&for_left_value);
|
| Append(for_left_value);
|
| PushArgumentInstr* push_left = PushArgument(for_left_value.value());
|
|
|
| - ValueGraphVisitor for_right_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_right_value(owner(), temp_index());
|
| node->right()->Visit(&for_right_value);
|
| Append(for_right_value);
|
| PushArgumentInstr* push_right = PushArgument(for_right_value.value());
|
| @@ -739,11 +726,10 @@
|
|
|
| TestGraphVisitor for_test(owner(),
|
| temp_index(),
|
| - loop_depth(),
|
| node->left()->token_pos());
|
| node->left()->Visit(&for_test);
|
|
|
| - ValueGraphVisitor for_right(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_right(owner(), temp_index());
|
| node->right()->Visit(&for_right);
|
| Value* right_value = for_right.value();
|
| if (FLAG_enable_type_checks) {
|
| @@ -759,13 +745,13 @@
|
| for_right.Do(BuildStoreExprTemp(compare));
|
|
|
| if (node->kind() == Token::kAND) {
|
| - ValueGraphVisitor for_false(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_false(owner(), temp_index());
|
| Value* constant_false = for_false.Bind(new ConstantInstr(Bool::False()));
|
| for_false.Do(BuildStoreExprTemp(constant_false));
|
| Join(for_test, for_right, for_false);
|
| } else {
|
| ASSERT(node->kind() == Token::kOR);
|
| - ValueGraphVisitor for_true(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_true(owner(), temp_index());
|
| Value* constant_true = for_true.Bind(new ConstantInstr(Bool::True()));
|
| for_true.Do(BuildStoreExprTemp(constant_true));
|
| Join(for_test, for_true, for_right);
|
| @@ -878,7 +864,7 @@
|
|
|
| void EffectGraphVisitor::BuildTypeTest(ComparisonNode* node) {
|
| ASSERT(Token::IsTypeTestOperator(node->kind()));
|
| - EffectGraphVisitor for_left_value(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_left_value(owner(), temp_index());
|
| node->left()->Visit(&for_left_value);
|
| Append(for_left_value);
|
| }
|
| @@ -888,7 +874,7 @@
|
| ASSERT(Token::IsTypeCastOperator(node->kind()));
|
| const AbstractType& type = node->right()->AsTypeNode()->type();
|
| ASSERT(type.IsFinalized()); // The type in a type cast may be malformed.
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->left()->Visit(&for_value);
|
| const String& dst_name = String::ZoneHandle(
|
| Symbols::New(Exceptions::kCastErrorDstName));
|
| @@ -909,7 +895,7 @@
|
| const Type& object_type = Type::Handle(Type::ObjectType());
|
| if (type.IsInstantiated() && object_type.IsSubtypeOf(type, NULL)) {
|
| // Must evaluate left side.
|
| - EffectGraphVisitor for_left_value(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_left_value(owner(), temp_index());
|
| node->left()->Visit(&for_left_value);
|
| Append(for_left_value);
|
| ReturnDefinition(new ConstantInstr(negate_result ?
|
| @@ -943,7 +929,7 @@
|
| return;
|
| }
|
|
|
| - ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_left_value(owner(), temp_index());
|
| node->left()->Visit(&for_left_value);
|
| Append(for_left_value);
|
| PushArgumentInstr* push_left = PushArgument(for_left_value.value());
|
| @@ -986,7 +972,7 @@
|
| ASSERT(Token::IsTypeCastOperator(node->kind()));
|
| const AbstractType& type = node->right()->AsTypeNode()->type();
|
| ASSERT(type.IsFinalized()); // The type in a type cast may be malformed.
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->left()->Visit(&for_value);
|
| Append(for_value);
|
| const String& dst_name = String::ZoneHandle(
|
| @@ -1013,10 +999,10 @@
|
| }
|
| if ((node->kind() == Token::kEQ_STRICT) ||
|
| (node->kind() == Token::kNE_STRICT)) {
|
| - ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_left_value(owner(), temp_index());
|
| node->left()->Visit(&for_left_value);
|
| Append(for_left_value);
|
| - ValueGraphVisitor for_right_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_right_value(owner(), temp_index());
|
| node->right()->Visit(&for_right_value);
|
| Append(for_right_value);
|
| StrictCompareInstr* comp = new StrictCompareInstr(
|
| @@ -1026,10 +1012,10 @@
|
| }
|
|
|
| if ((node->kind() == Token::kEQ) || (node->kind() == Token::kNE)) {
|
| - ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_left_value(owner(), temp_index());
|
| node->left()->Visit(&for_left_value);
|
| Append(for_left_value);
|
| - ValueGraphVisitor for_right_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_right_value(owner(), temp_index());
|
| node->right()->Visit(&for_right_value);
|
| Append(for_right_value);
|
| if (FLAG_enable_type_checks) {
|
| @@ -1056,10 +1042,10 @@
|
| return;
|
| }
|
|
|
| - ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_left_value(owner(), temp_index());
|
| node->left()->Visit(&for_left_value);
|
| Append(for_left_value);
|
| - ValueGraphVisitor for_right_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_right_value(owner(), temp_index());
|
| node->right()->Visit(&for_right_value);
|
| Append(for_right_value);
|
| RelationalOpInstr* comp = new RelationalOpInstr(node->token_pos(),
|
| @@ -1073,7 +1059,7 @@
|
| void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) {
|
| // "!" cannot be overloaded, therefore do not call operator.
|
| if (node->kind() == Token::kNOT) {
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->operand()->Visit(&for_value);
|
| Append(for_value);
|
| Value* value = for_value.value();
|
| @@ -1086,7 +1072,7 @@
|
| return;
|
| }
|
|
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->operand()->Visit(&for_value);
|
| Append(for_value);
|
| PushArgumentInstr* push_value = PushArgument(for_value.value());
|
| @@ -1108,14 +1094,13 @@
|
| void EffectGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) {
|
| TestGraphVisitor for_test(owner(),
|
| temp_index(),
|
| - loop_depth(),
|
| node->condition()->token_pos());
|
| node->condition()->Visit(&for_test);
|
|
|
| // Translate the subexpressions for their effects.
|
| - EffectGraphVisitor for_true(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_true(owner(), temp_index());
|
| node->true_expr()->Visit(&for_true);
|
| - EffectGraphVisitor for_false(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_false(owner(), temp_index());
|
| node->false_expr()->Visit(&for_false);
|
|
|
| Join(for_test, for_true, for_false);
|
| @@ -1125,16 +1110,15 @@
|
| void ValueGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) {
|
| TestGraphVisitor for_test(owner(),
|
| temp_index(),
|
| - loop_depth(),
|
| node->condition()->token_pos());
|
| node->condition()->Visit(&for_test);
|
|
|
| - ValueGraphVisitor for_true(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_true(owner(), temp_index());
|
| node->true_expr()->Visit(&for_true);
|
| ASSERT(for_true.is_open());
|
| for_true.Do(BuildStoreExprTemp(for_true.value()));
|
|
|
| - ValueGraphVisitor for_false(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_false(owner(), temp_index());
|
| node->false_expr()->Visit(&for_false);
|
| ASSERT(for_false.is_open());
|
| for_false.Do(BuildStoreExprTemp(for_false.value()));
|
| @@ -1150,12 +1134,11 @@
|
| void EffectGraphVisitor::VisitIfNode(IfNode* node) {
|
| TestGraphVisitor for_test(owner(),
|
| temp_index(),
|
| - loop_depth(),
|
| node->condition()->token_pos());
|
| node->condition()->Visit(&for_test);
|
|
|
| - EffectGraphVisitor for_true(owner(), temp_index(), loop_depth());
|
| - EffectGraphVisitor for_false(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_true(owner(), temp_index());
|
| + EffectGraphVisitor for_false(owner(), temp_index());
|
|
|
| node->true_branch()->Visit(&for_true);
|
| // The for_false graph fragment will be empty (default graph fragment) if
|
| @@ -1166,11 +1149,10 @@
|
|
|
|
|
| void EffectGraphVisitor::VisitSwitchNode(SwitchNode* node) {
|
| - EffectGraphVisitor switch_body(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor switch_body(owner(), temp_index());
|
| node->body()->Visit(&switch_body);
|
| Append(switch_body);
|
| if ((node->label() != NULL) && (node->label()->join_for_break() != NULL)) {
|
| - node->label()->join_for_break()->set_loop_depth(loop_depth());
|
| if (is_open()) Goto(node->label()->join_for_break());
|
| exit_ = node->label()->join_for_break();
|
| }
|
| @@ -1204,7 +1186,7 @@
|
| void EffectGraphVisitor::VisitCaseNode(CaseNode* node) {
|
| const intptr_t len = node->case_expressions()->length();
|
| // Create case statements instructions.
|
| - EffectGraphVisitor for_case_statements(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_case_statements(owner(), temp_index());
|
| // Compute start of statements fragment.
|
| JoinEntryInstr* statement_start = NULL;
|
| if ((node->label() != NULL) && node->label()->is_continue_target()) {
|
| @@ -1213,14 +1195,12 @@
|
| statement_start = node->label()->join_for_continue();
|
| if (statement_start == NULL) {
|
| statement_start = new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth());
|
| + owner()->try_index());
|
| node->label()->set_join_for_continue(statement_start);
|
| }
|
| } else {
|
| statement_start = new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth());
|
| + owner()->try_index());
|
| }
|
| node->statements()->Visit(&for_case_statements);
|
| Instruction* statement_exit =
|
| @@ -1239,7 +1219,6 @@
|
| AstNode* case_expr = node->case_expressions()->NodeAt(i);
|
| TestGraphVisitor for_case_expression(owner(),
|
| temp_index(),
|
| - loop_depth(),
|
| case_expr->token_pos());
|
| case_expr->Visit(&for_case_expression);
|
| if (i == 0) {
|
| @@ -1268,8 +1247,7 @@
|
| } else {
|
| if (statement_exit != NULL) {
|
| JoinEntryInstr* join = new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth());
|
| + owner()->try_index());
|
| statement_exit->Goto(join);
|
| next_target->Goto(join);
|
| exit_instruction = join;
|
| @@ -1303,12 +1281,11 @@
|
| void EffectGraphVisitor::VisitWhileNode(WhileNode* node) {
|
| TestGraphVisitor for_test(owner(),
|
| temp_index(),
|
| - loop_depth() + 1,
|
| node->condition()->token_pos());
|
| node->condition()->Visit(&for_test);
|
| ASSERT(!for_test.is_empty()); // Language spec.
|
|
|
| - EffectGraphVisitor for_body(owner(), temp_index(), loop_depth() + 1);
|
| + EffectGraphVisitor for_body(owner(), temp_index());
|
| for_body.AddInstruction(
|
| new CheckStackOverflowInstr(node->token_pos()));
|
| node->body()->Visit(&for_body);
|
| @@ -1318,14 +1295,12 @@
|
| ASSERT(lbl != NULL);
|
| JoinEntryInstr* join = lbl->join_for_continue();
|
| if (join != NULL) {
|
| - join->set_loop_depth(loop_depth() + 1);
|
| if (for_body.is_open()) for_body.Goto(join);
|
| for_body.exit_ = join;
|
| }
|
| TieLoop(for_test, for_body);
|
| join = lbl->join_for_break();
|
| if (join != NULL) {
|
| - join->set_loop_depth(loop_depth());
|
| Goto(join);
|
| exit_ = join;
|
| }
|
| @@ -1342,14 +1317,13 @@
|
| // g) break-join
|
| void EffectGraphVisitor::VisitDoWhileNode(DoWhileNode* node) {
|
| // Traverse body first in order to generate continue and break labels.
|
| - EffectGraphVisitor for_body(owner(), temp_index(), loop_depth() + 1);
|
| + EffectGraphVisitor for_body(owner(), temp_index());
|
| for_body.AddInstruction(
|
| new CheckStackOverflowInstr(node->token_pos()));
|
| node->body()->Visit(&for_body);
|
|
|
| TestGraphVisitor for_test(owner(),
|
| temp_index(),
|
| - loop_depth() + 1,
|
| node->condition()->token_pos());
|
| node->condition()->Visit(&for_test);
|
| ASSERT(is_open());
|
| @@ -1357,8 +1331,7 @@
|
| // Tie do-while loop (test is after the body).
|
| JoinEntryInstr* body_entry_join =
|
| new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth() + 1);
|
| + owner()->try_index());
|
| Goto(body_entry_join);
|
| Instruction* body_exit = AppendFragment(body_entry_join, for_body);
|
|
|
| @@ -1366,10 +1339,7 @@
|
| if ((body_exit != NULL) || (join != NULL)) {
|
| if (join == NULL) {
|
| join = new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth() + 1);
|
| - } else {
|
| - join->set_loop_depth(loop_depth() + 1);
|
| + owner()->try_index());
|
| }
|
| join->LinkTo(for_test.entry());
|
| if (body_exit != NULL) {
|
| @@ -1382,7 +1352,6 @@
|
| if (join == NULL) {
|
| exit_ = for_test.CreateFalseSuccessor();
|
| } else {
|
| - join->set_loop_depth(loop_depth());
|
| for_test.IfFalseGoto(join);
|
| exit_ = join;
|
| }
|
| @@ -1402,13 +1371,13 @@
|
| // h) loop-exit-target
|
| // i) break-join
|
| void EffectGraphVisitor::VisitForNode(ForNode* node) {
|
| - EffectGraphVisitor for_initializer(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_initializer(owner(), temp_index());
|
| node->initializer()->Visit(&for_initializer);
|
| Append(for_initializer);
|
| ASSERT(is_open());
|
|
|
| // Compose body to set any jump labels.
|
| - EffectGraphVisitor for_body(owner(), temp_index(), loop_depth() + 1);
|
| + EffectGraphVisitor for_body(owner(), temp_index());
|
| for_body.AddInstruction(
|
| new CheckStackOverflowInstr(node->token_pos()));
|
| node->body()->Visit(&for_body);
|
| @@ -1416,11 +1385,10 @@
|
| // Join loop body, increment and compute their end instruction.
|
| ASSERT(!for_body.is_empty());
|
| Instruction* loop_increment_end = NULL;
|
| - EffectGraphVisitor for_increment(owner(), temp_index(), loop_depth() + 1);
|
| + EffectGraphVisitor for_increment(owner(), temp_index());
|
| node->increment()->Visit(&for_increment);
|
| JoinEntryInstr* join = node->label()->join_for_continue();
|
| if (join != NULL) {
|
| - join->set_loop_depth(loop_depth() + 1);
|
| // Insert the join between the body and increment.
|
| if (for_body.is_open()) for_body.Goto(join);
|
| loop_increment_end = AppendFragment(join, for_increment);
|
| @@ -1439,9 +1407,7 @@
|
| // body is not open, i.e., no backward branch exists.
|
| if (loop_increment_end != NULL) {
|
| JoinEntryInstr* loop_start =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth() + 1);
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| Goto(loop_start);
|
| loop_increment_end->Goto(loop_start);
|
| exit_ = loop_start;
|
| @@ -1450,20 +1416,16 @@
|
| if (node->condition() == NULL) {
|
| // Endless loop, no test.
|
| JoinEntryInstr* body_entry =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth() + 1);
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| AppendFragment(body_entry, for_body);
|
| Goto(body_entry);
|
| if (node->label()->join_for_break() != NULL) {
|
| - node->label()->join_for_break()->set_loop_depth(loop_depth());
|
| // Control flow of ForLoop continues into join_for_break.
|
| exit_ = node->label()->join_for_break();
|
| }
|
| } else {
|
| TestGraphVisitor for_test(owner(),
|
| temp_index(),
|
| - loop_depth() + 1,
|
| node->condition()->token_pos());
|
| node->condition()->Visit(&for_test);
|
| Append(for_test);
|
| @@ -1474,7 +1436,6 @@
|
| if (node->label()->join_for_break() == NULL) {
|
| exit_ = for_test.CreateFalseSuccessor();
|
| } else {
|
| - node->label()->join_for_break()->set_loop_depth(loop_depth());
|
| for_test.IfFalseGoto(node->label()->join_for_break());
|
| exit_ = node->label()->join_for_break();
|
| }
|
| @@ -1484,7 +1445,7 @@
|
|
|
| void EffectGraphVisitor::VisitJumpNode(JumpNode* node) {
|
| for (intptr_t i = 0; i < node->inlined_finally_list_length(); i++) {
|
| - EffectGraphVisitor for_effect(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_effect(owner(), temp_index());
|
| node->InlinedFinallyNodeAt(i)->Visit(&for_effect);
|
| Append(for_effect);
|
| if (!is_open()) return;
|
| @@ -1522,17 +1483,13 @@
|
| if (node->kind() == Token::kBREAK) {
|
| if (node->label()->join_for_break() == NULL) {
|
| node->label()->set_join_for_break(
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - BlockEntryInstr::kInvalidLoopDepth));
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index()));
|
| }
|
| jump_target = node->label()->join_for_break();
|
| } else {
|
| if (node->label()->join_for_continue() == NULL) {
|
| node->label()->set_join_for_continue(
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - BlockEntryInstr::kInvalidLoopDepth));
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index()));
|
| }
|
| jump_target = node->label()->join_for_continue();
|
| }
|
| @@ -1561,7 +1518,7 @@
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| new ZoneGrowableArray<PushArgumentInstr*>(node->length());
|
| for (int i = 0; i < node->length(); ++i) {
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->ElementAt(i)->Visit(&for_value);
|
| Append(for_value);
|
| arguments->Add(PushArgument(for_value.value()));
|
| @@ -1608,7 +1565,7 @@
|
| receiver = BuildNullValue();
|
| } else {
|
| ASSERT(function.IsImplicitInstanceClosureFunction());
|
| - ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_receiver(owner(), temp_index());
|
| node->receiver()->Visit(&for_receiver);
|
| Append(for_receiver);
|
| receiver = for_receiver.value();
|
| @@ -1642,7 +1599,7 @@
|
| const ArgumentListNode& node,
|
| ZoneGrowableArray<Value*>* values) {
|
| for (intptr_t i = 0; i < node.length(); ++i) {
|
| - ValueGraphVisitor for_argument(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_argument(owner(), temp_index());
|
| node.NodeAt(i)->Visit(&for_argument);
|
| Append(for_argument);
|
| values->Add(for_argument.value());
|
| @@ -1654,7 +1611,7 @@
|
| const ArgumentListNode& node,
|
| ZoneGrowableArray<PushArgumentInstr*>* values) {
|
| for (intptr_t i = 0; i < node.length(); ++i) {
|
| - ValueGraphVisitor for_argument(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_argument(owner(), temp_index());
|
| node.NodeAt(i)->Visit(&for_argument);
|
| Append(for_argument);
|
| PushArgumentInstr* push_arg = PushArgument(for_argument.value());
|
| @@ -1664,7 +1621,7 @@
|
|
|
|
|
| void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) {
|
| - ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_receiver(owner(), temp_index());
|
| node->receiver()->Visit(&for_receiver);
|
| Append(for_receiver);
|
| PushArgumentInstr* push_receiver = PushArgument(for_receiver.value());
|
| @@ -1694,10 +1651,10 @@
|
| const Library& core_lib = Library::Handle(Library::CoreLibrary());
|
| if (cls.library() == core_lib.raw()) {
|
| ASSERT(node->arguments()->length() == 2);
|
| - ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_left_value(owner(), temp_index());
|
| node->arguments()->NodeAt(0)->Visit(&for_left_value);
|
| Append(for_left_value);
|
| - ValueGraphVisitor for_right_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_right_value(owner(), temp_index());
|
| node->arguments()->NodeAt(1)->Visit(&for_right_value);
|
| Append(for_right_value);
|
| StrictCompareInstr* comp = new StrictCompareInstr(
|
| @@ -1723,7 +1680,7 @@
|
|
|
| ClosureCallInstr* EffectGraphVisitor::BuildClosureCall(
|
| ClosureCallNode* node) {
|
| - ValueGraphVisitor for_closure(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_closure(owner(), temp_index());
|
| node->closure()->Visit(&for_closure);
|
| Append(for_closure);
|
| PushArgumentInstr* push_closure = PushArgument(for_closure.value());
|
| @@ -1922,7 +1879,7 @@
|
| }
|
|
|
| ASSERT(owner()->parsed_function().instantiator() != NULL);
|
| - ValueGraphVisitor for_instantiator(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_instantiator(owner(), temp_index());
|
| owner()->parsed_function().instantiator()->Visit(&for_instantiator);
|
| Append(for_instantiator);
|
| return for_instantiator.value();
|
| @@ -1957,7 +1914,7 @@
|
| // No instantiator for factories.
|
| ASSERT(instantiator == NULL);
|
| ASSERT(owner()->parsed_function().instantiator() != NULL);
|
| - ValueGraphVisitor for_instantiator(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_instantiator(owner(), temp_index());
|
| owner()->parsed_function().instantiator()->Visit(&for_instantiator);
|
| Append(for_instantiator);
|
| return for_instantiator.value();
|
| @@ -2105,7 +2062,7 @@
|
|
|
|
|
| void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) {
|
| - ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_receiver(owner(), temp_index());
|
| node->receiver()->Visit(&for_receiver);
|
| Append(for_receiver);
|
| PushArgumentInstr* push_receiver = PushArgument(for_receiver.value());
|
| @@ -2125,12 +2082,12 @@
|
| InstanceSetterNode* node,
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments,
|
| bool result_is_needed) {
|
| - ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_receiver(owner(), temp_index());
|
| node->receiver()->Visit(&for_receiver);
|
| Append(for_receiver);
|
| arguments->Add(PushArgument(for_receiver.value()));
|
|
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->value()->Visit(&for_value);
|
| Append(for_value);
|
|
|
| @@ -2197,7 +2154,7 @@
|
| ReturnDefinition(call);
|
| return;
|
| } else {
|
| - ValueGraphVisitor receiver_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor receiver_value(owner(), temp_index());
|
| node->receiver()->Visit(&receiver_value);
|
| Append(receiver_value);
|
| arguments->Add(PushArgument(receiver_value.value()));
|
| @@ -2271,12 +2228,12 @@
|
| } else {
|
| if (is_super_setter) {
|
| // Add receiver of instance getter.
|
| - ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_receiver(owner(), temp_index());
|
| node->receiver()->Visit(&for_receiver);
|
| Append(for_receiver);
|
| arguments->Add(PushArgument(for_receiver.value()));
|
| }
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->value()->Visit(&for_value);
|
| Append(for_value);
|
| Value* value = NULL;
|
| @@ -2327,7 +2284,7 @@
|
| // <Expression> ::= LoadLocal { local: LocalVariable }
|
| void EffectGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) {
|
| if (node->HasPseudo()) {
|
| - EffectGraphVisitor for_pseudo(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_pseudo(owner(), temp_index());
|
| node->pseudo()->Visit(&for_pseudo);
|
| Append(for_pseudo);
|
| }
|
| @@ -2345,7 +2302,7 @@
|
| // value: <Expression> }
|
| void EffectGraphVisitor::HandleStoreLocal(StoreLocalNode* node,
|
| bool result_is_needed) {
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->value()->Visit(&for_value);
|
| Append(for_value);
|
| Value* store_value = for_value.value();
|
| @@ -2374,7 +2331,7 @@
|
|
|
| void EffectGraphVisitor::VisitLoadInstanceFieldNode(
|
| LoadInstanceFieldNode* node) {
|
| - ValueGraphVisitor for_instance(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_instance(owner(), temp_index());
|
| node->instance()->Visit(&for_instance);
|
| Append(for_instance);
|
| LoadFieldInstr* load = new LoadFieldInstr(
|
| @@ -2387,10 +2344,10 @@
|
|
|
| void EffectGraphVisitor::VisitStoreInstanceFieldNode(
|
| StoreInstanceFieldNode* node) {
|
| - ValueGraphVisitor for_instance(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_instance(owner(), temp_index());
|
| node->instance()->Visit(&for_instance);
|
| Append(for_instance);
|
| - ValueGraphVisitor for_value(owner(), for_instance.temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), for_instance.temp_index());
|
| node->value()->Visit(&for_value);
|
| Append(for_value);
|
| Value* store_value = for_value.value();
|
| @@ -2424,7 +2381,7 @@
|
|
|
| Definition* EffectGraphVisitor::BuildStoreStaticField(
|
| StoreStaticFieldNode* node, bool result_is_needed) {
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->value()->Visit(&for_value);
|
| Append(for_value);
|
| Value* store_value = NULL;
|
| @@ -2487,12 +2444,12 @@
|
| }
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| new ZoneGrowableArray<PushArgumentInstr*>(2);
|
| - ValueGraphVisitor for_array(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_array(owner(), temp_index());
|
| node->array()->Visit(&for_array);
|
| Append(for_array);
|
| arguments->Add(PushArgument(for_array.value()));
|
|
|
| - ValueGraphVisitor for_index(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_index(owner(), temp_index());
|
| node->index_expr()->Visit(&for_index);
|
| Append(for_index);
|
| arguments->Add(PushArgument(for_index.value()));
|
| @@ -2533,7 +2490,7 @@
|
| if (result_is_needed) {
|
| // Even though noSuchMethod most likely does not return,
|
| // we save the stored value if the result is needed.
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->value()->Visit(&for_value);
|
| Append(for_value);
|
| Bind(BuildStoreExprTemp(for_value.value()));
|
| @@ -2558,17 +2515,17 @@
|
|
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| new ZoneGrowableArray<PushArgumentInstr*>(3);
|
| - ValueGraphVisitor for_array(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_array(owner(), temp_index());
|
| node->array()->Visit(&for_array);
|
| Append(for_array);
|
| arguments->Add(PushArgument(for_array.value()));
|
|
|
| - ValueGraphVisitor for_index(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_index(owner(), temp_index());
|
| node->index_expr()->Visit(&for_index);
|
| Append(for_index);
|
| arguments->Add(PushArgument(for_index.value()));
|
|
|
| - ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_value(owner(), temp_index());
|
| node->value()->Visit(&for_value);
|
| Append(for_value);
|
| Value* value = NULL;
|
| @@ -2754,7 +2711,7 @@
|
|
|
| intptr_t i = 0;
|
| while (is_open() && (i < node->length())) {
|
| - EffectGraphVisitor for_effect(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_effect(owner(), temp_index());
|
| node->NodeAt(i++)->Visit(&for_effect);
|
| Append(for_effect);
|
| if (!is_open()) {
|
| @@ -2779,7 +2736,6 @@
|
| // taken care of unchaining the context.
|
| if ((node->label() != NULL) &&
|
| (node->label()->join_for_break() != NULL)) {
|
| - node->label()->join_for_break()->set_loop_depth(loop_depth());
|
| if (is_open()) Goto(node->label()->join_for_break());
|
| exit_ = node->label()->join_for_break();
|
| }
|
| @@ -2800,7 +2756,7 @@
|
| new CatchEntryInstr(node->exception_var(), node->stacktrace_var()));
|
| BuildLoadContext(node->context_var());
|
|
|
| - EffectGraphVisitor for_catch(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_catch(owner(), temp_index());
|
| node->VisitChildren(&for_catch);
|
| Append(for_catch);
|
| }
|
| @@ -2815,20 +2771,18 @@
|
| // Preserve CTX into local variable '%saved_context'.
|
| BuildStoreContext(node->context_var());
|
|
|
| - EffectGraphVisitor for_try_block(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_try_block(owner(), temp_index());
|
| node->try_block()->Visit(&for_try_block);
|
|
|
| if (for_try_block.is_open()) {
|
| JoinEntryInstr* after_try =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - old_try_index,
|
| - loop_depth());
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), old_try_index);
|
| for_try_block.Goto(after_try);
|
| for_try_block.exit_ = after_try;
|
| }
|
|
|
| JoinEntryInstr* try_entry =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(), try_index, loop_depth());
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), try_index);
|
|
|
| Goto(try_entry);
|
| AppendFragment(try_entry, for_try_block);
|
| @@ -2843,12 +2797,10 @@
|
| // that we can set the appropriate handler pc when we generate
|
| // code for this catch block.
|
| catch_block->set_try_index(try_index);
|
| - EffectGraphVisitor for_catch_block(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_catch_block(owner(), temp_index());
|
| catch_block->Visit(&for_catch_block);
|
| TargetEntryInstr* catch_entry =
|
| - new TargetEntryInstr(owner()->AllocateBlockId(),
|
| - old_try_index,
|
| - loop_depth());
|
| + new TargetEntryInstr(owner()->AllocateBlockId(), old_try_index);
|
| catch_entry->set_catch_try_index(try_index);
|
| catch_entry->set_catch_handler_types(catch_block->handler_types());
|
| owner()->AddCatchEntry(catch_entry);
|
| @@ -2857,7 +2809,6 @@
|
| if (node->end_catch_label() != NULL) {
|
| JoinEntryInstr* join = node->end_catch_label()->join_for_continue();
|
| if (join != NULL) {
|
| - join->set_loop_depth(loop_depth());
|
| if (is_open()) Goto(join);
|
| exit_ = join;
|
| }
|
| @@ -2866,7 +2817,7 @@
|
|
|
| // Generate code for the finally block if one exists.
|
| if ((node->finally_block() != NULL) && is_open()) {
|
| - EffectGraphVisitor for_finally_block(owner(), temp_index(), loop_depth());
|
| + EffectGraphVisitor for_finally_block(owner(), temp_index());
|
| node->finally_block()->Visit(&for_finally_block);
|
| Append(for_finally_block);
|
| }
|
| @@ -2895,7 +2846,7 @@
|
|
|
| // Evaluate the receiver before the arguments. This will be used
|
| // as an argument to the noSuchMethod call.
|
| - ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_receiver(owner(), temp_index());
|
| receiver->Visit(&for_receiver);
|
| Append(for_receiver);
|
| PushArgumentInstr* push_receiver = PushArgument(for_receiver.value());
|
| @@ -3000,7 +2951,7 @@
|
| // TODO(kmillikin) non-local control flow is not handled correctly
|
| // by the inliner.
|
| InlineBailout("EffectGraphVisitor::BuildThrowNode (exception)");
|
| - ValueGraphVisitor for_exception(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_exception(owner(), temp_index());
|
| node->exception()->Visit(&for_exception);
|
| Append(for_exception);
|
| PushArgument(for_exception.value());
|
| @@ -3008,7 +2959,7 @@
|
| if (node->stacktrace() == NULL) {
|
| instr = new ThrowInstr(node->token_pos());
|
| } else {
|
| - ValueGraphVisitor for_stack_trace(owner(), temp_index(), loop_depth());
|
| + ValueGraphVisitor for_stack_trace(owner(), temp_index());
|
| node->stacktrace()->Visit(&for_stack_trace);
|
| Append(for_stack_trace);
|
| PushArgument(for_stack_trace.value());
|
| @@ -3045,10 +2996,8 @@
|
| BuildLoadContext(node->context_var());
|
|
|
| JoinEntryInstr* finally_entry =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth());
|
| - EffectGraphVisitor for_finally_block(owner(), temp_index(), loop_depth());
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| + EffectGraphVisitor for_finally_block(owner(), temp_index());
|
| node->finally_block()->Visit(&for_finally_block);
|
|
|
| if (try_index >= 0) {
|
| @@ -3057,9 +3006,7 @@
|
|
|
| if (for_finally_block.is_open()) {
|
| JoinEntryInstr* after_finally =
|
| - new JoinEntryInstr(owner()->AllocateBlockId(),
|
| - owner()->try_index(),
|
| - loop_depth());
|
| + new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
| for_finally_block.Goto(after_finally);
|
| for_finally_block.exit_ = after_finally;
|
| }
|
| @@ -3070,7 +3017,7 @@
|
| }
|
|
|
|
|
| -FlowGraph* FlowGraphBuilder::BuildGraph(intptr_t initial_loop_depth) {
|
| +FlowGraph* FlowGraphBuilder::BuildGraph() {
|
| if (FLAG_print_ast) {
|
| // Print the function ast before IL generation.
|
| AstPrinter::PrintFunctionNodes(parsed_function());
|
| @@ -3079,10 +3026,9 @@
|
| const Function& function = parsed_function().function();
|
| TargetEntryInstr* normal_entry =
|
| new TargetEntryInstr(AllocateBlockId(),
|
| - CatchClauseNode::kInvalidTryIndex,
|
| - initial_loop_depth);
|
| + CatchClauseNode::kInvalidTryIndex);
|
| graph_entry_ = new GraphEntryInstr(normal_entry);
|
| - EffectGraphVisitor for_effect(this, 0, initial_loop_depth);
|
| + EffectGraphVisitor for_effect(this, 0);
|
| // TODO(kmillikin): We can eliminate stack checks in some cases (e.g., the
|
| // stack check on entry for leaf routines).
|
| Instruction* check = new CheckStackOverflowInstr(function.token_pos());
|
|
|