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

Side by Side Diff: runtime/vm/intermediate_language_arm.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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 case Token::kGTE: return GE; 303 case Token::kGTE: return GE;
304 default: 304 default:
305 UNREACHABLE(); 305 UNREACHABLE();
306 return VS; 306 return VS;
307 } 307 }
308 } 308 }
309 309
310 310
311 LocationSummary* EqualityCompareInstr::MakeLocationSummary() const { 311 LocationSummary* EqualityCompareInstr::MakeLocationSummary() const {
312 const intptr_t kNumInputs = 2; 312 const intptr_t kNumInputs = 2;
313 const bool is_checked_strict_equal =
314 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid);
315 if (receiver_class_id() == kMintCid) { 313 if (receiver_class_id() == kMintCid) {
316 const intptr_t kNumTemps = 1; 314 const intptr_t kNumTemps = 1;
317 LocationSummary* locs = 315 LocationSummary* locs =
318 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 316 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
319 locs->set_in(0, Location::RequiresFpuRegister()); 317 locs->set_in(0, Location::RequiresFpuRegister());
320 locs->set_in(1, Location::RequiresFpuRegister()); 318 locs->set_in(1, Location::RequiresFpuRegister());
321 locs->set_temp(0, Location::RequiresRegister()); 319 locs->set_temp(0, Location::RequiresRegister());
322 locs->set_out(Location::RequiresRegister()); 320 locs->set_out(Location::RequiresRegister());
323 return locs; 321 return locs;
324 } 322 }
(...skipping 12 matching lines...) Expand all
337 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 335 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
338 locs->set_in(0, Location::RegisterOrConstant(left())); 336 locs->set_in(0, Location::RegisterOrConstant(left()));
339 // Only one input can be a constant operand. The case of two constant 337 // Only one input can be a constant operand. The case of two constant
340 // operands should be handled by constant propagation. 338 // operands should be handled by constant propagation.
341 locs->set_in(1, locs->in(0).IsConstant() 339 locs->set_in(1, locs->in(0).IsConstant()
342 ? Location::RequiresRegister() 340 ? Location::RequiresRegister()
343 : Location::RegisterOrConstant(right())); 341 : Location::RegisterOrConstant(right()));
344 locs->set_out(Location::RequiresRegister()); 342 locs->set_out(Location::RequiresRegister());
345 return locs; 343 return locs;
346 } 344 }
347 if (is_checked_strict_equal) { 345 if (is_checked_strict_equal()) {
348 const intptr_t kNumTemps = 1; 346 const intptr_t kNumTemps = 1;
349 LocationSummary* locs = 347 LocationSummary* locs =
350 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 348 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
351 locs->set_in(0, Location::RequiresRegister()); 349 locs->set_in(0, Location::RequiresRegister());
352 locs->set_in(1, Location::RequiresRegister()); 350 locs->set_in(1, Location::RequiresRegister());
353 locs->set_temp(0, Location::RequiresRegister()); 351 locs->set_temp(0, Location::RequiresRegister());
354 locs->set_out(Location::RequiresRegister()); 352 locs->set_out(Location::RequiresRegister());
355 return locs; 353 return locs;
356 } 354 }
357 if (IsPolymorphic()) { 355 if (IsPolymorphic()) {
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 return; 774 return;
777 } 775 }
778 if (receiver_class_id() == kMintCid) { 776 if (receiver_class_id() == kMintCid) {
779 EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), kNoBranch); 777 EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), kNoBranch);
780 return; 778 return;
781 } 779 }
782 if (receiver_class_id() == kDoubleCid) { 780 if (receiver_class_id() == kDoubleCid) {
783 EmitDoubleComparisonOp(compiler, *locs(), kind(), kNoBranch); 781 EmitDoubleComparisonOp(compiler, *locs(), kind(), kNoBranch);
784 return; 782 return;
785 } 783 }
786 const bool is_checked_strict_equal = 784 if (is_checked_strict_equal()) {
787 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid);
788 if (is_checked_strict_equal) {
789 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), kNoBranch, 785 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), kNoBranch,
790 deopt_id()); 786 deopt_id());
791 return; 787 return;
792 } 788 }
793 if (IsPolymorphic()) { 789 if (IsPolymorphic()) {
794 EmitGenericEqualityCompare(compiler, locs(), kind(), kNoBranch, *ic_data(), 790 EmitGenericEqualityCompare(compiler, locs(), kind(), kNoBranch, *ic_data(),
795 deopt_id(), token_pos()); 791 deopt_id(), token_pos());
796 return; 792 return;
797 } 793 }
798 Register left = locs()->in(0).reg(); 794 Register left = locs()->in(0).reg();
(...skipping 20 matching lines...) Expand all
819 return; 815 return;
820 } 816 }
821 if (receiver_class_id() == kMintCid) { 817 if (receiver_class_id() == kMintCid) {
822 EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), branch); 818 EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), branch);
823 return; 819 return;
824 } 820 }
825 if (receiver_class_id() == kDoubleCid) { 821 if (receiver_class_id() == kDoubleCid) {
826 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); 822 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
827 return; 823 return;
828 } 824 }
829 const bool is_checked_strict_equal = 825 if (is_checked_strict_equal()) {
830 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid);
831 if (is_checked_strict_equal) {
832 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), branch, 826 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), branch,
833 deopt_id()); 827 deopt_id());
834 return; 828 return;
835 } 829 }
836 if (IsPolymorphic()) { 830 if (IsPolymorphic()) {
837 EmitGenericEqualityCompare(compiler, locs(), kind(), branch, *ic_data(), 831 EmitGenericEqualityCompare(compiler, locs(), kind(), branch, *ic_data(),
838 deopt_id(), token_pos()); 832 deopt_id(), token_pos());
839 return; 833 return;
840 } 834 }
841 Register left = locs()->in(0).reg(); 835 Register left = locs()->in(0).reg();
(...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after
3585 compiler->GenerateCall(token_pos(), 3579 compiler->GenerateCall(token_pos(),
3586 &label, 3580 &label,
3587 PcDescriptors::kOther, 3581 PcDescriptors::kOther,
3588 locs()); 3582 locs());
3589 __ Drop(2); // Discard type arguments and receiver. 3583 __ Drop(2); // Discard type arguments and receiver.
3590 } 3584 }
3591 3585
3592 } // namespace dart 3586 } // namespace dart
3593 3587
3594 #endif // defined TARGET_ARCH_ARM 3588 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698