| 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/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 // dst_name: String } | 923 // dst_name: String } |
| 924 void EffectGraphVisitor::VisitAssignableNode(AssignableNode* node) { | 924 void EffectGraphVisitor::VisitAssignableNode(AssignableNode* node) { |
| 925 ValueGraphVisitor for_value(owner(), temp_index()); | 925 ValueGraphVisitor for_value(owner(), temp_index()); |
| 926 node->expr()->Visit(&for_value); | 926 node->expr()->Visit(&for_value); |
| 927 Append(for_value); | 927 Append(for_value); |
| 928 Definition* checked_value; | 928 Definition* checked_value; |
| 929 if (CanSkipTypeCheck(node->expr()->token_pos(), | 929 if (CanSkipTypeCheck(node->expr()->token_pos(), |
| 930 for_value.value(), | 930 for_value.value(), |
| 931 node->type(), | 931 node->type(), |
| 932 node->dst_name())) { | 932 node->dst_name())) { |
| 933 checked_value = for_value.value()->definition(); // No check needed. | 933 // Drop the value and 0 additional temporaries. |
| 934 checked_value = new DropTempsInstr(0, for_value.value()); |
| 934 } else { | 935 } else { |
| 935 checked_value = BuildAssertAssignable(node->expr()->token_pos(), | 936 checked_value = BuildAssertAssignable(node->expr()->token_pos(), |
| 936 for_value.value(), | 937 for_value.value(), |
| 937 node->type(), | 938 node->type(), |
| 938 node->dst_name()); | 939 node->dst_name()); |
| 939 } | 940 } |
| 940 ReturnDefinition(checked_value); | 941 ReturnDefinition(checked_value); |
| 941 } | 942 } |
| 942 | 943 |
| 943 | 944 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 ReturnDefinition(call); | 1295 ReturnDefinition(call); |
| 1295 } | 1296 } |
| 1296 | 1297 |
| 1297 | 1298 |
| 1298 void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { | 1299 void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { |
| 1299 ASSERT(Token::IsTypeCastOperator(node->kind())); | 1300 ASSERT(Token::IsTypeCastOperator(node->kind())); |
| 1300 const AbstractType& type = node->right()->AsTypeNode()->type(); | 1301 const AbstractType& type = node->right()->AsTypeNode()->type(); |
| 1301 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); | 1302 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); |
| 1302 ValueGraphVisitor for_value(owner(), temp_index()); | 1303 ValueGraphVisitor for_value(owner(), temp_index()); |
| 1303 node->left()->Visit(&for_value); | 1304 node->left()->Visit(&for_value); |
| 1305 Append(for_value); |
| 1304 const String& dst_name = String::ZoneHandle( | 1306 const String& dst_name = String::ZoneHandle( |
| 1305 Symbols::New(Exceptions::kCastErrorDstName)); | 1307 Symbols::New(Exceptions::kCastErrorDstName)); |
| 1306 if (!CanSkipTypeCheck(node->token_pos(), for_value.value(), type, dst_name)) { | 1308 if (CanSkipTypeCheck(node->token_pos(), for_value.value(), type, dst_name)) { |
| 1307 Append(for_value); | 1309 // Drop the value and 0 additional temporaries. |
| 1308 Do(BuildAssertAssignable( | 1310 Do(new DropTempsInstr(0, for_value.value())); |
| 1309 node->token_pos(), for_value.value(), type, dst_name)); | 1311 } else { |
| 1312 Do(BuildAssertAssignable(node->token_pos(), |
| 1313 for_value.value(), |
| 1314 type, |
| 1315 dst_name)); |
| 1310 } | 1316 } |
| 1311 } | 1317 } |
| 1312 | 1318 |
| 1313 | 1319 |
| 1314 void ValueGraphVisitor::BuildTypeCast(ComparisonNode* node) { | 1320 void ValueGraphVisitor::BuildTypeCast(ComparisonNode* node) { |
| 1315 ASSERT(Token::IsTypeCastOperator(node->kind())); | 1321 ASSERT(Token::IsTypeCastOperator(node->kind())); |
| 1316 ASSERT(!node->right()->AsTypeNode()->type().IsNull()); | 1322 ASSERT(!node->right()->AsTypeNode()->type().IsNull()); |
| 1317 const AbstractType& type = node->right()->AsTypeNode()->type(); | 1323 const AbstractType& type = node->right()->AsTypeNode()->type(); |
| 1318 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); | 1324 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); |
| 1319 ValueGraphVisitor for_value(owner(), temp_index()); | 1325 ValueGraphVisitor for_value(owner(), temp_index()); |
| (...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3850 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3856 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3851 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3857 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3852 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3858 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3853 const Error& error = Error::Handle( | 3859 const Error& error = Error::Handle( |
| 3854 LanguageError::New(String::Handle(String::New(chars)))); | 3860 LanguageError::New(String::Handle(String::New(chars)))); |
| 3855 Isolate::Current()->long_jump_base()->Jump(1, error); | 3861 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3856 } | 3862 } |
| 3857 | 3863 |
| 3858 | 3864 |
| 3859 } // namespace dart | 3865 } // namespace dart |
| OLD | NEW |