| 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/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 case Token::kGTE: return GREATER_EQUAL; | 428 case Token::kGTE: return GREATER_EQUAL; |
| 429 default: | 429 default: |
| 430 UNREACHABLE(); | 430 UNREACHABLE(); |
| 431 return OVERFLOW; | 431 return OVERFLOW; |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 | 434 |
| 435 | 435 |
| 436 LocationSummary* EqualityCompareInstr::MakeLocationSummary() const { | 436 LocationSummary* EqualityCompareInstr::MakeLocationSummary() const { |
| 437 const intptr_t kNumInputs = 2; | 437 const intptr_t kNumInputs = 2; |
| 438 const bool is_checked_strict_equal = | |
| 439 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); | |
| 440 if (receiver_class_id() == kDoubleCid) { | 438 if (receiver_class_id() == kDoubleCid) { |
| 441 const intptr_t kNumTemps = 0; | 439 const intptr_t kNumTemps = 0; |
| 442 LocationSummary* locs = | 440 LocationSummary* locs = |
| 443 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 441 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 444 locs->set_in(0, Location::RequiresFpuRegister()); | 442 locs->set_in(0, Location::RequiresFpuRegister()); |
| 445 locs->set_in(1, Location::RequiresFpuRegister()); | 443 locs->set_in(1, Location::RequiresFpuRegister()); |
| 446 locs->set_out(Location::RequiresRegister()); | 444 locs->set_out(Location::RequiresRegister()); |
| 447 return locs; | 445 return locs; |
| 448 } | 446 } |
| 449 if (receiver_class_id() == kSmiCid) { | 447 if (receiver_class_id() == kSmiCid) { |
| 450 const intptr_t kNumTemps = 0; | 448 const intptr_t kNumTemps = 0; |
| 451 LocationSummary* locs = | 449 LocationSummary* locs = |
| 452 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 450 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 453 locs->set_in(0, Location::RegisterOrConstant(left())); | 451 locs->set_in(0, Location::RegisterOrConstant(left())); |
| 454 // Only one input can be a constant operand. The case of two constant | 452 // Only one input can be a constant operand. The case of two constant |
| 455 // operands should be handled by constant propagation. | 453 // operands should be handled by constant propagation. |
| 456 // Only right can be a stack slot. | 454 // Only right can be a stack slot. |
| 457 locs->set_in(1, locs->in(0).IsConstant() | 455 locs->set_in(1, locs->in(0).IsConstant() |
| 458 ? Location::RequiresRegister() | 456 ? Location::RequiresRegister() |
| 459 : Location::RegisterOrConstant(right())); | 457 : Location::RegisterOrConstant(right())); |
| 460 locs->set_out(Location::RequiresRegister()); | 458 locs->set_out(Location::RequiresRegister()); |
| 461 return locs; | 459 return locs; |
| 462 } | 460 } |
| 463 if (is_checked_strict_equal) { | 461 if (is_checked_strict_equal()) { |
| 464 const intptr_t kNumTemps = 1; | 462 const intptr_t kNumTemps = 1; |
| 465 LocationSummary* locs = | 463 LocationSummary* locs = |
| 466 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 464 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 467 locs->set_in(0, Location::RequiresRegister()); | 465 locs->set_in(0, Location::RequiresRegister()); |
| 468 locs->set_in(1, Location::RequiresRegister()); | 466 locs->set_in(1, Location::RequiresRegister()); |
| 469 locs->set_temp(0, Location::RequiresRegister()); | 467 locs->set_temp(0, Location::RequiresRegister()); |
| 470 locs->set_out(Location::RequiresRegister()); | 468 locs->set_out(Location::RequiresRegister()); |
| 471 return locs; | 469 return locs; |
| 472 } | 470 } |
| 473 if (IsPolymorphic()) { | 471 if (IsPolymorphic()) { |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 if (receiver_class_id() == kSmiCid) { | 879 if (receiver_class_id() == kSmiCid) { |
| 882 // Deoptimizes if both arguments not Smi. | 880 // Deoptimizes if both arguments not Smi. |
| 883 EmitSmiComparisonOp(compiler, *locs(), kind(), kNoBranch); | 881 EmitSmiComparisonOp(compiler, *locs(), kind(), kNoBranch); |
| 884 return; | 882 return; |
| 885 } | 883 } |
| 886 if (receiver_class_id() == kDoubleCid) { | 884 if (receiver_class_id() == kDoubleCid) { |
| 887 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. | 885 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. |
| 888 EmitDoubleComparisonOp(compiler, *locs(), kind(), kNoBranch); | 886 EmitDoubleComparisonOp(compiler, *locs(), kind(), kNoBranch); |
| 889 return; | 887 return; |
| 890 } | 888 } |
| 891 const bool is_checked_strict_equal = | 889 if (is_checked_strict_equal()) { |
| 892 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); | |
| 893 if (is_checked_strict_equal) { | |
| 894 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), kNoBranch, | 890 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), kNoBranch, |
| 895 deopt_id()); | 891 deopt_id()); |
| 896 return; | 892 return; |
| 897 } | 893 } |
| 898 if (IsPolymorphic()) { | 894 if (IsPolymorphic()) { |
| 899 EmitGenericEqualityCompare(compiler, locs(), kind(), kNoBranch, *ic_data(), | 895 EmitGenericEqualityCompare(compiler, locs(), kind(), kNoBranch, *ic_data(), |
| 900 deopt_id(), token_pos()); | 896 deopt_id(), token_pos()); |
| 901 return; | 897 return; |
| 902 } | 898 } |
| 903 Register left = locs()->in(0).reg(); | 899 Register left = locs()->in(0).reg(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 920 if (receiver_class_id() == kSmiCid) { | 916 if (receiver_class_id() == kSmiCid) { |
| 921 // Deoptimizes if both arguments not Smi. | 917 // Deoptimizes if both arguments not Smi. |
| 922 EmitSmiComparisonOp(compiler, *locs(), kind(), branch); | 918 EmitSmiComparisonOp(compiler, *locs(), kind(), branch); |
| 923 return; | 919 return; |
| 924 } | 920 } |
| 925 if (receiver_class_id() == kDoubleCid) { | 921 if (receiver_class_id() == kDoubleCid) { |
| 926 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. | 922 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. |
| 927 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); | 923 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); |
| 928 return; | 924 return; |
| 929 } | 925 } |
| 930 const bool is_checked_strict_equal = | 926 if (is_checked_strict_equal()) { |
| 931 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); | |
| 932 if (is_checked_strict_equal) { | |
| 933 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), branch, | 927 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), branch, |
| 934 deopt_id()); | 928 deopt_id()); |
| 935 return; | 929 return; |
| 936 } | 930 } |
| 937 if (IsPolymorphic()) { | 931 if (IsPolymorphic()) { |
| 938 EmitGenericEqualityCompare(compiler, locs(), kind(), branch, *ic_data(), | 932 EmitGenericEqualityCompare(compiler, locs(), kind(), branch, *ic_data(), |
| 939 deopt_id(), token_pos()); | 933 deopt_id(), token_pos()); |
| 940 return; | 934 return; |
| 941 } | 935 } |
| 942 Register left = locs()->in(0).reg(); | 936 Register left = locs()->in(0).reg(); |
| (...skipping 3472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4415 PcDescriptors::kOther, | 4409 PcDescriptors::kOther, |
| 4416 locs()); | 4410 locs()); |
| 4417 __ Drop(2); // Discard type arguments and receiver. | 4411 __ Drop(2); // Discard type arguments and receiver. |
| 4418 } | 4412 } |
| 4419 | 4413 |
| 4420 } // namespace dart | 4414 } // namespace dart |
| 4421 | 4415 |
| 4422 #undef __ | 4416 #undef __ |
| 4423 | 4417 |
| 4424 #endif // defined TARGET_ARCH_X64 | 4418 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |