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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 | 1677 |
1678 | 1678 |
1679 void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { | 1679 void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { |
1680 ASSERT(Token::IsTypeCastOperator(node->kind())); | 1680 ASSERT(Token::IsTypeCastOperator(node->kind())); |
1681 ASSERT(!node->right()->AsTypeNode()->type().IsNull()); | 1681 ASSERT(!node->right()->AsTypeNode()->type().IsNull()); |
1682 const AbstractType& type = node->right()->AsTypeNode()->type(); | 1682 const AbstractType& type = node->right()->AsTypeNode()->type(); |
1683 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); | 1683 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); |
1684 ValueGraphVisitor for_value(owner()); | 1684 ValueGraphVisitor for_value(owner()); |
1685 node->left()->Visit(&for_value); | 1685 node->left()->Visit(&for_value); |
1686 Append(for_value); | 1686 Append(for_value); |
1687 const String& dst_name = String::ZoneHandle( | |
1688 Z, Symbols::New(Exceptions::kCastErrorDstName)); | |
1689 if (CanSkipTypeCheck(node->token_pos(), | 1687 if (CanSkipTypeCheck(node->token_pos(), |
1690 for_value.value(), | 1688 for_value.value(), |
1691 type, | 1689 type, |
1692 dst_name)) { | 1690 Symbols::InTypeCast())) { |
1693 ReturnValue(for_value.value()); | 1691 ReturnValue(for_value.value()); |
1694 return; | 1692 return; |
1695 } | 1693 } |
1696 PushArgumentInstr* push_left = PushArgument(for_value.value()); | 1694 PushArgumentInstr* push_left = PushArgument(for_value.value()); |
1697 PushArgumentInstr* push_type_args = NULL; | 1695 PushArgumentInstr* push_type_args = NULL; |
1698 if (type.IsInstantiated()) { | 1696 if (type.IsInstantiated()) { |
1699 push_type_args = PushArgument(BuildNullValue(node->token_pos())); | 1697 push_type_args = PushArgument(BuildNullValue(node->token_pos())); |
1700 } else { | 1698 } else { |
1701 BuildTypecheckPushArguments(node->token_pos(), &push_type_args); | 1699 BuildTypecheckPushArguments(node->token_pos(), &push_type_args); |
1702 } | 1700 } |
(...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4656 Script::Handle(function.script()), | 4654 Script::Handle(function.script()), |
4657 function.token_pos(), | 4655 function.token_pos(), |
4658 Report::AtLocation, | 4656 Report::AtLocation, |
4659 "FlowGraphBuilder Bailout: %s %s", | 4657 "FlowGraphBuilder Bailout: %s %s", |
4660 String::Handle(function.name()).ToCString(), | 4658 String::Handle(function.name()).ToCString(), |
4661 reason); | 4659 reason); |
4662 UNREACHABLE(); | 4660 UNREACHABLE(); |
4663 } | 4661 } |
4664 | 4662 |
4665 } // namespace dart | 4663 } // namespace dart |
OLD | NEW |