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

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

Issue 16813002: Make constant propagation to fold x == x and re-run type propagation for better range analysis. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
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/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 case Token::kGTE: return GREATER_EQUAL; 262 case Token::kGTE: return GREATER_EQUAL;
263 default: 263 default:
264 UNREACHABLE(); 264 UNREACHABLE();
265 return OVERFLOW; 265 return OVERFLOW;
266 } 266 }
267 } 267 }
268 268
269 269
270 LocationSummary* EqualityCompareInstr::MakeLocationSummary() const { 270 LocationSummary* EqualityCompareInstr::MakeLocationSummary() const {
271 const intptr_t kNumInputs = 2; 271 const intptr_t kNumInputs = 2;
272 const bool is_checked_strict_equal =
273 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid);
274 if (receiver_class_id() == kMintCid) { 272 if (receiver_class_id() == kMintCid) {
275 const intptr_t kNumTemps = 1; 273 const intptr_t kNumTemps = 1;
276 LocationSummary* locs = 274 LocationSummary* locs =
277 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 275 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
278 locs->set_in(0, Location::RequiresFpuRegister()); 276 locs->set_in(0, Location::RequiresFpuRegister());
279 locs->set_in(1, Location::RequiresFpuRegister()); 277 locs->set_in(1, Location::RequiresFpuRegister());
280 locs->set_temp(0, Location::RequiresRegister()); 278 locs->set_temp(0, Location::RequiresRegister());
281 locs->set_out(Location::RequiresRegister()); 279 locs->set_out(Location::RequiresRegister());
282 return locs; 280 return locs;
283 } 281 }
(...skipping 13 matching lines...) Expand all
297 locs->set_in(0, Location::RegisterOrConstant(left())); 295 locs->set_in(0, Location::RegisterOrConstant(left()));
298 // Only one input can be a constant operand. The case of two constant 296 // Only one input can be a constant operand. The case of two constant
299 // operands should be handled by constant propagation. 297 // operands should be handled by constant propagation.
300 // Only right can be a stack slot. 298 // Only right can be a stack slot.
301 locs->set_in(1, locs->in(0).IsConstant() 299 locs->set_in(1, locs->in(0).IsConstant()
302 ? Location::RequiresRegister() 300 ? Location::RequiresRegister()
303 : Location::RegisterOrConstant(right())); 301 : Location::RegisterOrConstant(right()));
304 locs->set_out(Location::RequiresRegister()); 302 locs->set_out(Location::RequiresRegister());
305 return locs; 303 return locs;
306 } 304 }
307 if (is_checked_strict_equal) { 305 if (is_checked_strict_equal()) {
308 const intptr_t kNumTemps = 1; 306 const intptr_t kNumTemps = 1;
309 LocationSummary* locs = 307 LocationSummary* locs =
310 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 308 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
311 locs->set_in(0, Location::RequiresRegister()); 309 locs->set_in(0, Location::RequiresRegister());
312 locs->set_in(1, Location::RequiresRegister()); 310 locs->set_in(1, Location::RequiresRegister());
313 locs->set_temp(0, Location::RequiresRegister()); 311 locs->set_temp(0, Location::RequiresRegister());
314 locs->set_out(Location::RequiresRegister()); 312 locs->set_out(Location::RequiresRegister());
315 return locs; 313 return locs;
316 } 314 }
317 if (IsPolymorphic()) { 315 if (IsPolymorphic()) {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 return; 834 return;
837 } 835 }
838 if (receiver_class_id() == kMintCid) { 836 if (receiver_class_id() == kMintCid) {
839 EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), kNoBranch); 837 EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), kNoBranch);
840 return; 838 return;
841 } 839 }
842 if (receiver_class_id() == kDoubleCid) { 840 if (receiver_class_id() == kDoubleCid) {
843 EmitDoubleComparisonOp(compiler, *locs(), kind(), kNoBranch); 841 EmitDoubleComparisonOp(compiler, *locs(), kind(), kNoBranch);
844 return; 842 return;
845 } 843 }
846 const bool is_checked_strict_equal = 844 if (is_checked_strict_equal()) {
847 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid);
848 if (is_checked_strict_equal) {
849 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), kNoBranch, 845 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), kNoBranch,
850 deopt_id()); 846 deopt_id());
851 return; 847 return;
852 } 848 }
853 if (IsPolymorphic()) { 849 if (IsPolymorphic()) {
854 EmitGenericEqualityCompare(compiler, locs(), kind(), kNoBranch, *ic_data(), 850 EmitGenericEqualityCompare(compiler, locs(), kind(), kNoBranch, *ic_data(),
855 deopt_id(), token_pos()); 851 deopt_id(), token_pos());
856 return; 852 return;
857 } 853 }
858 Register left = locs()->in(0).reg(); 854 Register left = locs()->in(0).reg();
(...skipping 19 matching lines...) Expand all
878 return; 874 return;
879 } 875 }
880 if (receiver_class_id() == kMintCid) { 876 if (receiver_class_id() == kMintCid) {
881 EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), branch); 877 EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), branch);
882 return; 878 return;
883 } 879 }
884 if (receiver_class_id() == kDoubleCid) { 880 if (receiver_class_id() == kDoubleCid) {
885 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); 881 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
886 return; 882 return;
887 } 883 }
888 const bool is_checked_strict_equal = 884 if (is_checked_strict_equal()) {
889 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid);
890 if (is_checked_strict_equal) {
891 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), branch, 885 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), branch,
892 deopt_id()); 886 deopt_id());
893 return; 887 return;
894 } 888 }
895 if (IsPolymorphic()) { 889 if (IsPolymorphic()) {
896 EmitGenericEqualityCompare(compiler, locs(), kind(), branch, *ic_data(), 890 EmitGenericEqualityCompare(compiler, locs(), kind(), branch, *ic_data(),
897 deopt_id(), token_pos()); 891 deopt_id(), token_pos());
898 return; 892 return;
899 } 893 }
900 Register left = locs()->in(0).reg(); 894 Register left = locs()->in(0).reg();
(...skipping 3842 matching lines...) Expand 10 before | Expand all | Expand 10 after
4743 PcDescriptors::kOther, 4737 PcDescriptors::kOther,
4744 locs()); 4738 locs());
4745 __ Drop(2); // Discard type arguments and receiver. 4739 __ Drop(2); // Discard type arguments and receiver.
4746 } 4740 }
4747 4741
4748 } // namespace dart 4742 } // namespace dart
4749 4743
4750 #undef __ 4744 #undef __
4751 4745
4752 #endif // defined TARGET_ARCH_IA32 4746 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698