OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 // required sets 'receiver_class_ids' or 'argument_class_ids', respectively. | 880 // required sets 'receiver_class_ids' or 'argument_class_ids', respectively. |
881 static bool ICDataHasOnlyReceiverArgumentClassIds( | 881 static bool ICDataHasOnlyReceiverArgumentClassIds( |
882 const ICData& ic_data, | 882 const ICData& ic_data, |
883 const GrowableArray<intptr_t>& receiver_class_ids, | 883 const GrowableArray<intptr_t>& receiver_class_ids, |
884 const GrowableArray<intptr_t>& argument_class_ids) { | 884 const GrowableArray<intptr_t>& argument_class_ids) { |
885 if (ic_data.NumArgsTested() != 2) { | 885 if (ic_data.NumArgsTested() != 2) { |
886 return false; | 886 return false; |
887 } | 887 } |
888 Function& target = Function::Handle(); | 888 Function& target = Function::Handle(); |
889 const intptr_t len = ic_data.NumberOfChecks(); | 889 const intptr_t len = ic_data.NumberOfChecks(); |
| 890 GrowableArray<intptr_t> class_ids; |
890 for (intptr_t i = 0; i < len; i++) { | 891 for (intptr_t i = 0; i < len; i++) { |
891 if (ic_data.IsUsedAt(i)) { | 892 if (ic_data.IsUsedAt(i)) { |
892 GrowableArray<intptr_t> class_ids; | |
893 ic_data.GetCheckAt(i, &class_ids, &target); | 893 ic_data.GetCheckAt(i, &class_ids, &target); |
894 ASSERT(class_ids.length() == 2); | 894 ASSERT(class_ids.length() == 2); |
895 if (!ClassIdIsOneOf(class_ids[0], receiver_class_ids) || | 895 if (!ClassIdIsOneOf(class_ids[0], receiver_class_ids) || |
896 !ClassIdIsOneOf(class_ids[1], argument_class_ids)) { | 896 !ClassIdIsOneOf(class_ids[1], argument_class_ids)) { |
897 return false; | 897 return false; |
898 } | 898 } |
899 } | 899 } |
900 } | 900 } |
901 return true; | 901 return true; |
902 } | 902 } |
(...skipping 3388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4291 | 4291 |
4292 if (Token::IsRelationalOperator(op_kind) && | 4292 if (Token::IsRelationalOperator(op_kind) && |
4293 TryReplaceWithRelationalOp(instr, op_kind)) { | 4293 TryReplaceWithRelationalOp(instr, op_kind)) { |
4294 return; | 4294 return; |
4295 } | 4295 } |
4296 | 4296 |
4297 if (Token::IsBinaryOperator(op_kind) && | 4297 if (Token::IsBinaryOperator(op_kind) && |
4298 TryReplaceWithBinaryOp(instr, op_kind)) { | 4298 TryReplaceWithBinaryOp(instr, op_kind)) { |
4299 return; | 4299 return; |
4300 } | 4300 } |
4301 if (Token::IsPrefixOperator(op_kind) && | 4301 if (Token::IsUnaryOperator(op_kind) && |
4302 TryReplaceWithUnaryOp(instr, op_kind)) { | 4302 TryReplaceWithUnaryOp(instr, op_kind)) { |
4303 return; | 4303 return; |
4304 } | 4304 } |
4305 if ((op_kind == Token::kGET) && TryInlineInstanceGetter(instr)) { | 4305 if ((op_kind == Token::kGET) && TryInlineInstanceGetter(instr)) { |
4306 return; | 4306 return; |
4307 } | 4307 } |
4308 if ((op_kind == Token::kSET) && | 4308 if ((op_kind == Token::kSET) && |
4309 TryInlineInstanceSetter(instr, unary_checks)) { | 4309 TryInlineInstanceSetter(instr, unary_checks)) { |
4310 return; | 4310 return; |
4311 } | 4311 } |
(...skipping 5766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10078 | 10078 |
10079 // Insert materializations at environment uses. | 10079 // Insert materializations at environment uses. |
10080 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { | 10080 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { |
10081 CreateMaterializationAt( | 10081 CreateMaterializationAt( |
10082 exits_collector_.exits()[i], alloc, *slots); | 10082 exits_collector_.exits()[i], alloc, *slots); |
10083 } | 10083 } |
10084 } | 10084 } |
10085 | 10085 |
10086 | 10086 |
10087 } // namespace dart | 10087 } // namespace dart |
OLD | NEW |