| 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 "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 } | 787 } |
| 788 | 788 |
| 789 | 789 |
| 790 void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { | 790 void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { |
| 791 ASSERT(Token::IsTypeCastOperator(node->kind())); | 791 ASSERT(Token::IsTypeCastOperator(node->kind())); |
| 792 const AbstractType& type = node->right()->AsTypeNode()->type(); | 792 const AbstractType& type = node->right()->AsTypeNode()->type(); |
| 793 ASSERT(type.IsFinalized()); // The type in a type cast may be malformed. | 793 ASSERT(type.IsFinalized()); // The type in a type cast may be malformed. |
| 794 ValueGraphVisitor for_value(owner(), temp_index()); | 794 ValueGraphVisitor for_value(owner(), temp_index()); |
| 795 node->left()->Visit(&for_value); | 795 node->left()->Visit(&for_value); |
| 796 const String& dst_name = String::ZoneHandle( | 796 const String& dst_name = String::ZoneHandle( |
| 797 Symbols::New(Exceptions::kCastExceptionDstName)); | 797 Symbols::New(Exceptions::kCastErrorDstName)); |
| 798 if (!CanSkipTypeCheck(node->token_pos(), for_value.value(), type, dst_name)) { | 798 if (!CanSkipTypeCheck(node->token_pos(), for_value.value(), type, dst_name)) { |
| 799 Append(for_value); | 799 Append(for_value); |
| 800 Do(BuildAssertAssignable( | 800 Do(BuildAssertAssignable( |
| 801 node->token_pos(), for_value.value(), type, dst_name)); | 801 node->token_pos(), for_value.value(), type, dst_name)); |
| 802 } | 802 } |
| 803 } | 803 } |
| 804 | 804 |
| 805 | 805 |
| 806 void ValueGraphVisitor::BuildTypeTest(ComparisonNode* node) { | 806 void ValueGraphVisitor::BuildTypeTest(ComparisonNode* node) { |
| 807 ASSERT(Token::IsTypeTestOperator(node->kind())); | 807 ASSERT(Token::IsTypeTestOperator(node->kind())); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 | 872 |
| 873 | 873 |
| 874 void ValueGraphVisitor::BuildTypeCast(ComparisonNode* node) { | 874 void ValueGraphVisitor::BuildTypeCast(ComparisonNode* node) { |
| 875 ASSERT(Token::IsTypeCastOperator(node->kind())); | 875 ASSERT(Token::IsTypeCastOperator(node->kind())); |
| 876 const AbstractType& type = node->right()->AsTypeNode()->type(); | 876 const AbstractType& type = node->right()->AsTypeNode()->type(); |
| 877 ASSERT(type.IsFinalized()); // The type in a type cast may be malformed. | 877 ASSERT(type.IsFinalized()); // The type in a type cast may be malformed. |
| 878 ValueGraphVisitor for_value(owner(), temp_index()); | 878 ValueGraphVisitor for_value(owner(), temp_index()); |
| 879 node->left()->Visit(&for_value); | 879 node->left()->Visit(&for_value); |
| 880 Append(for_value); | 880 Append(for_value); |
| 881 const String& dst_name = String::ZoneHandle( | 881 const String& dst_name = String::ZoneHandle( |
| 882 Symbols::New(Exceptions::kCastExceptionDstName)); | 882 Symbols::New(Exceptions::kCastErrorDstName)); |
| 883 ReturnValue(BuildAssignableValue(node->token_pos(), | 883 ReturnValue(BuildAssignableValue(node->token_pos(), |
| 884 for_value.value(), | 884 for_value.value(), |
| 885 type, | 885 type, |
| 886 dst_name)); | 886 dst_name)); |
| 887 } | 887 } |
| 888 | 888 |
| 889 | 889 |
| 890 // <Expression> :: Comparison { kind: Token::Kind | 890 // <Expression> :: Comparison { kind: Token::Kind |
| 891 // left: <Expression> | 891 // left: <Expression> |
| 892 // right: <Expression> } | 892 // right: <Expression> } |
| (...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2643 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 2643 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 2644 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2644 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 2645 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2645 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2646 const Error& error = Error::Handle( | 2646 const Error& error = Error::Handle( |
| 2647 LanguageError::New(String::Handle(String::New(chars)))); | 2647 LanguageError::New(String::Handle(String::New(chars)))); |
| 2648 Isolate::Current()->long_jump_base()->Jump(1, error); | 2648 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2649 } | 2649 } |
| 2650 | 2650 |
| 2651 | 2651 |
| 2652 } // namespace dart | 2652 } // namespace dart |
| OLD | NEW |