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_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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 *ic_data()); | 881 *ic_data()); |
882 if (branch->is_checked()) { | 882 if (branch->is_checked()) { |
883 EmitAssertBoolean(EAX, token_pos(), deopt_id(), locs(), compiler); | 883 EmitAssertBoolean(EAX, token_pos(), deopt_id(), locs(), compiler); |
884 } | 884 } |
885 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; | 885 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; |
886 __ CompareObject(EAX, Bool::True()); | 886 __ CompareObject(EAX, Bool::True()); |
887 branch->EmitBranchOnCondition(compiler, branch_condition); | 887 branch->EmitBranchOnCondition(compiler, branch_condition); |
888 } | 888 } |
889 | 889 |
890 | 890 |
| 891 LocationSummary* TestSmiInstr::MakeLocationSummary() const { |
| 892 const intptr_t kNumInputs = 2; |
| 893 const intptr_t kNumTemps = 0; |
| 894 LocationSummary* locs = |
| 895 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 896 locs->set_in(0, Location::RequiresRegister()); |
| 897 // Only one input can be a constant operand. The case of two constant |
| 898 // operands should be handled by constant propagation. |
| 899 locs->set_in(1, Location::RegisterOrConstant(right())); |
| 900 return locs; |
| 901 } |
| 902 |
| 903 |
| 904 void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 905 // Never emitted outside of the BranchInstr. |
| 906 UNREACHABLE(); |
| 907 } |
| 908 |
| 909 |
| 910 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler, |
| 911 BranchInstr* branch) { |
| 912 Condition branch_condition = (kind() == Token::kNE) ? NOT_ZERO : ZERO; |
| 913 Location right = locs()->in(1); |
| 914 if (right.IsConstant()) { |
| 915 ASSERT(right.constant().IsSmi()); |
| 916 const int32_t imm = |
| 917 reinterpret_cast<int32_t>(right.constant().raw()); |
| 918 __ testl(locs()->in(0).reg(), Immediate(imm)); |
| 919 } else { |
| 920 __ testl(locs()->in(0).reg(), right.reg()); |
| 921 } |
| 922 branch->EmitBranchOnCondition(compiler, branch_condition); |
| 923 } |
| 924 |
| 925 |
891 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { | 926 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { |
892 const intptr_t kNumInputs = 2; | 927 const intptr_t kNumInputs = 2; |
893 const intptr_t kNumTemps = 0; | 928 const intptr_t kNumTemps = 0; |
894 if (operands_class_id() == kMintCid) { | 929 if (operands_class_id() == kMintCid) { |
895 const intptr_t kNumTemps = 2; | 930 const intptr_t kNumTemps = 2; |
896 LocationSummary* locs = | 931 LocationSummary* locs = |
897 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 932 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
898 locs->set_in(0, Location::RequiresFpuRegister()); | 933 locs->set_in(0, Location::RequiresFpuRegister()); |
899 locs->set_in(1, Location::RequiresFpuRegister()); | 934 locs->set_in(1, Location::RequiresFpuRegister()); |
900 locs->set_temp(0, Location::RequiresRegister()); | 935 locs->set_temp(0, Location::RequiresRegister()); |
(...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3727 bool IfThenElseInstr::IsSupported() { | 3762 bool IfThenElseInstr::IsSupported() { |
3728 return true; | 3763 return true; |
3729 } | 3764 } |
3730 | 3765 |
3731 | 3766 |
3732 bool IfThenElseInstr::Supports(ComparisonInstr* comparison, | 3767 bool IfThenElseInstr::Supports(ComparisonInstr* comparison, |
3733 Value* v1, | 3768 Value* v1, |
3734 Value* v2) { | 3769 Value* v2) { |
3735 if (!(comparison->IsStrictCompare() && | 3770 if (!(comparison->IsStrictCompare() && |
3736 !comparison->AsStrictCompare()->needs_number_check()) && | 3771 !comparison->AsStrictCompare()->needs_number_check()) && |
3737 !(comparison->IsEqualityCompare() && | 3772 !comparison->IsSmiEquality()) { |
3738 (comparison->AsEqualityCompare()->receiver_class_id() == kSmiCid))) { | |
3739 return false; | 3773 return false; |
3740 } | 3774 } |
3741 | 3775 |
3742 intptr_t v1_value, v2_value; | 3776 intptr_t v1_value, v2_value; |
3743 | 3777 |
3744 if (!BindsToSmiConstant(v1, &v1_value) || | 3778 if (!BindsToSmiConstant(v1, &v1_value) || |
3745 !BindsToSmiConstant(v2, &v2_value)) { | 3779 !BindsToSmiConstant(v2, &v2_value)) { |
3746 return false; | 3780 return false; |
3747 } | 3781 } |
3748 | 3782 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3944 PcDescriptors::kOther, | 3978 PcDescriptors::kOther, |
3945 locs()); | 3979 locs()); |
3946 __ Drop(2); // Discard type arguments and receiver. | 3980 __ Drop(2); // Discard type arguments and receiver. |
3947 } | 3981 } |
3948 | 3982 |
3949 } // namespace dart | 3983 } // namespace dart |
3950 | 3984 |
3951 #undef __ | 3985 #undef __ |
3952 | 3986 |
3953 #endif // defined TARGET_ARCH_IA32 | 3987 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |