Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: runtime/vm/flow_graph_optimizer.cc

Issue 527043002: Restore behavior of ICDataHasReceiverArgumentClassIds changed by r39471. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 } 914 }
915 } 915 }
916 } 916 }
917 return true; 917 return true;
918 } 918 }
919 919
920 920
921 static bool ICDataHasReceiverArgumentClassIds(const ICData& ic_data, 921 static bool ICDataHasReceiverArgumentClassIds(const ICData& ic_data,
922 intptr_t receiver_class_id, 922 intptr_t receiver_class_id,
923 intptr_t argument_class_id) { 923 intptr_t argument_class_id) {
924 GrowableArray<intptr_t> receiver_cids(1); 924 if (ic_data.NumArgsTested() != 2) {
925 receiver_cids.Add(receiver_class_id); 925 return false;
926 GrowableArray<intptr_t> argument_cids(1); 926 }
927 argument_cids.Add(argument_class_id); 927 Function& target = Function::Handle();
928 return ICDataHasOnlyReceiverArgumentClassIds( 928 const intptr_t len = ic_data.NumberOfChecks();
929 ic_data, receiver_cids, argument_cids); 929 for (intptr_t i = 0; i < len; i++) {
930 if (ic_data.IsUsedAt(i)) {
931 GrowableArray<intptr_t> class_ids;
932 ic_data.GetCheckAt(i, &class_ids, &target);
933 ASSERT(class_ids.length() == 2);
934 if ((class_ids[0] == receiver_class_id) &&
935 (class_ids[1] == argument_class_id)) {
936 return true;
937 }
938 }
939 }
940 return false;
930 } 941 }
931 942
932 943
933 static bool HasOnlyOneSmi(const ICData& ic_data) { 944 static bool HasOnlyOneSmi(const ICData& ic_data) {
934 return (ic_data.NumberOfUsedChecks() == 1) 945 return (ic_data.NumberOfUsedChecks() == 1)
935 && ic_data.HasReceiverClassId(kSmiCid); 946 && ic_data.HasReceiverClassId(kSmiCid);
936 } 947 }
937 948
938 949
939 static bool HasOnlySmiOrMint(const ICData& ic_data) { 950 static bool HasOnlySmiOrMint(const ICData& ic_data) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 if (!CanUnboxDouble()) { 1007 if (!CanUnboxDouble()) {
997 return false; 1008 return false;
998 } 1009 }
999 1010
1000 // Unboxed double operation can't handle case of two smis. 1011 // Unboxed double operation can't handle case of two smis.
1001 if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) { 1012 if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) {
1002 return false; 1013 return false;
1003 } 1014 }
1004 1015
1005 // Check that it have seen only smis and doubles. 1016 // Check that it have seen only smis and doubles.
1006 GrowableArray<intptr_t> class_ids(2); 1017 return HasTwoDoubleOrSmi(ic_data);
1007 class_ids.Add(kSmiCid);
1008 class_ids.Add(kDoubleCid);
1009 return ICDataHasOnlyReceiverArgumentClassIds(ic_data, class_ids, class_ids);
1010 } 1018 }
1011 1019
1012 1020
1013 void FlowGraphOptimizer::ReplaceCall(Definition* call, 1021 void FlowGraphOptimizer::ReplaceCall(Definition* call,
1014 Definition* replacement) { 1022 Definition* replacement) {
1015 // Remove the original push arguments. 1023 // Remove the original push arguments.
1016 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) { 1024 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) {
1017 PushArgumentInstr* push = call->PushArgumentAt(i); 1025 PushArgumentInstr* push = call->PushArgumentAt(i);
1018 push->ReplaceUsesWith(push->value()->definition()); 1026 push->ReplaceUsesWith(push->value()->definition());
1019 push->RemoveFromGraph(); 1027 push->RemoveFromGraph();
(...skipping 8939 matching lines...) Expand 10 before | Expand all | Expand 10 after
9959 9967
9960 // Insert materializations at environment uses. 9968 // Insert materializations at environment uses.
9961 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 9969 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
9962 CreateMaterializationAt( 9970 CreateMaterializationAt(
9963 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); 9971 exits_collector_.exits()[i], alloc, alloc->cls(), *slots);
9964 } 9972 }
9965 } 9973 }
9966 9974
9967 9975
9968 } // namespace dart 9976 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698