| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 } | 1133 } |
| 1134 | 1134 |
| 1135 if (FLAG_causal_async_stacks && | 1135 if (FLAG_causal_async_stacks && |
| 1136 (function.IsAsyncClosure() || function.IsAsyncGenClosure())) { | 1136 (function.IsAsyncClosure() || function.IsAsyncGenClosure())) { |
| 1137 // We are returning from an asynchronous closure. Before we do that, be | 1137 // We are returning from an asynchronous closure. Before we do that, be |
| 1138 // sure to clear the thread's asynchronous stack trace. | 1138 // sure to clear the thread's asynchronous stack trace. |
| 1139 const Function& async_clear_thread_stack_trace = Function::ZoneHandle( | 1139 const Function& async_clear_thread_stack_trace = Function::ZoneHandle( |
| 1140 Z, isolate()->object_store()->async_clear_thread_stack_trace()); | 1140 Z, isolate()->object_store()->async_clear_thread_stack_trace()); |
| 1141 ZoneGrowableArray<PushArgumentInstr*>* no_arguments = | 1141 ZoneGrowableArray<PushArgumentInstr*>* no_arguments = |
| 1142 new (Z) ZoneGrowableArray<PushArgumentInstr*>(0); | 1142 new (Z) ZoneGrowableArray<PushArgumentInstr*>(0); |
| 1143 StaticCallInstr* call_async_clear_thread_stack_trace = new (Z) | 1143 const int kTypeArgsLen = 0; |
| 1144 StaticCallInstr(node->token_pos().ToSynthetic(), | 1144 StaticCallInstr* call_async_clear_thread_stack_trace = |
| 1145 async_clear_thread_stack_trace, Object::null_array(), | 1145 new (Z) StaticCallInstr(node->token_pos().ToSynthetic(), |
| 1146 no_arguments, owner()->ic_data_array()); | 1146 async_clear_thread_stack_trace, kTypeArgsLen, |
| 1147 Object::null_array(), no_arguments, |
| 1148 owner()->ic_data_array()); |
| 1147 Do(call_async_clear_thread_stack_trace); | 1149 Do(call_async_clear_thread_stack_trace); |
| 1148 } | 1150 } |
| 1149 | 1151 |
| 1150 // Async functions contain two types of return statements: | 1152 // Async functions contain two types of return statements: |
| 1151 // 1) Returns that should complete the completer once all finally blocks have | 1153 // 1) Returns that should complete the completer once all finally blocks have |
| 1152 // been inlined (call: :async_completer.complete(return_value)). These | 1154 // been inlined (call: :async_completer.complete(return_value)). These |
| 1153 // returns end up returning null in the end. | 1155 // returns end up returning null in the end. |
| 1154 // 2) "Continuation" returns that should not complete the completer but return | 1156 // 2) "Continuation" returns that should not complete the completer but return |
| 1155 // the value. | 1157 // the value. |
| 1156 // | 1158 // |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1168 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 1170 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 1169 Value* rcv_value = Bind(BuildLoadLocal(*rcv_var, node->token_pos())); | 1171 Value* rcv_value = Bind(BuildLoadLocal(*rcv_var, node->token_pos())); |
| 1170 arguments->Add(PushArgument(rcv_value)); | 1172 arguments->Add(PushArgument(rcv_value)); |
| 1171 Value* returned_value = Bind(BuildLoadExprTemp(node->token_pos())); | 1173 Value* returned_value = Bind(BuildLoadExprTemp(node->token_pos())); |
| 1172 arguments->Add(PushArgument(returned_value)); | 1174 arguments->Add(PushArgument(returned_value)); |
| 1173 // Call a helper function to complete the completer. The debugger | 1175 // Call a helper function to complete the completer. The debugger |
| 1174 // uses the helper function to know when to step-out. | 1176 // uses the helper function to know when to step-out. |
| 1175 const Function& complete_on_async_return = Function::ZoneHandle( | 1177 const Function& complete_on_async_return = Function::ZoneHandle( |
| 1176 Z, isolate()->object_store()->complete_on_async_return()); | 1178 Z, isolate()->object_store()->complete_on_async_return()); |
| 1177 ASSERT(!complete_on_async_return.IsNull()); | 1179 ASSERT(!complete_on_async_return.IsNull()); |
| 1180 const int kTypeArgsLen = 0; |
| 1178 StaticCallInstr* call = new (Z) StaticCallInstr( | 1181 StaticCallInstr* call = new (Z) StaticCallInstr( |
| 1179 node->token_pos().ToSynthetic(), complete_on_async_return, | 1182 node->token_pos().ToSynthetic(), complete_on_async_return, kTypeArgsLen, |
| 1180 Object::null_array(), arguments, owner()->ic_data_array()); | 1183 Object::null_array(), arguments, owner()->ic_data_array()); |
| 1181 Do(call); | 1184 Do(call); |
| 1182 | 1185 |
| 1183 // Rebind the return value for the actual return call to be null. | 1186 // Rebind the return value for the actual return call to be null. |
| 1184 return_value = BuildNullValue(node->token_pos()); | 1187 return_value = BuildNullValue(node->token_pos()); |
| 1185 } | 1188 } |
| 1186 | 1189 |
| 1187 intptr_t current_context_level = owner()->context_level(); | 1190 intptr_t current_context_level = owner()->context_level(); |
| 1188 ASSERT(current_context_level >= 0); | 1191 ASSERT(current_context_level >= 0); |
| 1189 if (HasContextScope()) { | 1192 if (HasContextScope()) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 ValueGraphVisitor for_right_value(owner()); | 1358 ValueGraphVisitor for_right_value(owner()); |
| 1356 node->right()->Visit(&for_right_value); | 1359 node->right()->Visit(&for_right_value); |
| 1357 Append(for_right_value); | 1360 Append(for_right_value); |
| 1358 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); | 1361 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); |
| 1359 | 1362 |
| 1360 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 1363 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 1361 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 1364 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 1362 arguments->Add(push_left); | 1365 arguments->Add(push_left); |
| 1363 arguments->Add(push_right); | 1366 arguments->Add(push_right); |
| 1364 const String& name = Symbols::Token(node->kind()); | 1367 const String& name = Symbols::Token(node->kind()); |
| 1368 const intptr_t kTypeArgsLen = 0; |
| 1365 const intptr_t kNumArgsChecked = 2; | 1369 const intptr_t kNumArgsChecked = 2; |
| 1366 InstanceCallInstr* call = new (Z) InstanceCallInstr( | 1370 InstanceCallInstr* call = new (Z) InstanceCallInstr( |
| 1367 node->token_pos(), name, node->kind(), arguments, Object::null_array(), | 1371 node->token_pos(), name, node->kind(), arguments, kTypeArgsLen, |
| 1368 kNumArgsChecked, owner()->ic_data_array()); | 1372 Object::null_array(), kNumArgsChecked, owner()->ic_data_array()); |
| 1369 ReturnDefinition(call); | 1373 ReturnDefinition(call); |
| 1370 } | 1374 } |
| 1371 | 1375 |
| 1372 | 1376 |
| 1373 // Special handling for AND/OR. | 1377 // Special handling for AND/OR. |
| 1374 void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { | 1378 void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { |
| 1375 // Operators "&&" and "||" cannot be overloaded therefore do not call | 1379 // Operators "&&" and "||" cannot be overloaded therefore do not call |
| 1376 // operator. | 1380 // operator. |
| 1377 if ((node->kind() == Token::kAND) || (node->kind() == Token::kOR)) { | 1381 if ((node->kind() == Token::kAND) || (node->kind() == Token::kOR)) { |
| 1378 // Implement short-circuit logic: do not evaluate right if evaluation | 1382 // Implement short-circuit logic: do not evaluate right if evaluation |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 | 1520 |
| 1517 // We now know type is a real class (!num, !int, !smi, !string) | 1521 // We now know type is a real class (!num, !int, !smi, !string) |
| 1518 // and the type check could NOT be removed at compile time. | 1522 // and the type check could NOT be removed at compile time. |
| 1519 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); | 1523 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); |
| 1520 if (FlowGraphBuilder::SimpleInstanceOfType(type)) { | 1524 if (FlowGraphBuilder::SimpleInstanceOfType(type)) { |
| 1521 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 1525 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 1522 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 1526 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 1523 arguments->Add(push_left); | 1527 arguments->Add(push_left); |
| 1524 Value* type_const = Bind(new (Z) ConstantInstr(type)); | 1528 Value* type_const = Bind(new (Z) ConstantInstr(type)); |
| 1525 arguments->Add(PushArgument(type_const)); | 1529 arguments->Add(PushArgument(type_const)); |
| 1530 const intptr_t kTypeArgsLen = 0; |
| 1526 const intptr_t kNumArgsChecked = 2; | 1531 const intptr_t kNumArgsChecked = 2; |
| 1527 Definition* result = new (Z) InstanceCallInstr( | 1532 Definition* result = new (Z) InstanceCallInstr( |
| 1528 node->token_pos(), | 1533 node->token_pos(), |
| 1529 Library::PrivateCoreLibName(Symbols::_simpleInstanceOf()), node->kind(), | 1534 Library::PrivateCoreLibName(Symbols::_simpleInstanceOf()), node->kind(), |
| 1530 arguments, | 1535 arguments, kTypeArgsLen, |
| 1531 Object::null_array(), // No argument names. | 1536 Object::null_array(), // No argument names. |
| 1532 kNumArgsChecked, owner()->ic_data_array()); | 1537 kNumArgsChecked, owner()->ic_data_array()); |
| 1533 if (negate_result) { | 1538 if (negate_result) { |
| 1534 result = new (Z) BooleanNegateInstr(Bind(result)); | 1539 result = new (Z) BooleanNegateInstr(Bind(result)); |
| 1535 } | 1540 } |
| 1536 ReturnDefinition(result); | 1541 ReturnDefinition(result); |
| 1537 return; | 1542 return; |
| 1538 } | 1543 } |
| 1539 | 1544 |
| 1540 PushArgumentInstr* push_instantiator_type_args = | 1545 PushArgumentInstr* push_instantiator_type_args = |
| 1541 PushInstantiatorTypeArguments(type, node->token_pos()); | 1546 PushInstantiatorTypeArguments(type, node->token_pos()); |
| 1542 PushArgumentInstr* push_function_type_args = | 1547 PushArgumentInstr* push_function_type_args = |
| 1543 PushFunctionTypeArguments(type, node->token_pos()); | 1548 PushFunctionTypeArguments(type, node->token_pos()); |
| 1544 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 1549 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 1545 new (Z) ZoneGrowableArray<PushArgumentInstr*>(4); | 1550 new (Z) ZoneGrowableArray<PushArgumentInstr*>(4); |
| 1546 arguments->Add(push_left); | 1551 arguments->Add(push_left); |
| 1547 arguments->Add(push_instantiator_type_args); | 1552 arguments->Add(push_instantiator_type_args); |
| 1548 arguments->Add(push_function_type_args); | 1553 arguments->Add(push_function_type_args); |
| 1549 Value* type_const = Bind(new (Z) ConstantInstr(type)); | 1554 Value* type_const = Bind(new (Z) ConstantInstr(type)); |
| 1550 arguments->Add(PushArgument(type_const)); | 1555 arguments->Add(PushArgument(type_const)); |
| 1556 const intptr_t kTypeArgsLen = 0; |
| 1551 const intptr_t kNumArgsChecked = 1; | 1557 const intptr_t kNumArgsChecked = 1; |
| 1552 Definition* result = new (Z) InstanceCallInstr( | 1558 Definition* result = new (Z) InstanceCallInstr( |
| 1553 node->token_pos(), Library::PrivateCoreLibName(Symbols::_instanceOf()), | 1559 node->token_pos(), Library::PrivateCoreLibName(Symbols::_instanceOf()), |
| 1554 node->kind(), arguments, | 1560 node->kind(), arguments, kTypeArgsLen, |
| 1555 Object::null_array(), // No argument names. | 1561 Object::null_array(), // No argument names. |
| 1556 kNumArgsChecked, owner()->ic_data_array()); | 1562 kNumArgsChecked, owner()->ic_data_array()); |
| 1557 if (negate_result) { | 1563 if (negate_result) { |
| 1558 result = new (Z) BooleanNegateInstr(Bind(result)); | 1564 result = new (Z) BooleanNegateInstr(Bind(result)); |
| 1559 } | 1565 } |
| 1560 ReturnDefinition(result); | 1566 ReturnDefinition(result); |
| 1561 } | 1567 } |
| 1562 | 1568 |
| 1563 | 1569 |
| 1564 void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { | 1570 void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1579 PushInstantiatorTypeArguments(type, node->token_pos()); | 1585 PushInstantiatorTypeArguments(type, node->token_pos()); |
| 1580 PushArgumentInstr* push_function_type_args = | 1586 PushArgumentInstr* push_function_type_args = |
| 1581 PushFunctionTypeArguments(type, node->token_pos()); | 1587 PushFunctionTypeArguments(type, node->token_pos()); |
| 1582 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 1588 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 1583 new (Z) ZoneGrowableArray<PushArgumentInstr*>(4); | 1589 new (Z) ZoneGrowableArray<PushArgumentInstr*>(4); |
| 1584 arguments->Add(push_left); | 1590 arguments->Add(push_left); |
| 1585 arguments->Add(push_instantiator_type_args); | 1591 arguments->Add(push_instantiator_type_args); |
| 1586 arguments->Add(push_function_type_args); | 1592 arguments->Add(push_function_type_args); |
| 1587 Value* type_arg = Bind(new (Z) ConstantInstr(type)); | 1593 Value* type_arg = Bind(new (Z) ConstantInstr(type)); |
| 1588 arguments->Add(PushArgument(type_arg)); | 1594 arguments->Add(PushArgument(type_arg)); |
| 1595 const int kTypeArgsLen = 0; |
| 1589 const intptr_t kNumArgsChecked = 1; | 1596 const intptr_t kNumArgsChecked = 1; |
| 1590 InstanceCallInstr* call = new (Z) InstanceCallInstr( | 1597 InstanceCallInstr* call = new (Z) InstanceCallInstr( |
| 1591 node->token_pos(), Library::PrivateCoreLibName(Symbols::_as()), | 1598 node->token_pos(), Library::PrivateCoreLibName(Symbols::_as()), |
| 1592 node->kind(), arguments, | 1599 node->kind(), arguments, kTypeArgsLen, |
| 1593 Object::null_array(), // No argument names. | 1600 Object::null_array(), // No argument names. |
| 1594 kNumArgsChecked, owner()->ic_data_array()); | 1601 kNumArgsChecked, owner()->ic_data_array()); |
| 1595 ReturnDefinition(call); | 1602 ReturnDefinition(call); |
| 1596 } | 1603 } |
| 1597 | 1604 |
| 1598 | 1605 |
| 1599 StrictCompareInstr* EffectGraphVisitor::BuildStrictCompare( | 1606 StrictCompareInstr* EffectGraphVisitor::BuildStrictCompare( |
| 1600 AstNode* left, | 1607 AstNode* left, |
| 1601 AstNode* right, | 1608 AstNode* right, |
| 1602 Token::Kind kind, | 1609 Token::Kind kind, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 Append(for_left_value); | 1663 Append(for_left_value); |
| 1657 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); | 1664 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); |
| 1658 arguments->Add(push_left); | 1665 arguments->Add(push_left); |
| 1659 | 1666 |
| 1660 ValueGraphVisitor for_right_value(owner()); | 1667 ValueGraphVisitor for_right_value(owner()); |
| 1661 node->right()->Visit(&for_right_value); | 1668 node->right()->Visit(&for_right_value); |
| 1662 Append(for_right_value); | 1669 Append(for_right_value); |
| 1663 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); | 1670 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); |
| 1664 arguments->Add(push_right); | 1671 arguments->Add(push_right); |
| 1665 | 1672 |
| 1673 const intptr_t kTypeArgsLen = 0; |
| 1666 const intptr_t kNumArgsChecked = 2; | 1674 const intptr_t kNumArgsChecked = 2; |
| 1667 Definition* result = new (Z) | 1675 Definition* result = new (Z) |
| 1668 InstanceCallInstr(node->token_pos(), Symbols::EqualOperator(), | 1676 InstanceCallInstr(node->token_pos(), Symbols::EqualOperator(), |
| 1669 Token::kEQ, // Result is negated later for kNE. | 1677 Token::kEQ, // Result is negated later for kNE. |
| 1670 arguments, Object::null_array(), kNumArgsChecked, | 1678 arguments, kTypeArgsLen, Object::null_array(), |
| 1671 owner()->ic_data_array()); | 1679 kNumArgsChecked, owner()->ic_data_array()); |
| 1672 if (node->kind() == Token::kNE) { | 1680 if (node->kind() == Token::kNE) { |
| 1673 Isolate* isolate = Isolate::Current(); | 1681 Isolate* isolate = Isolate::Current(); |
| 1674 if (isolate->type_checks() || isolate->asserts()) { | 1682 if (isolate->type_checks() || isolate->asserts()) { |
| 1675 Value* value = Bind(result); | 1683 Value* value = Bind(result); |
| 1676 result = new (Z) AssertBooleanInstr(node->token_pos(), value); | 1684 result = new (Z) AssertBooleanInstr(node->token_pos(), value); |
| 1677 } | 1685 } |
| 1678 Value* value = Bind(result); | 1686 Value* value = Bind(result); |
| 1679 result = new (Z) BooleanNegateInstr(value); | 1687 result = new (Z) BooleanNegateInstr(value); |
| 1680 } | 1688 } |
| 1681 ReturnDefinition(result); | 1689 ReturnDefinition(result); |
| 1682 return; | 1690 return; |
| 1683 } | 1691 } |
| 1684 | 1692 |
| 1685 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 1693 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 1686 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 1694 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 1687 | 1695 |
| 1688 ValueGraphVisitor for_left_value(owner()); | 1696 ValueGraphVisitor for_left_value(owner()); |
| 1689 node->left()->Visit(&for_left_value); | 1697 node->left()->Visit(&for_left_value); |
| 1690 Append(for_left_value); | 1698 Append(for_left_value); |
| 1691 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); | 1699 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); |
| 1692 arguments->Add(push_left); | 1700 arguments->Add(push_left); |
| 1693 | 1701 |
| 1694 ValueGraphVisitor for_right_value(owner()); | 1702 ValueGraphVisitor for_right_value(owner()); |
| 1695 node->right()->Visit(&for_right_value); | 1703 node->right()->Visit(&for_right_value); |
| 1696 Append(for_right_value); | 1704 Append(for_right_value); |
| 1697 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); | 1705 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); |
| 1698 arguments->Add(push_right); | 1706 arguments->Add(push_right); |
| 1699 | 1707 |
| 1700 ASSERT(Token::IsRelationalOperator(node->kind())); | 1708 ASSERT(Token::IsRelationalOperator(node->kind())); |
| 1709 const intptr_t kTypeArgsLen = 0; |
| 1701 InstanceCallInstr* comp = new (Z) InstanceCallInstr( | 1710 InstanceCallInstr* comp = new (Z) InstanceCallInstr( |
| 1702 node->token_pos(), Symbols::Token(node->kind()), node->kind(), arguments, | 1711 node->token_pos(), Symbols::Token(node->kind()), node->kind(), arguments, |
| 1703 Object::null_array(), 2, owner()->ic_data_array()); | 1712 kTypeArgsLen, Object::null_array(), 2, owner()->ic_data_array()); |
| 1704 ReturnDefinition(comp); | 1713 ReturnDefinition(comp); |
| 1705 } | 1714 } |
| 1706 | 1715 |
| 1707 | 1716 |
| 1708 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { | 1717 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { |
| 1709 // "!" cannot be overloaded, therefore do not call operator. | 1718 // "!" cannot be overloaded, therefore do not call operator. |
| 1710 if (node->kind() == Token::kNOT) { | 1719 if (node->kind() == Token::kNOT) { |
| 1711 ValueGraphVisitor for_value(owner()); | 1720 ValueGraphVisitor for_value(owner()); |
| 1712 node->operand()->Visit(&for_value); | 1721 node->operand()->Visit(&for_value); |
| 1713 Append(for_value); | 1722 Append(for_value); |
| 1714 Value* value = for_value.value(); | 1723 Value* value = for_value.value(); |
| 1715 Isolate* isolate = Isolate::Current(); | 1724 Isolate* isolate = Isolate::Current(); |
| 1716 if (isolate->type_checks() || isolate->asserts()) { | 1725 if (isolate->type_checks() || isolate->asserts()) { |
| 1717 value = | 1726 value = |
| 1718 Bind(new (Z) AssertBooleanInstr(node->operand()->token_pos(), value)); | 1727 Bind(new (Z) AssertBooleanInstr(node->operand()->token_pos(), value)); |
| 1719 } | 1728 } |
| 1720 BooleanNegateInstr* negate = new (Z) BooleanNegateInstr(value); | 1729 BooleanNegateInstr* negate = new (Z) BooleanNegateInstr(value); |
| 1721 ReturnDefinition(negate); | 1730 ReturnDefinition(negate); |
| 1722 return; | 1731 return; |
| 1723 } | 1732 } |
| 1724 | 1733 |
| 1725 ValueGraphVisitor for_value(owner()); | 1734 ValueGraphVisitor for_value(owner()); |
| 1726 node->operand()->Visit(&for_value); | 1735 node->operand()->Visit(&for_value); |
| 1727 Append(for_value); | 1736 Append(for_value); |
| 1728 PushArgumentInstr* push_value = PushArgument(for_value.value()); | 1737 PushArgumentInstr* push_value = PushArgument(for_value.value()); |
| 1729 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 1738 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 1730 new (Z) ZoneGrowableArray<PushArgumentInstr*>(1); | 1739 new (Z) ZoneGrowableArray<PushArgumentInstr*>(1); |
| 1731 arguments->Add(push_value); | 1740 arguments->Add(push_value); |
| 1741 const intptr_t kTypeArgsLen = 0; |
| 1732 InstanceCallInstr* call = new (Z) InstanceCallInstr( | 1742 InstanceCallInstr* call = new (Z) InstanceCallInstr( |
| 1733 node->token_pos(), Symbols::Token(node->kind()), node->kind(), arguments, | 1743 node->token_pos(), Symbols::Token(node->kind()), node->kind(), arguments, |
| 1734 Object::null_array(), 1, owner()->ic_data_array()); | 1744 kTypeArgsLen, Object::null_array(), 1, owner()->ic_data_array()); |
| 1735 ReturnDefinition(call); | 1745 ReturnDefinition(call); |
| 1736 } | 1746 } |
| 1737 | 1747 |
| 1738 | 1748 |
| 1739 void EffectGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { | 1749 void EffectGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { |
| 1740 TestGraphVisitor for_test(owner(), node->condition()->token_pos()); | 1750 TestGraphVisitor for_test(owner(), node->condition()->token_pos()); |
| 1741 node->condition()->Visit(&for_test); | 1751 node->condition()->Visit(&for_test); |
| 1742 | 1752 |
| 1743 // Translate the subexpressions for their effects. | 1753 // Translate the subexpressions for their effects. |
| 1744 EffectGraphVisitor for_true(owner()); | 1754 EffectGraphVisitor for_true(owner()); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2271 StringInterpolateNode* node) { | 2281 StringInterpolateNode* node) { |
| 2272 ValueGraphVisitor for_argument(owner()); | 2282 ValueGraphVisitor for_argument(owner()); |
| 2273 ArrayNode* arguments = node->value(); | 2283 ArrayNode* arguments = node->value(); |
| 2274 if (arguments->length() == 1) { | 2284 if (arguments->length() == 1) { |
| 2275 ZoneGrowableArray<PushArgumentInstr*>* values = | 2285 ZoneGrowableArray<PushArgumentInstr*>* values = |
| 2276 new (Z) ZoneGrowableArray<PushArgumentInstr*>(1); | 2286 new (Z) ZoneGrowableArray<PushArgumentInstr*>(1); |
| 2277 arguments->ElementAt(0)->Visit(&for_argument); | 2287 arguments->ElementAt(0)->Visit(&for_argument); |
| 2278 Append(for_argument); | 2288 Append(for_argument); |
| 2279 PushArgumentInstr* push_arg = PushArgument(for_argument.value()); | 2289 PushArgumentInstr* push_arg = PushArgument(for_argument.value()); |
| 2280 values->Add(push_arg); | 2290 values->Add(push_arg); |
| 2291 const int kTypeArgsLen = 0; |
| 2281 const int kNumberOfArguments = 1; | 2292 const int kNumberOfArguments = 1; |
| 2282 const Array& kNoArgumentNames = Object::null_array(); | 2293 const Array& kNoArgumentNames = Object::null_array(); |
| 2283 const Class& cls = | 2294 const Class& cls = |
| 2284 Class::Handle(Library::LookupCoreClass(Symbols::StringBase())); | 2295 Class::Handle(Library::LookupCoreClass(Symbols::StringBase())); |
| 2285 ASSERT(!cls.IsNull()); | 2296 ASSERT(!cls.IsNull()); |
| 2286 const Function& function = Function::ZoneHandle( | 2297 const Function& function = Function::ZoneHandle( |
| 2287 Z, Resolver::ResolveStatic( | 2298 Z, Resolver::ResolveStatic( |
| 2288 cls, Library::PrivateCoreLibName(Symbols::InterpolateSingle()), | 2299 cls, Library::PrivateCoreLibName(Symbols::InterpolateSingle()), |
| 2289 kNumberOfArguments, kNoArgumentNames)); | 2300 kTypeArgsLen, kNumberOfArguments, kNoArgumentNames)); |
| 2290 StaticCallInstr* call = | 2301 StaticCallInstr* call = new (Z) |
| 2291 new (Z) StaticCallInstr(node->token_pos(), function, kNoArgumentNames, | 2302 StaticCallInstr(node->token_pos(), function, kTypeArgsLen, |
| 2292 values, owner()->ic_data_array()); | 2303 kNoArgumentNames, values, owner()->ic_data_array()); |
| 2293 ReturnDefinition(call); | 2304 ReturnDefinition(call); |
| 2294 return; | 2305 return; |
| 2295 } | 2306 } |
| 2296 arguments->Visit(&for_argument); | 2307 arguments->Visit(&for_argument); |
| 2297 Append(for_argument); | 2308 Append(for_argument); |
| 2298 StringInterpolateInstr* instr = | 2309 StringInterpolateInstr* instr = |
| 2299 new (Z) StringInterpolateInstr(for_argument.value(), node->token_pos()); | 2310 new (Z) StringInterpolateInstr(for_argument.value(), node->token_pos()); |
| 2300 ReturnDefinition(instr); | 2311 ReturnDefinition(instr); |
| 2301 } | 2312 } |
| 2302 | 2313 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2413 Value* context = Bind(BuildCurrentContext(node->token_pos())); | 2424 Value* context = Bind(BuildCurrentContext(node->token_pos())); |
| 2414 Do(new (Z) StoreInstanceFieldInstr(Closure::context_offset(), | 2425 Do(new (Z) StoreInstanceFieldInstr(Closure::context_offset(), |
| 2415 closure_tmp_val, context, | 2426 closure_tmp_val, context, |
| 2416 kEmitStoreBarrier, node->token_pos())); | 2427 kEmitStoreBarrier, node->token_pos())); |
| 2417 } | 2428 } |
| 2418 ReturnDefinition(ExitTempLocalScope(closure_val)); | 2429 ReturnDefinition(ExitTempLocalScope(closure_val)); |
| 2419 } | 2430 } |
| 2420 } | 2431 } |
| 2421 | 2432 |
| 2422 | 2433 |
| 2434 void EffectGraphVisitor::BuildPushTypeArguments( |
| 2435 const ArgumentListNode& node, |
| 2436 ZoneGrowableArray<PushArgumentInstr*>* values) { |
| 2437 if (node.type_args_len() > 0) { |
| 2438 Value* type_args_val; |
| 2439 if (node.type_args_var() != NULL) { |
| 2440 type_args_val = |
| 2441 Bind(new (Z) LoadLocalInstr(*node.type_args_var(), node.token_pos())); |
| 2442 } else { |
| 2443 const TypeArguments& type_args = node.type_arguments(); |
| 2444 ASSERT(!type_args.IsNull() && |
| 2445 (type_args.Length() == node.type_args_len())); |
| 2446 type_args_val = |
| 2447 BuildInstantiatedTypeArguments(node.token_pos(), type_args); |
| 2448 } |
| 2449 PushArgumentInstr* push_type_args = PushArgument(type_args_val); |
| 2450 values->Add(push_type_args); |
| 2451 } |
| 2452 } |
| 2453 |
| 2454 |
| 2423 void EffectGraphVisitor::BuildPushArguments( | 2455 void EffectGraphVisitor::BuildPushArguments( |
| 2424 const ArgumentListNode& node, | 2456 const ArgumentListNode& node, |
| 2425 ZoneGrowableArray<PushArgumentInstr*>* values) { | 2457 ZoneGrowableArray<PushArgumentInstr*>* values) { |
| 2426 for (intptr_t i = 0; i < node.length(); ++i) { | 2458 for (intptr_t i = 0; i < node.length(); ++i) { |
| 2427 ValueGraphVisitor for_argument(owner()); | 2459 ValueGraphVisitor for_argument(owner()); |
| 2428 node.NodeAt(i)->Visit(&for_argument); | 2460 node.NodeAt(i)->Visit(&for_argument); |
| 2429 Append(for_argument); | 2461 Append(for_argument); |
| 2430 PushArgumentInstr* push_arg = PushArgument(for_argument.value()); | 2462 PushArgumentInstr* push_arg = PushArgument(for_argument.value()); |
| 2431 values->Add(push_arg); | 2463 values->Add(push_arg); |
| 2432 } | 2464 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 Do(BuildStoreExprTemp(for_receiver.value(), node->token_pos())); | 2502 Do(BuildStoreExprTemp(for_receiver.value(), node->token_pos())); |
| 2471 BuildInstanceCallConditional(node); | 2503 BuildInstanceCallConditional(node); |
| 2472 ReturnDefinition(BuildLoadExprTemp(node->token_pos())); | 2504 ReturnDefinition(BuildLoadExprTemp(node->token_pos())); |
| 2473 } else { | 2505 } else { |
| 2474 EffectGraphVisitor::VisitInstanceCallNode(node); | 2506 EffectGraphVisitor::VisitInstanceCallNode(node); |
| 2475 } | 2507 } |
| 2476 } | 2508 } |
| 2477 | 2509 |
| 2478 | 2510 |
| 2479 void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { | 2511 void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { |
| 2480 ValueGraphVisitor for_receiver(owner()); | |
| 2481 node->receiver()->Visit(&for_receiver); | |
| 2482 Append(for_receiver); | |
| 2483 if (node->is_conditional()) { | 2512 if (node->is_conditional()) { |
| 2513 ValueGraphVisitor for_receiver(owner()); |
| 2514 node->receiver()->Visit(&for_receiver); |
| 2515 Append(for_receiver); |
| 2484 Do(BuildStoreExprTemp(for_receiver.value(), node->token_pos())); | 2516 Do(BuildStoreExprTemp(for_receiver.value(), node->token_pos())); |
| 2485 BuildInstanceCallConditional(node); | 2517 BuildInstanceCallConditional(node); |
| 2486 } else { | 2518 } else { |
| 2519 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2520 new (Z) ZoneGrowableArray<PushArgumentInstr*>( |
| 2521 (node->arguments()->type_args_len() > 0 ? 2 : 1) + |
| 2522 node->arguments()->length()); |
| 2523 BuildPushTypeArguments(*node->arguments(), arguments); |
| 2524 ValueGraphVisitor for_receiver(owner()); |
| 2525 node->receiver()->Visit(&for_receiver); |
| 2526 Append(for_receiver); |
| 2487 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); | 2527 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); |
| 2488 ZoneGrowableArray<PushArgumentInstr*>* arguments = new (Z) | |
| 2489 ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length() + 1); | |
| 2490 arguments->Add(push_receiver); | 2528 arguments->Add(push_receiver); |
| 2491 | |
| 2492 BuildPushArguments(*node->arguments(), arguments); | 2529 BuildPushArguments(*node->arguments(), arguments); |
| 2493 InstanceCallInstr* call = new (Z) InstanceCallInstr( | 2530 InstanceCallInstr* call = new (Z) InstanceCallInstr( |
| 2494 node->token_pos(), node->function_name(), Token::kILLEGAL, arguments, | 2531 node->token_pos(), node->function_name(), Token::kILLEGAL, arguments, |
| 2495 node->arguments()->names(), 1, owner()->ic_data_array()); | 2532 node->arguments()->type_args_len(), node->arguments()->names(), 1, |
| 2533 owner()->ic_data_array()); |
| 2496 ReturnDefinition(call); | 2534 ReturnDefinition(call); |
| 2497 } | 2535 } |
| 2498 } | 2536 } |
| 2499 | 2537 |
| 2500 | 2538 |
| 2501 // <Expression> ::= StaticCall { function: Function | 2539 // <Expression> ::= StaticCall { function: Function |
| 2502 // arguments: <ArgumentList> } | 2540 // arguments: <ArgumentList> } |
| 2503 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | 2541 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { |
| 2504 ZoneGrowableArray<PushArgumentInstr*>* arguments = new (Z) | 2542 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2505 ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); | 2543 new (Z) ZoneGrowableArray<PushArgumentInstr*>( |
| 2544 (node->arguments()->type_args_len() > 0 ? 1 : 0) + |
| 2545 node->arguments()->length()); |
| 2546 BuildPushTypeArguments(*node->arguments(), arguments); |
| 2506 BuildPushArguments(*node->arguments(), arguments); | 2547 BuildPushArguments(*node->arguments(), arguments); |
| 2507 StaticCallInstr* call = new (Z) StaticCallInstr( | 2548 StaticCallInstr* call = new (Z) StaticCallInstr( |
| 2508 node->token_pos(), node->function(), node->arguments()->names(), | 2549 node->token_pos(), node->function(), node->arguments()->type_args_len(), |
| 2509 arguments, owner()->ic_data_array()); | 2550 node->arguments()->names(), arguments, owner()->ic_data_array()); |
| 2510 if (node->function().recognized_kind() != MethodRecognizer::kUnknown) { | 2551 if (node->function().recognized_kind() != MethodRecognizer::kUnknown) { |
| 2511 call->set_result_cid(MethodRecognizer::ResultCid(node->function())); | 2552 call->set_result_cid(MethodRecognizer::ResultCid(node->function())); |
| 2512 } | 2553 } |
| 2513 ReturnDefinition(call); | 2554 ReturnDefinition(call); |
| 2514 } | 2555 } |
| 2515 | 2556 |
| 2516 | 2557 |
| 2517 void EffectGraphVisitor::BuildClosureCall(ClosureCallNode* node, | 2558 void EffectGraphVisitor::BuildClosureCall(ClosureCallNode* node, |
| 2518 bool result_needed) { | 2559 bool result_needed) { |
| 2560 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2561 new (Z) ZoneGrowableArray<PushArgumentInstr*>( |
| 2562 (node->arguments()->type_args_len() > 0 ? 1 : 0) + |
| 2563 node->arguments()->length()); |
| 2564 BuildPushTypeArguments(*node->arguments(), arguments); |
| 2565 |
| 2519 ValueGraphVisitor for_closure(owner()); | 2566 ValueGraphVisitor for_closure(owner()); |
| 2520 node->closure()->Visit(&for_closure); | 2567 node->closure()->Visit(&for_closure); |
| 2521 Append(for_closure); | 2568 Append(for_closure); |
| 2522 | |
| 2523 Value* closure_value = for_closure.value(); | 2569 Value* closure_value = for_closure.value(); |
| 2524 LocalVariable* tmp_var = EnterTempLocalScope(closure_value); | 2570 LocalVariable* tmp_var = EnterTempLocalScope(closure_value); |
| 2525 | 2571 |
| 2526 ZoneGrowableArray<PushArgumentInstr*>* arguments = new (Z) | |
| 2527 ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); | |
| 2528 Value* closure_val = | 2572 Value* closure_val = |
| 2529 Bind(new (Z) LoadLocalInstr(*tmp_var, node->token_pos())); | 2573 Bind(new (Z) LoadLocalInstr(*tmp_var, node->token_pos())); |
| 2530 PushArgumentInstr* push_closure = PushArgument(closure_val); | 2574 PushArgumentInstr* push_closure = PushArgument(closure_val); |
| 2531 arguments->Add(push_closure); | 2575 arguments->Add(push_closure); |
| 2532 BuildPushArguments(*node->arguments(), arguments); | 2576 BuildPushArguments(*node->arguments(), arguments); |
| 2533 | 2577 |
| 2534 closure_val = Bind(new (Z) LoadLocalInstr(*tmp_var, node->token_pos())); | 2578 closure_val = Bind(new (Z) LoadLocalInstr(*tmp_var, node->token_pos())); |
| 2535 LoadFieldInstr* function_load = new (Z) LoadFieldInstr( | 2579 LoadFieldInstr* function_load = new (Z) LoadFieldInstr( |
| 2536 closure_val, Closure::function_offset(), | 2580 closure_val, Closure::function_offset(), |
| 2537 AbstractType::ZoneHandle(Z, AbstractType::null()), node->token_pos()); | 2581 AbstractType::ZoneHandle(Z, AbstractType::null()), node->token_pos()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2595 | 2639 |
| 2596 | 2640 |
| 2597 void EffectGraphVisitor::BuildConstructorCall( | 2641 void EffectGraphVisitor::BuildConstructorCall( |
| 2598 ConstructorCallNode* node, | 2642 ConstructorCallNode* node, |
| 2599 PushArgumentInstr* push_alloc_value) { | 2643 PushArgumentInstr* push_alloc_value) { |
| 2600 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 2644 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2601 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 2645 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 2602 arguments->Add(push_alloc_value); | 2646 arguments->Add(push_alloc_value); |
| 2603 | 2647 |
| 2604 BuildPushArguments(*node->arguments(), arguments); | 2648 BuildPushArguments(*node->arguments(), arguments); |
| 2649 const intptr_t kTypeArgsLen = 0; |
| 2605 Do(new (Z) StaticCallInstr(node->token_pos(), node->constructor(), | 2650 Do(new (Z) StaticCallInstr(node->token_pos(), node->constructor(), |
| 2606 node->arguments()->names(), arguments, | 2651 kTypeArgsLen, node->arguments()->names(), |
| 2607 owner()->ic_data_array())); | 2652 arguments, owner()->ic_data_array())); |
| 2608 } | 2653 } |
| 2609 | 2654 |
| 2610 | 2655 |
| 2611 static intptr_t GetResultCidOfListFactory(ConstructorCallNode* node) { | 2656 static intptr_t GetResultCidOfListFactory(ConstructorCallNode* node) { |
| 2612 const Function& function = node->constructor(); | 2657 const Function& function = node->constructor(); |
| 2613 const Class& function_class = Class::Handle(function.Owner()); | 2658 const Class& function_class = Class::Handle(function.Owner()); |
| 2614 | 2659 |
| 2615 if ((function_class.library() != Library::CoreLibrary()) && | 2660 if ((function_class.library() != Library::CoreLibrary()) && |
| 2616 (function_class.library() != Library::TypedDataLibrary())) { | 2661 (function_class.library() != Library::TypedDataLibrary())) { |
| 2617 return kDynamicCid; | 2662 return kDynamicCid; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2635 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { | 2680 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { |
| 2636 if (node->constructor().IsFactory()) { | 2681 if (node->constructor().IsFactory()) { |
| 2637 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 2682 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2638 new (Z) ZoneGrowableArray<PushArgumentInstr*>(); | 2683 new (Z) ZoneGrowableArray<PushArgumentInstr*>(); |
| 2639 PushArgumentInstr* push_type_arguments = | 2684 PushArgumentInstr* push_type_arguments = |
| 2640 PushArgument(BuildInstantiatedTypeArguments(node->token_pos(), | 2685 PushArgument(BuildInstantiatedTypeArguments(node->token_pos(), |
| 2641 node->type_arguments())); | 2686 node->type_arguments())); |
| 2642 arguments->Add(push_type_arguments); | 2687 arguments->Add(push_type_arguments); |
| 2643 ASSERT(arguments->length() == 1); | 2688 ASSERT(arguments->length() == 1); |
| 2644 BuildPushArguments(*node->arguments(), arguments); | 2689 BuildPushArguments(*node->arguments(), arguments); |
| 2690 const int kTypeArgsLen = 0; |
| 2645 StaticCallInstr* call = new (Z) StaticCallInstr( | 2691 StaticCallInstr* call = new (Z) StaticCallInstr( |
| 2646 node->token_pos(), node->constructor(), node->arguments()->names(), | 2692 node->token_pos(), node->constructor(), kTypeArgsLen, |
| 2647 arguments, owner()->ic_data_array()); | 2693 node->arguments()->names(), arguments, owner()->ic_data_array()); |
| 2648 const intptr_t result_cid = GetResultCidOfListFactory(node); | 2694 const intptr_t result_cid = GetResultCidOfListFactory(node); |
| 2649 if (result_cid != kDynamicCid) { | 2695 if (result_cid != kDynamicCid) { |
| 2650 call->set_result_cid(result_cid); | 2696 call->set_result_cid(result_cid); |
| 2651 call->set_is_known_list_constructor(true); | 2697 call->set_is_known_list_constructor(true); |
| 2652 // Recognized fixed length array factory must have two arguments: | 2698 // Recognized fixed length array factory must have two arguments: |
| 2653 // (0) type-arguments, (1) length. | 2699 // (0) type-arguments, (1) length. |
| 2654 ASSERT(!LoadFieldInstr::IsFixedLengthArrayCid(result_cid) || | 2700 ASSERT(!LoadFieldInstr::IsFixedLengthArrayCid(result_cid) || |
| 2655 arguments->length() == 2); | 2701 arguments->length() == 2); |
| 2656 } else if (node->constructor().recognized_kind() != | 2702 } else if (node->constructor().recognized_kind() != |
| 2657 MethodRecognizer::kUnknown) { | 2703 MethodRecognizer::kUnknown) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2867 if (node->is_conditional()) { | 2913 if (node->is_conditional()) { |
| 2868 Do(BuildStoreExprTemp(for_receiver.value(), node->token_pos())); | 2914 Do(BuildStoreExprTemp(for_receiver.value(), node->token_pos())); |
| 2869 BuildInstanceGetterConditional(node); | 2915 BuildInstanceGetterConditional(node); |
| 2870 } else { | 2916 } else { |
| 2871 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); | 2917 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); |
| 2872 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 2918 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2873 new (Z) ZoneGrowableArray<PushArgumentInstr*>(1); | 2919 new (Z) ZoneGrowableArray<PushArgumentInstr*>(1); |
| 2874 arguments->Add(push_receiver); | 2920 arguments->Add(push_receiver); |
| 2875 const String& name = | 2921 const String& name = |
| 2876 String::ZoneHandle(Z, Field::GetterSymbol(node->field_name())); | 2922 String::ZoneHandle(Z, Field::GetterSymbol(node->field_name())); |
| 2877 InstanceCallInstr* call = new (Z) | 2923 const intptr_t kTypeArgsLen = 0; |
| 2878 InstanceCallInstr(node->token_pos(), name, Token::kGET, arguments, | 2924 InstanceCallInstr* call = new (Z) InstanceCallInstr( |
| 2879 Object::null_array(), 1, owner()->ic_data_array()); | 2925 node->token_pos(), name, Token::kGET, arguments, kTypeArgsLen, |
| 2926 Object::null_array(), 1, owner()->ic_data_array()); |
| 2880 ReturnDefinition(call); | 2927 ReturnDefinition(call); |
| 2881 } | 2928 } |
| 2882 } | 2929 } |
| 2883 | 2930 |
| 2884 | 2931 |
| 2885 void EffectGraphVisitor::BuildInstanceSetterArguments( | 2932 void EffectGraphVisitor::BuildInstanceSetterArguments( |
| 2886 InstanceSetterNode* node, | 2933 InstanceSetterNode* node, |
| 2887 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2934 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 2888 bool result_is_needed) { | 2935 bool result_is_needed) { |
| 2889 ValueGraphVisitor for_receiver(owner()); | 2936 ValueGraphVisitor for_receiver(owner()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2929 token_pos, load_temp, node->field_name(), node->value()); | 2976 token_pos, load_temp, node->field_name(), node->value()); |
| 2930 setter->Visit(&for_false); | 2977 setter->Visit(&for_false); |
| 2931 Join(for_test, for_true, for_false); | 2978 Join(for_test, for_true, for_false); |
| 2932 return; | 2979 return; |
| 2933 } | 2980 } |
| 2934 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 2981 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2935 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 2982 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 2936 BuildInstanceSetterArguments(node, arguments, kResultNotNeeded); | 2983 BuildInstanceSetterArguments(node, arguments, kResultNotNeeded); |
| 2937 const String& name = | 2984 const String& name = |
| 2938 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); | 2985 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); |
| 2986 const int kTypeArgsLen = 0; |
| 2939 const intptr_t kNumArgsChecked = 1; // Do not check value type. | 2987 const intptr_t kNumArgsChecked = 1; // Do not check value type. |
| 2940 InstanceCallInstr* call = new (Z) InstanceCallInstr( | 2988 InstanceCallInstr* call = new (Z) InstanceCallInstr( |
| 2941 token_pos, name, Token::kSET, arguments, Object::null_array(), | 2989 token_pos, name, Token::kSET, arguments, kTypeArgsLen, |
| 2942 kNumArgsChecked, owner()->ic_data_array()); | 2990 Object::null_array(), kNumArgsChecked, owner()->ic_data_array()); |
| 2943 ReturnDefinition(call); | 2991 ReturnDefinition(call); |
| 2944 } | 2992 } |
| 2945 | 2993 |
| 2946 | 2994 |
| 2947 void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { | 2995 void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { |
| 2948 const TokenPosition token_pos = node->token_pos(); | 2996 const TokenPosition token_pos = node->token_pos(); |
| 2949 if (node->is_conditional()) { | 2997 if (node->is_conditional()) { |
| 2950 ValueGraphVisitor for_receiver(owner()); | 2998 ValueGraphVisitor for_receiver(owner()); |
| 2951 node->receiver()->Visit(&for_receiver); | 2999 node->receiver()->Visit(&for_receiver); |
| 2952 Append(for_receiver); | 3000 Append(for_receiver); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2973 | 3021 |
| 2974 Join(for_test, for_true, for_false); | 3022 Join(for_test, for_true, for_false); |
| 2975 ReturnDefinition(BuildLoadExprTemp(token_pos)); | 3023 ReturnDefinition(BuildLoadExprTemp(token_pos)); |
| 2976 return; | 3024 return; |
| 2977 } | 3025 } |
| 2978 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 3026 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2979 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 3027 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 2980 BuildInstanceSetterArguments(node, arguments, kResultNeeded); | 3028 BuildInstanceSetterArguments(node, arguments, kResultNeeded); |
| 2981 const String& name = | 3029 const String& name = |
| 2982 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); | 3030 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); |
| 3031 const intptr_t kTypeArgsLen = 0; |
| 2983 const intptr_t kNumArgsChecked = 1; // Do not check value type. | 3032 const intptr_t kNumArgsChecked = 1; // Do not check value type. |
| 2984 Do(new (Z) InstanceCallInstr(token_pos, name, Token::kSET, arguments, | 3033 Do(new (Z) InstanceCallInstr(token_pos, name, Token::kSET, arguments, |
| 2985 Object::null_array(), kNumArgsChecked, | 3034 kTypeArgsLen, Object::null_array(), |
| 2986 owner()->ic_data_array())); | 3035 kNumArgsChecked, owner()->ic_data_array())); |
| 2987 ReturnDefinition(BuildLoadExprTemp(token_pos)); | 3036 ReturnDefinition(BuildLoadExprTemp(token_pos)); |
| 2988 } | 3037 } |
| 2989 | 3038 |
| 2990 | 3039 |
| 2991 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { | 3040 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { |
| 2992 const String& getter_name = | 3041 const String& getter_name = |
| 2993 String::ZoneHandle(Z, Field::GetterSymbol(node->field_name())); | 3042 String::ZoneHandle(Z, Field::GetterSymbol(node->field_name())); |
| 2994 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 3043 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2995 new (Z) ZoneGrowableArray<PushArgumentInstr*>(); | 3044 new (Z) ZoneGrowableArray<PushArgumentInstr*>(); |
| 2996 Function& getter_function = Function::ZoneHandle(Z, Function::null()); | 3045 Function& getter_function = Function::ZoneHandle(Z, Function::null()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3038 NULL, // No Arguments to getter. | 3087 NULL, // No Arguments to getter. |
| 3039 InvocationMirror::EncodeType(node->cls().IsTopLevel() | 3088 InvocationMirror::EncodeType(node->cls().IsTopLevel() |
| 3040 ? InvocationMirror::kTopLevel | 3089 ? InvocationMirror::kTopLevel |
| 3041 : InvocationMirror::kStatic, | 3090 : InvocationMirror::kStatic, |
| 3042 InvocationMirror::kGetter)); | 3091 InvocationMirror::kGetter)); |
| 3043 ReturnDefinition(call); | 3092 ReturnDefinition(call); |
| 3044 return; | 3093 return; |
| 3045 } | 3094 } |
| 3046 } | 3095 } |
| 3047 ASSERT(!getter_function.IsNull()); | 3096 ASSERT(!getter_function.IsNull()); |
| 3097 const intptr_t kTypeArgsLen = 0; |
| 3048 StaticCallInstr* call = | 3098 StaticCallInstr* call = |
| 3049 new (Z) StaticCallInstr(node->token_pos(), getter_function, | 3099 new (Z) StaticCallInstr(node->token_pos(), getter_function, kTypeArgsLen, |
| 3050 Object::null_array(), // No names | 3100 Object::null_array(), // No names |
| 3051 arguments, owner()->ic_data_array()); | 3101 arguments, owner()->ic_data_array()); |
| 3052 ReturnDefinition(call); | 3102 ReturnDefinition(call); |
| 3053 } | 3103 } |
| 3054 | 3104 |
| 3055 | 3105 |
| 3056 void EffectGraphVisitor::BuildStaticSetter(StaticSetterNode* node, | 3106 void EffectGraphVisitor::BuildStaticSetter(StaticSetterNode* node, |
| 3057 bool result_is_needed) { | 3107 bool result_is_needed) { |
| 3058 const String& setter_name = | 3108 const String& setter_name = |
| 3059 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); | 3109 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3100 ValueGraphVisitor for_value(owner()); | 3150 ValueGraphVisitor for_value(owner()); |
| 3101 node->value()->Visit(&for_value); | 3151 node->value()->Visit(&for_value); |
| 3102 Append(for_value); | 3152 Append(for_value); |
| 3103 Value* value = NULL; | 3153 Value* value = NULL; |
| 3104 if (result_is_needed) { | 3154 if (result_is_needed) { |
| 3105 value = Bind(BuildStoreExprTemp(for_value.value(), token_pos)); | 3155 value = Bind(BuildStoreExprTemp(for_value.value(), token_pos)); |
| 3106 } else { | 3156 } else { |
| 3107 value = for_value.value(); | 3157 value = for_value.value(); |
| 3108 } | 3158 } |
| 3109 arguments->Add(PushArgument(value)); | 3159 arguments->Add(PushArgument(value)); |
| 3110 | 3160 const intptr_t kTypeArgsLen = 0; |
| 3111 call = new (Z) StaticCallInstr(token_pos, setter_function, | 3161 call = new (Z) StaticCallInstr(token_pos, setter_function, kTypeArgsLen, |
| 3112 Object::null_array(), // No names. | 3162 Object::null_array(), // No names. |
| 3113 arguments, owner()->ic_data_array()); | 3163 arguments, owner()->ic_data_array()); |
| 3114 } | 3164 } |
| 3115 if (result_is_needed) { | 3165 if (result_is_needed) { |
| 3116 Do(call); | 3166 Do(call); |
| 3117 ReturnDefinition(BuildLoadExprTemp(token_pos)); | 3167 ReturnDefinition(BuildLoadExprTemp(token_pos)); |
| 3118 } else { | 3168 } else { |
| 3119 ReturnDefinition(call); | 3169 ReturnDefinition(call); |
| 3120 } | 3170 } |
| 3121 } | 3171 } |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3547 ValueGraphVisitor for_array(owner()); | 3597 ValueGraphVisitor for_array(owner()); |
| 3548 node->array()->Visit(&for_array); | 3598 node->array()->Visit(&for_array); |
| 3549 Append(for_array); | 3599 Append(for_array); |
| 3550 arguments->Add(PushArgument(for_array.value())); | 3600 arguments->Add(PushArgument(for_array.value())); |
| 3551 | 3601 |
| 3552 ValueGraphVisitor for_index(owner()); | 3602 ValueGraphVisitor for_index(owner()); |
| 3553 node->index_expr()->Visit(&for_index); | 3603 node->index_expr()->Visit(&for_index); |
| 3554 Append(for_index); | 3604 Append(for_index); |
| 3555 arguments->Add(PushArgument(for_index.value())); | 3605 arguments->Add(PushArgument(for_index.value())); |
| 3556 | 3606 |
| 3607 const intptr_t kTypeArgsLen = 0; |
| 3557 if (super_function != NULL) { | 3608 if (super_function != NULL) { |
| 3558 // Generate static call to super operator. | 3609 // Generate static call to super operator. |
| 3559 StaticCallInstr* load = new (Z) StaticCallInstr( | 3610 StaticCallInstr* load = new (Z) StaticCallInstr( |
| 3560 node->token_pos(), *super_function, Object::null_array(), arguments, | 3611 node->token_pos(), *super_function, kTypeArgsLen, Object::null_array(), |
| 3561 owner()->ic_data_array()); | 3612 arguments, owner()->ic_data_array()); |
| 3562 ReturnDefinition(load); | 3613 ReturnDefinition(load); |
| 3563 } else { | 3614 } else { |
| 3564 // Generate dynamic call to index operator. | 3615 // Generate dynamic call to index operator. |
| 3565 const intptr_t checked_argument_count = 1; | 3616 const intptr_t checked_argument_count = 1; |
| 3566 InstanceCallInstr* load = new (Z) InstanceCallInstr( | 3617 InstanceCallInstr* load = new (Z) InstanceCallInstr( |
| 3567 node->token_pos(), Symbols::IndexToken(), Token::kINDEX, arguments, | 3618 node->token_pos(), Symbols::IndexToken(), Token::kINDEX, arguments, |
| 3568 Object::null_array(), checked_argument_count, owner()->ic_data_array()); | 3619 kTypeArgsLen, Object::null_array(), checked_argument_count, |
| 3620 owner()->ic_data_array()); |
| 3569 ReturnDefinition(load); | 3621 ReturnDefinition(load); |
| 3570 } | 3622 } |
| 3571 } | 3623 } |
| 3572 | 3624 |
| 3573 | 3625 |
| 3574 Definition* EffectGraphVisitor::BuildStoreIndexedValues(StoreIndexedNode* node, | 3626 Definition* EffectGraphVisitor::BuildStoreIndexedValues(StoreIndexedNode* node, |
| 3575 bool result_is_needed) { | 3627 bool result_is_needed) { |
| 3576 Function* super_function = NULL; | 3628 Function* super_function = NULL; |
| 3577 const TokenPosition token_pos = node->token_pos(); | 3629 const TokenPosition token_pos = node->token_pos(); |
| 3578 if (node->IsSuperStore()) { | 3630 if (node->IsSuperStore()) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3618 node->value()->Visit(&for_value); | 3670 node->value()->Visit(&for_value); |
| 3619 Append(for_value); | 3671 Append(for_value); |
| 3620 Value* value = NULL; | 3672 Value* value = NULL; |
| 3621 if (result_is_needed) { | 3673 if (result_is_needed) { |
| 3622 value = Bind(BuildStoreExprTemp(for_value.value(), token_pos)); | 3674 value = Bind(BuildStoreExprTemp(for_value.value(), token_pos)); |
| 3623 } else { | 3675 } else { |
| 3624 value = for_value.value(); | 3676 value = for_value.value(); |
| 3625 } | 3677 } |
| 3626 arguments->Add(PushArgument(value)); | 3678 arguments->Add(PushArgument(value)); |
| 3627 | 3679 |
| 3680 const intptr_t kTypeArgsLen = 0; |
| 3628 if (super_function != NULL) { | 3681 if (super_function != NULL) { |
| 3629 // Generate static call to super operator []=. | 3682 // Generate static call to super operator []=. |
| 3630 | 3683 |
| 3631 StaticCallInstr* store = new (Z) | 3684 StaticCallInstr* store = new (Z) StaticCallInstr( |
| 3632 StaticCallInstr(token_pos, *super_function, Object::null_array(), | 3685 token_pos, *super_function, kTypeArgsLen, Object::null_array(), |
| 3633 arguments, owner()->ic_data_array()); | 3686 arguments, owner()->ic_data_array()); |
| 3634 if (result_is_needed) { | 3687 if (result_is_needed) { |
| 3635 Do(store); | 3688 Do(store); |
| 3636 return BuildLoadExprTemp(token_pos); | 3689 return BuildLoadExprTemp(token_pos); |
| 3637 } else { | 3690 } else { |
| 3638 return store; | 3691 return store; |
| 3639 } | 3692 } |
| 3640 } else { | 3693 } else { |
| 3641 // Generate dynamic call to operator []=. | 3694 // Generate dynamic call to operator []=. |
| 3642 const intptr_t checked_argument_count = 2; // Do not check for value type. | 3695 const intptr_t checked_argument_count = 2; // Do not check for value type. |
| 3643 InstanceCallInstr* store = new (Z) InstanceCallInstr( | 3696 InstanceCallInstr* store = new (Z) InstanceCallInstr( |
| 3644 token_pos, Symbols::AssignIndexToken(), Token::kASSIGN_INDEX, arguments, | 3697 token_pos, Symbols::AssignIndexToken(), Token::kASSIGN_INDEX, arguments, |
| 3645 Object::null_array(), checked_argument_count, owner()->ic_data_array()); | 3698 kTypeArgsLen, Object::null_array(), checked_argument_count, |
| 3699 owner()->ic_data_array()); |
| 3646 if (result_is_needed) { | 3700 if (result_is_needed) { |
| 3647 Do(store); | 3701 Do(store); |
| 3648 return BuildLoadExprTemp(token_pos); | 3702 return BuildLoadExprTemp(token_pos); |
| 3649 } else { | 3703 } else { |
| 3650 return store; | 3704 return store; |
| 3651 } | 3705 } |
| 3652 } | 3706 } |
| 3653 } | 3707 } |
| 3654 | 3708 |
| 3655 | 3709 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3805 *async_stack_trace_var, node->token_pos().ToSynthetic())); | 3859 *async_stack_trace_var, node->token_pos().ToSynthetic())); |
| 3806 // Setup arguments for _asyncSetThreadStackTrace. | 3860 // Setup arguments for _asyncSetThreadStackTrace. |
| 3807 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 3861 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 3808 new (Z) ZoneGrowableArray<PushArgumentInstr*>(1); | 3862 new (Z) ZoneGrowableArray<PushArgumentInstr*>(1); |
| 3809 arguments->Add(PushArgument(async_stack_trace_value)); | 3863 arguments->Add(PushArgument(async_stack_trace_value)); |
| 3810 | 3864 |
| 3811 const Function& async_set_thread_stack_trace = Function::ZoneHandle( | 3865 const Function& async_set_thread_stack_trace = Function::ZoneHandle( |
| 3812 Z, isolate()->object_store()->async_set_thread_stack_trace()); | 3866 Z, isolate()->object_store()->async_set_thread_stack_trace()); |
| 3813 ASSERT(!async_set_thread_stack_trace.IsNull()); | 3867 ASSERT(!async_set_thread_stack_trace.IsNull()); |
| 3814 // Call _asyncSetThreadStackTrace | 3868 // Call _asyncSetThreadStackTrace |
| 3815 StaticCallInstr* call_async_set_thread_stack_trace = new (Z) | 3869 const intptr_t kTypeArgsLen = 0; |
| 3816 StaticCallInstr(node->token_pos().ToSynthetic(), | 3870 StaticCallInstr* call_async_set_thread_stack_trace = |
| 3817 async_set_thread_stack_trace, Object::null_array(), | 3871 new (Z) StaticCallInstr(node->token_pos().ToSynthetic(), |
| 3818 arguments, owner()->ic_data_array()); | 3872 async_set_thread_stack_trace, kTypeArgsLen, |
| 3873 Object::null_array(), arguments, |
| 3874 owner()->ic_data_array()); |
| 3819 Do(call_async_set_thread_stack_trace); | 3875 Do(call_async_set_thread_stack_trace); |
| 3820 } | 3876 } |
| 3821 | 3877 |
| 3822 | 3878 |
| 3823 if (FLAG_support_debugger && is_top_level_sequence && | 3879 if (FLAG_support_debugger && is_top_level_sequence && |
| 3824 function.is_debuggable()) { | 3880 function.is_debuggable()) { |
| 3825 // Place a debug check at method entry to ensure breaking on a method always | 3881 // Place a debug check at method entry to ensure breaking on a method always |
| 3826 // happens, even if there are no assignments/calls/runtimecalls in the first | 3882 // happens, even if there are no assignments/calls/runtimecalls in the first |
| 3827 // basic block. Place this check at the last parameter to ensure parameters | 3883 // basic block. Place this check at the last parameter to ensure parameters |
| 3828 // are in scope in the debugger at method entry. | 3884 // are in scope in the debugger at method entry. |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4142 bool is_super_invocation) { | 4198 bool is_super_invocation) { |
| 4143 TokenPosition args_pos = method_arguments->token_pos(); | 4199 TokenPosition args_pos = method_arguments->token_pos(); |
| 4144 LocalVariable* temp = NULL; | 4200 LocalVariable* temp = NULL; |
| 4145 if (save_last_arg) { | 4201 if (save_last_arg) { |
| 4146 temp = owner()->parsed_function().expression_temp_var(); | 4202 temp = owner()->parsed_function().expression_temp_var(); |
| 4147 } | 4203 } |
| 4148 ArgumentListNode* args = Parser::BuildNoSuchMethodArguments( | 4204 ArgumentListNode* args = Parser::BuildNoSuchMethodArguments( |
| 4149 args_pos, method_name, *method_arguments, temp, is_super_invocation); | 4205 args_pos, method_name, *method_arguments, temp, is_super_invocation); |
| 4150 // Make sure we resolve to a compatible noSuchMethod, otherwise call | 4206 // Make sure we resolve to a compatible noSuchMethod, otherwise call |
| 4151 // noSuchMethod of class Object. | 4207 // noSuchMethod of class Object. |
| 4208 const int kTypeArgsLen = 0; |
| 4152 const int kNumArguments = 2; | 4209 const int kNumArguments = 2; |
| 4153 ArgumentsDescriptor args_desc( | 4210 ArgumentsDescriptor args_desc(Array::ZoneHandle( |
| 4154 Array::ZoneHandle(Z, ArgumentsDescriptor::New(kNumArguments))); | 4211 Z, ArgumentsDescriptor::New(kTypeArgsLen, kNumArguments))); |
| 4155 Function& no_such_method_func = Function::ZoneHandle( | 4212 Function& no_such_method_func = Function::ZoneHandle( |
| 4156 Z, Resolver::ResolveDynamicForReceiverClass( | 4213 Z, Resolver::ResolveDynamicForReceiverClass( |
| 4157 target_class, Symbols::NoSuchMethod(), args_desc)); | 4214 target_class, Symbols::NoSuchMethod(), args_desc)); |
| 4158 if (no_such_method_func.IsNull()) { | 4215 if (no_such_method_func.IsNull()) { |
| 4159 const Class& object_class = | 4216 const Class& object_class = |
| 4160 Class::ZoneHandle(Z, isolate()->object_store()->object_class()); | 4217 Class::ZoneHandle(Z, isolate()->object_store()->object_class()); |
| 4161 no_such_method_func = Resolver::ResolveDynamicForReceiverClass( | 4218 no_such_method_func = Resolver::ResolveDynamicForReceiverClass( |
| 4162 object_class, Symbols::NoSuchMethod(), args_desc); | 4219 object_class, Symbols::NoSuchMethod(), args_desc); |
| 4163 } | 4220 } |
| 4164 // We are guaranteed to find noSuchMethod of class Object. | 4221 // We are guaranteed to find noSuchMethod of class Object. |
| 4165 ASSERT(!no_such_method_func.IsNull()); | 4222 ASSERT(!no_such_method_func.IsNull()); |
| 4166 ZoneGrowableArray<PushArgumentInstr*>* push_arguments = | 4223 ZoneGrowableArray<PushArgumentInstr*>* push_arguments = |
| 4167 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 4224 new (Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 4168 BuildPushArguments(*args, push_arguments); | 4225 BuildPushArguments(*args, push_arguments); |
| 4169 return new (Z) | 4226 return new (Z) StaticCallInstr(args_pos, no_such_method_func, kTypeArgsLen, |
| 4170 StaticCallInstr(args_pos, no_such_method_func, Object::null_array(), | 4227 Object::null_array(), push_arguments, |
| 4171 push_arguments, owner()->ic_data_array()); | 4228 owner()->ic_data_array()); |
| 4172 } | 4229 } |
| 4173 | 4230 |
| 4174 | 4231 |
| 4175 StaticCallInstr* EffectGraphVisitor::BuildThrowNoSuchMethodError( | 4232 StaticCallInstr* EffectGraphVisitor::BuildThrowNoSuchMethodError( |
| 4176 TokenPosition token_pos, | 4233 TokenPosition token_pos, |
| 4177 const Class& function_class, | 4234 const Class& function_class, |
| 4178 const String& function_name, | 4235 const String& function_name, |
| 4179 ArgumentListNode* function_arguments, | 4236 ArgumentListNode* function_arguments, |
| 4180 int invocation_type) { | 4237 int invocation_type) { |
| 4181 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 4238 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4219 | 4276 |
| 4220 // List existingArgumentNames. | 4277 // List existingArgumentNames. |
| 4221 Value* existing_argument_names_value = | 4278 Value* existing_argument_names_value = |
| 4222 Bind(new (Z) ConstantInstr(Array::ZoneHandle(Z, Array::null()))); | 4279 Bind(new (Z) ConstantInstr(Array::ZoneHandle(Z, Array::null()))); |
| 4223 arguments->Add(PushArgument(existing_argument_names_value)); | 4280 arguments->Add(PushArgument(existing_argument_names_value)); |
| 4224 // Resolve and call NoSuchMethodError._throwNew. | 4281 // Resolve and call NoSuchMethodError._throwNew. |
| 4225 const Library& core_lib = Library::Handle(Z, Library::CoreLibrary()); | 4282 const Library& core_lib = Library::Handle(Z, Library::CoreLibrary()); |
| 4226 const Class& cls = | 4283 const Class& cls = |
| 4227 Class::Handle(Z, core_lib.LookupClass(Symbols::NoSuchMethodError())); | 4284 Class::Handle(Z, core_lib.LookupClass(Symbols::NoSuchMethodError())); |
| 4228 ASSERT(!cls.IsNull()); | 4285 ASSERT(!cls.IsNull()); |
| 4286 const intptr_t kTypeArgsLen = 0; |
| 4229 const Function& func = Function::ZoneHandle( | 4287 const Function& func = Function::ZoneHandle( |
| 4230 Z, Resolver::ResolveStatic( | 4288 Z, Resolver::ResolveStatic( |
| 4231 cls, Library::PrivateCoreLibName(Symbols::ThrowNew()), | 4289 cls, Library::PrivateCoreLibName(Symbols::ThrowNew()), |
| 4232 arguments->length(), Object::null_array())); | 4290 kTypeArgsLen, arguments->length(), Object::null_array())); |
| 4233 ASSERT(!func.IsNull()); | 4291 ASSERT(!func.IsNull()); |
| 4234 return new (Z) StaticCallInstr(token_pos, func, | 4292 return new (Z) StaticCallInstr(token_pos, func, kTypeArgsLen, |
| 4235 Object::null_array(), // No names. | 4293 Object::null_array(), // No names. |
| 4236 arguments, owner()->ic_data_array()); | 4294 arguments, owner()->ic_data_array()); |
| 4237 } | 4295 } |
| 4238 | 4296 |
| 4239 | 4297 |
| 4240 void EffectGraphVisitor::BuildThrowNode(ThrowNode* node) { | 4298 void EffectGraphVisitor::BuildThrowNode(ThrowNode* node) { |
| 4241 if (FLAG_support_debugger) { | 4299 if (FLAG_support_debugger) { |
| 4242 if (node->exception()->IsLiteralNode() || | 4300 if (node->exception()->IsLiteralNode() || |
| 4243 node->exception()->IsLoadLocalNode() || | 4301 node->exception()->IsLoadLocalNode() || |
| 4244 node->exception()->IsLoadStaticFieldNode() || | 4302 node->exception()->IsLoadStaticFieldNode() || |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4393 ASSERT(type.HasResolvedTypeClass()); | 4451 ASSERT(type.HasResolvedTypeClass()); |
| 4394 const Class& type_class = Class::Handle(type.type_class()); | 4452 const Class& type_class = Class::Handle(type.type_class()); |
| 4395 // Bail if the type has any type parameters. | 4453 // Bail if the type has any type parameters. |
| 4396 if (type_class.IsGeneric()) return false; | 4454 if (type_class.IsGeneric()) return false; |
| 4397 | 4455 |
| 4398 // Finally a simple class for instance of checking. | 4456 // Finally a simple class for instance of checking. |
| 4399 return true; | 4457 return true; |
| 4400 } | 4458 } |
| 4401 | 4459 |
| 4402 } // namespace dart | 4460 } // namespace dart |
| OLD | NEW |