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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 // right: <Expression> } | 963 // right: <Expression> } |
964 void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { | 964 void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { |
965 // Operators "&&" and "||" cannot be overloaded therefore do not call | 965 // Operators "&&" and "||" cannot be overloaded therefore do not call |
966 // operator. | 966 // operator. |
967 if ((node->kind() == Token::kAND) || (node->kind() == Token::kOR)) { | 967 if ((node->kind() == Token::kAND) || (node->kind() == Token::kOR)) { |
968 // See ValueGraphVisitor::VisitBinaryOpNode. | 968 // See ValueGraphVisitor::VisitBinaryOpNode. |
969 TestGraphVisitor for_left(owner(), | 969 TestGraphVisitor for_left(owner(), |
970 temp_index(), | 970 temp_index(), |
971 node->left()->token_pos()); | 971 node->left()->token_pos()); |
972 node->left()->Visit(&for_left); | 972 node->left()->Visit(&for_left); |
973 EffectGraphVisitor for_right(owner(), temp_index()); | |
974 node->right()->Visit(&for_right); | |
975 EffectGraphVisitor empty(owner(), temp_index()); | 973 EffectGraphVisitor empty(owner(), temp_index()); |
976 if (node->kind() == Token::kAND) { | 974 if (FLAG_enable_type_checks) { |
977 Join(for_left, for_right, empty); | 975 ValueGraphVisitor for_right(owner(), temp_index()); |
| 976 node->right()->Visit(&for_right); |
| 977 Value* right_value = for_right.value(); |
| 978 for_right.Do(new AssertBooleanInstr(node->right()->token_pos(), |
| 979 right_value)); |
| 980 if (node->kind() == Token::kAND) { |
| 981 Join(for_left, for_right, empty); |
| 982 } else { |
| 983 Join(for_left, empty, for_right); |
| 984 } |
978 } else { | 985 } else { |
979 Join(for_left, empty, for_right); | 986 EffectGraphVisitor for_right(owner(), temp_index()); |
| 987 node->right()->Visit(&for_right); |
| 988 if (node->kind() == Token::kAND) { |
| 989 Join(for_left, for_right, empty); |
| 990 } else { |
| 991 Join(for_left, empty, for_right); |
| 992 } |
980 } | 993 } |
981 return; | 994 return; |
982 } | 995 } |
983 ValueGraphVisitor for_left_value(owner(), temp_index()); | 996 ValueGraphVisitor for_left_value(owner(), temp_index()); |
984 node->left()->Visit(&for_left_value); | 997 node->left()->Visit(&for_left_value); |
985 Append(for_left_value); | 998 Append(for_left_value); |
986 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); | 999 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); |
987 | 1000 |
988 ValueGraphVisitor for_right_value(owner(), temp_index()); | 1001 ValueGraphVisitor for_right_value(owner(), temp_index()); |
989 node->right()->Visit(&for_right_value); | 1002 node->right()->Visit(&for_right_value); |
(...skipping 2818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3808 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3821 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
3809 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3822 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
3810 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3823 OS::SNPrint(chars, len, kFormat, function_name, reason); |
3811 const Error& error = Error::Handle( | 3824 const Error& error = Error::Handle( |
3812 LanguageError::New(String::Handle(String::New(chars)))); | 3825 LanguageError::New(String::Handle(String::New(chars)))); |
3813 Isolate::Current()->long_jump_base()->Jump(1, error); | 3826 Isolate::Current()->long_jump_base()->Jump(1, error); |
3814 } | 3827 } |
3815 | 3828 |
3816 | 3829 |
3817 } // namespace dart | 3830 } // namespace dart |
OLD | NEW |