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

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

Issue 2947633002: VM-codegen: Clean up the way we emit code for comparison instructions. (Closed)
Patch Set: Simplify DBC ComparisonInstr::EmitNativeCode Created 3 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
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | 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/globals.h" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 intptr_t temp = true_value; 171 intptr_t temp = true_value;
172 true_value = false_value; 172 true_value = false_value;
173 false_value = temp; 173 false_value = temp;
174 swapped = true; 174 swapped = true;
175 } 175 }
176 176
177 // Initialize result with the true value. 177 // Initialize result with the true value.
178 __ LoadImmediate(result, Smi::RawValue(true_value)); 178 __ LoadImmediate(result, Smi::RawValue(true_value));
179 179
180 // Emit comparison code. This must not overwrite the result register. 180 // Emit comparison code. This must not overwrite the result register.
181 // IfThenElseInstr::Supports() should prevent EmitComparisonCode from using
182 // the labels or returning an invalid condition.
181 BranchLabels labels = {NULL, NULL, NULL}; // Emit branch-free code. 183 BranchLabels labels = {NULL, NULL, NULL}; // Emit branch-free code.
182 Condition true_condition = comparison()->EmitComparisonCode(compiler, labels); 184 Condition true_condition = comparison()->EmitComparisonCode(compiler, labels);
185 ASSERT(true_condition.IsValid());
183 if (swapped) { 186 if (swapped) {
184 true_condition = NegateCondition(true_condition); 187 true_condition = NegateCondition(true_condition);
185 } 188 }
186 189
187 // Evaluate condition and provide result in CMPRES1. 190 // Evaluate condition and provide result in CMPRES1.
188 Register left = true_condition.left(); 191 Register left = true_condition.left();
189 Register right = true_condition.right(); 192 Register right = true_condition.right();
190 bool zero_is_false = true; // Zero in CMPRES1 indicates a false condition. 193 bool zero_is_false = true; // Zero in CMPRES1 indicates a false condition.
191 switch (true_condition.rel_op()) { 194 switch (true_condition.rel_op()) {
192 case AL: 195 case AL:
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 return EmitSmiComparisonOp(compiler, *locs(), kind()); 777 return EmitSmiComparisonOp(compiler, *locs(), kind());
775 } else if (operation_cid() == kMintCid) { 778 } else if (operation_cid() == kMintCid) {
776 return EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), labels); 779 return EmitUnboxedMintEqualityOp(compiler, *locs(), kind(), labels);
777 } else { 780 } else {
778 ASSERT(operation_cid() == kDoubleCid); 781 ASSERT(operation_cid() == kDoubleCid);
779 return EmitDoubleComparisonOp(compiler, *locs(), kind(), labels); 782 return EmitDoubleComparisonOp(compiler, *locs(), kind(), labels);
780 } 783 }
781 } 784 }
782 785
783 786
784 void EqualityCompareInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 787 void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
785 ASSERT((kind() == Token::kNE) || (kind() == Token::kEQ));
786 __ Comment("EqualityCompareInstr");
787
788 Label is_true, is_false; 788 Label is_true, is_false;
789 BranchLabels labels = {&is_true, &is_false, &is_false}; 789 BranchLabels labels = {&is_true, &is_false, &is_false};
790 Condition true_condition = EmitComparisonCode(compiler, labels); 790 Condition true_condition = EmitComparisonCode(compiler, labels);
791 EmitBranchOnCondition(compiler, true_condition, labels); 791 if (true_condition.IsValid()) {
792 EmitBranchOnCondition(compiler, true_condition, labels);
793 }
792 794
793 Register result = locs()->out(0).reg(); 795 Register result = this->locs()->out(0).reg();
794 Label done; 796 Label done;
795 __ Bind(&is_false); 797 __ Bind(&is_false);
796 __ LoadObject(result, Bool::False()); 798 __ LoadObject(result, Bool::False());
797 __ b(&done); 799 __ b(&done);
798 __ Bind(&is_true); 800 __ Bind(&is_true);
799 __ LoadObject(result, Bool::True()); 801 __ LoadObject(result, Bool::True());
800 __ Bind(&done); 802 __ Bind(&done);
801 } 803 }
802 804
803 805
804 void EqualityCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler, 806 void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler,
805 BranchInstr* branch) { 807 BranchInstr* branch) {
806 __ Comment("EqualityCompareInstr::EmitBranchCode");
807 ASSERT((kind() == Token::kNE) || (kind() == Token::kEQ));
808
809 BranchLabels labels = compiler->CreateBranchLabels(branch); 808 BranchLabels labels = compiler->CreateBranchLabels(branch);
810 Condition true_condition = EmitComparisonCode(compiler, labels); 809 Condition true_condition = EmitComparisonCode(compiler, labels);
811 EmitBranchOnCondition(compiler, true_condition, labels); 810 if (true_condition.IsValid()) {
811 EmitBranchOnCondition(compiler, true_condition, labels);
812 }
812 } 813 }
813 814
814 815
815 LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { 816 LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const {
816 const intptr_t kNumInputs = 2; 817 const intptr_t kNumInputs = 2;
817 const intptr_t kNumTemps = 0; 818 const intptr_t kNumTemps = 0;
818 LocationSummary* locs = new (zone) 819 LocationSummary* locs = new (zone)
819 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); 820 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
820 locs->set_in(0, Location::RequiresRegister()); 821 locs->set_in(0, Location::RequiresRegister());
821 // Only one input can be a constant operand. The case of two constant 822 // Only one input can be a constant operand. The case of two constant
(...skipping 11 matching lines...) Expand all
833 ASSERT(right.constant().IsSmi()); 834 ASSERT(right.constant().IsSmi());
834 const int32_t imm = reinterpret_cast<int32_t>(right.constant().raw()); 835 const int32_t imm = reinterpret_cast<int32_t>(right.constant().raw());
835 __ AndImmediate(CMPRES1, left, imm); 836 __ AndImmediate(CMPRES1, left, imm);
836 } else { 837 } else {
837 __ and_(CMPRES1, left, right.reg()); 838 __ and_(CMPRES1, left, right.reg());
838 } 839 }
839 return Condition(CMPRES1, ZR, (kind() == Token::kNE) ? NE : EQ); 840 return Condition(CMPRES1, ZR, (kind() == Token::kNE) ? NE : EQ);
840 } 841 }
841 842
842 843
843 void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
844 // Never emitted outside of the BranchInstr.
845 UNREACHABLE();
846 }
847
848
849 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
850 BranchInstr* branch) {
851 BranchLabels labels = compiler->CreateBranchLabels(branch);
852 Condition true_condition = EmitComparisonCode(compiler, labels);
853 EmitBranchOnCondition(compiler, true_condition, labels);
854 }
855
856
857 LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, 844 LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone,
858 bool opt) const { 845 bool opt) const {
859 const intptr_t kNumInputs = 1; 846 const intptr_t kNumInputs = 1;
860 const intptr_t kNumTemps = 1; 847 const intptr_t kNumTemps = 1;
861 LocationSummary* locs = new (zone) 848 LocationSummary* locs = new (zone)
862 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); 849 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
863 locs->set_in(0, Location::RequiresRegister()); 850 locs->set_in(0, Location::RequiresRegister());
864 locs->set_temp(0, Location::RequiresRegister()); 851 locs->set_temp(0, Location::RequiresRegister());
865 locs->set_out(0, Location::RequiresRegister()); 852 locs->set_out(0, Location::RequiresRegister());
866 return locs; 853 return locs;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 // If the cid is not in the list, jump to the opposite label from the cids 886 // If the cid is not in the list, jump to the opposite label from the cids
900 // that are in the list. These must be all the same (see asserts in the 887 // that are in the list. These must be all the same (see asserts in the
901 // constructor). 888 // constructor).
902 Label* target = result ? labels.false_label : labels.true_label; 889 Label* target = result ? labels.false_label : labels.true_label;
903 if (target != labels.fall_through) { 890 if (target != labels.fall_through) {
904 __ b(target); 891 __ b(target);
905 } 892 }
906 } else { 893 } else {
907 __ b(deopt); 894 __ b(deopt);
908 } 895 }
909 // Dummy result as the last instruction is a jump or fall through. 896 // Dummy result as this method already did the jump, there's no need
910 return Condition(CMPRES1, ZR, AL); 897 // for the caller to branch on a condition.
898 return Condition(ZR, ZR, INVALID_RELATION);
911 } 899 }
912 900
913 901
914 void TestCidsInstr::EmitBranchCode(FlowGraphCompiler* compiler,
915 BranchInstr* branch) {
916 BranchLabels labels = compiler->CreateBranchLabels(branch);
917 EmitComparisonCode(compiler, labels);
918 }
919
920
921 void TestCidsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
922 Register result_reg = locs()->out(0).reg();
923 Label is_true, is_false, done;
924 BranchLabels labels = {&is_true, &is_false, &is_false};
925 EmitComparisonCode(compiler, labels);
926 __ Bind(&is_false);
927 __ LoadObject(result_reg, Bool::False());
928 __ b(&done);
929 __ Bind(&is_true);
930 __ LoadObject(result_reg, Bool::True());
931 __ Bind(&done);
932 }
933
934
935 LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, 902 LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone,
936 bool opt) const { 903 bool opt) const {
937 const intptr_t kNumInputs = 2; 904 const intptr_t kNumInputs = 2;
938 const intptr_t kNumTemps = 0; 905 const intptr_t kNumTemps = 0;
939 if (operation_cid() == kMintCid) { 906 if (operation_cid() == kMintCid) {
940 const intptr_t kNumTemps = 0; 907 const intptr_t kNumTemps = 0;
941 LocationSummary* locs = new (zone) 908 LocationSummary* locs = new (zone)
942 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); 909 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
943 locs->set_in(0, Location::Pair(Location::RequiresRegister(), 910 locs->set_in(0, Location::Pair(Location::RequiresRegister(),
944 Location::RequiresRegister())); 911 Location::RequiresRegister()));
(...skipping 30 matching lines...) Expand all
975 return EmitSmiComparisonOp(compiler, *locs(), kind()); 942 return EmitSmiComparisonOp(compiler, *locs(), kind());
976 } else if (operation_cid() == kMintCid) { 943 } else if (operation_cid() == kMintCid) {
977 return EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), labels); 944 return EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), labels);
978 } else { 945 } else {
979 ASSERT(operation_cid() == kDoubleCid); 946 ASSERT(operation_cid() == kDoubleCid);
980 return EmitDoubleComparisonOp(compiler, *locs(), kind(), labels); 947 return EmitDoubleComparisonOp(compiler, *locs(), kind(), labels);
981 } 948 }
982 } 949 }
983 950
984 951
985 void RelationalOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
986 __ Comment("RelationalOpInstr");
987
988 Label is_true, is_false;
989 BranchLabels labels = {&is_true, &is_false, &is_false};
990 Condition true_condition = EmitComparisonCode(compiler, labels);
991 EmitBranchOnCondition(compiler, true_condition, labels);
992
993 Register result = locs()->out(0).reg();
994 Label done;
995 __ Bind(&is_false);
996 __ LoadObject(result, Bool::False());
997 __ b(&done);
998 __ Bind(&is_true);
999 __ LoadObject(result, Bool::True());
1000 __ Bind(&done);
1001 }
1002
1003
1004 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler,
1005 BranchInstr* branch) {
1006 __ Comment("RelationalOpInstr");
1007
1008 BranchLabels labels = compiler->CreateBranchLabels(branch);
1009 Condition true_condition = EmitComparisonCode(compiler, labels);
1010 EmitBranchOnCondition(compiler, true_condition, labels);
1011 }
1012
1013
1014 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, 952 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone,
1015 bool opt) const { 953 bool opt) const {
1016 return MakeCallSummary(zone); 954 return MakeCallSummary(zone);
1017 } 955 }
1018 956
1019 957
1020 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 958 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1021 SetupNative(); 959 SetupNative();
1022 __ Comment("NativeCallInstr"); 960 __ Comment("NativeCallInstr");
1023 Register result = locs()->out(0).reg(); 961 Register result = locs()->out(0).reg();
(...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after
3240 3178
3241 void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, 3179 void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler,
3242 BranchInstr* branch) { 3180 BranchInstr* branch) {
3243 BranchLabels labels = compiler->CreateBranchLabels(branch); 3181 BranchLabels labels = compiler->CreateBranchLabels(branch);
3244 CheckedSmiComparisonSlowPath* slow_path = new CheckedSmiComparisonSlowPath( 3182 CheckedSmiComparisonSlowPath* slow_path = new CheckedSmiComparisonSlowPath(
3245 this, compiler->CurrentTryIndex(), labels, 3183 this, compiler->CurrentTryIndex(), labels,
3246 /* merged = */ true); 3184 /* merged = */ true);
3247 compiler->AddSlowPathCode(slow_path); 3185 compiler->AddSlowPathCode(slow_path);
3248 EMIT_SMI_CHECK; 3186 EMIT_SMI_CHECK;
3249 Condition true_condition = EmitComparisonCode(compiler, labels); 3187 Condition true_condition = EmitComparisonCode(compiler, labels);
3188 ASSERT(true_condition.IsValid());
3250 EmitBranchOnCondition(compiler, true_condition, labels); 3189 EmitBranchOnCondition(compiler, true_condition, labels);
3251 __ Bind(slow_path->exit_label()); 3190 __ Bind(slow_path->exit_label());
3252 } 3191 }
3253 3192
3254 3193
3255 void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3194 void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3256 Label true_label, false_label, done; 3195 Label true_label, false_label, done;
3257 BranchLabels labels = {&true_label, &false_label, &false_label}; 3196 BranchLabels labels = {&true_label, &false_label, &false_label};
3258 CheckedSmiComparisonSlowPath* slow_path = new CheckedSmiComparisonSlowPath( 3197 CheckedSmiComparisonSlowPath* slow_path = new CheckedSmiComparisonSlowPath(
3259 this, compiler->CurrentTryIndex(), labels, 3198 this, compiler->CurrentTryIndex(), labels,
3260 /* merged = */ false); 3199 /* merged = */ false);
3261 compiler->AddSlowPathCode(slow_path); 3200 compiler->AddSlowPathCode(slow_path);
3262 EMIT_SMI_CHECK; 3201 EMIT_SMI_CHECK;
3263 Condition true_condition = EmitComparisonCode(compiler, labels); 3202 Condition true_condition = EmitComparisonCode(compiler, labels);
3203 ASSERT(true_condition.IsValid());
3264 EmitBranchOnCondition(compiler, true_condition, labels); 3204 EmitBranchOnCondition(compiler, true_condition, labels);
3265 Register result = locs()->out(0).reg(); 3205 Register result = locs()->out(0).reg();
3266 __ Bind(&false_label); 3206 __ Bind(&false_label);
3267 __ LoadObject(result, Bool::False()); 3207 __ LoadObject(result, Bool::False());
3268 __ b(&done); 3208 __ b(&done);
3269 __ Bind(&true_label); 3209 __ Bind(&true_label);
3270 __ LoadObject(result, Bool::True()); 3210 __ LoadObject(result, Bool::True());
3271 __ Bind(&done); 3211 __ Bind(&done);
3272 __ Bind(slow_path->exit_label()); 3212 __ Bind(slow_path->exit_label());
3273 } 3213 }
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
3968 __ bc1t(labels.true_label); 3908 __ bc1t(labels.true_label);
3969 } 3909 }
3970 } else { 3910 } else {
3971 if (is_negated) { 3911 if (is_negated) {
3972 __ bc1t(labels.false_label); 3912 __ bc1t(labels.false_label);
3973 } else { 3913 } else {
3974 __ bc1f(labels.false_label); 3914 __ bc1f(labels.false_label);
3975 } 3915 }
3976 __ b(labels.true_label); 3916 __ b(labels.true_label);
3977 } 3917 }
3978 return Condition(); // Unused. 3918 return Condition(ZR, ZR, INVALID_RELATION); // Unused.
3979 } else { 3919 } else {
3980 ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite); 3920 ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite);
3981 __ mfc1(CMPRES1, EvenFRegisterOf(value)); 3921 __ mfc1(CMPRES1, EvenFRegisterOf(value));
3982 // If the low word isn't zero, then it isn't infinity. 3922 // If the low word isn't zero, then it isn't infinity.
3983 __ bne(CMPRES1, ZR, is_negated ? labels.true_label : labels.false_label); 3923 __ bne(CMPRES1, ZR, is_negated ? labels.true_label : labels.false_label);
3984 __ mfc1(CMPRES1, OddFRegisterOf(value)); 3924 __ mfc1(CMPRES1, OddFRegisterOf(value));
3985 // Mask off the sign bit. 3925 // Mask off the sign bit.
3986 __ AndImmediate(CMPRES1, CMPRES1, 0x7FFFFFFF); 3926 __ AndImmediate(CMPRES1, CMPRES1, 0x7FFFFFFF);
3987 // Compare with +infinity. 3927 // Compare with +infinity.
3988 __ LoadImmediate(CMPRES2, 0x7FF00000); 3928 __ LoadImmediate(CMPRES2, 0x7FF00000);
3989 return Condition(CMPRES1, CMPRES2, is_negated ? NE : EQ); 3929 return Condition(CMPRES1, CMPRES2, is_negated ? NE : EQ);
3990 } 3930 }
3991 } 3931 }
3992 3932
3993 void DoubleTestOpInstr::EmitBranchCode(FlowGraphCompiler* compiler,
3994 BranchInstr* branch) {
3995 ASSERT(compiler->is_optimizing());
3996 BranchLabels labels = compiler->CreateBranchLabels(branch);
3997 Condition true_condition = EmitComparisonCode(compiler, labels);
3998 // Branches for isNaN are emitted in EmitComparisonCode already.
3999 if (op_kind() == MethodRecognizer::kDouble_getIsInfinite) {
4000 EmitBranchOnCondition(compiler, true_condition, labels);
4001 }
4002 }
4003
4004
4005 void DoubleTestOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4006 Label is_true, is_false;
4007 BranchLabels labels = {&is_true, &is_false, &is_false};
4008 Condition true_condition = EmitComparisonCode(compiler, labels);
4009 // Branches for isNaN are emitted in EmitComparisonCode already.
4010 if (op_kind() == MethodRecognizer::kDouble_getIsInfinite) {
4011 EmitBranchOnCondition(compiler, true_condition, labels);
4012 }
4013 const Register result = locs()->out(0).reg();
4014 Label done;
4015 __ Comment("return bool");
4016 __ Bind(&is_false);
4017 __ LoadObject(result, Bool::False());
4018 __ b(&done);
4019 __ Bind(&is_true);
4020 __ LoadObject(result, Bool::True());
4021 __ Bind(&done);
4022 }
4023
4024
4025 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, 3933 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
4026 bool opt) const { 3934 bool opt) const {
4027 UNIMPLEMENTED(); 3935 UNIMPLEMENTED();
4028 return NULL; 3936 return NULL;
4029 } 3937 }
4030 3938
4031 3939
4032 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3940 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4033 UNIMPLEMENTED(); 3941 UNIMPLEMENTED();
4034 } 3942 }
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
5979 left.reg(), right.reg(), needs_number_check(), token_pos(), deopt_id_); 5887 left.reg(), right.reg(), needs_number_check(), token_pos(), deopt_id_);
5980 } 5888 }
5981 if (kind() != Token::kEQ_STRICT) { 5889 if (kind() != Token::kEQ_STRICT) {
5982 ASSERT(kind() == Token::kNE_STRICT); 5890 ASSERT(kind() == Token::kNE_STRICT);
5983 true_condition = NegateCondition(true_condition); 5891 true_condition = NegateCondition(true_condition);
5984 } 5892 }
5985 return true_condition; 5893 return true_condition;
5986 } 5894 }
5987 5895
5988 5896
5989 void StrictCompareInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5990 __ Comment("StrictCompareInstr");
5991 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
5992
5993 Label is_true, is_false;
5994 BranchLabels labels = {&is_true, &is_false, &is_false};
5995 Condition true_condition = EmitComparisonCode(compiler, labels);
5996 EmitBranchOnCondition(compiler, true_condition, labels);
5997
5998 Register result = locs()->out(0).reg();
5999 Label done;
6000 __ Bind(&is_false);
6001 __ LoadObject(result, Bool::False());
6002 __ b(&done);
6003 __ Bind(&is_true);
6004 __ LoadObject(result, Bool::True());
6005 __ Bind(&done);
6006 }
6007
6008
6009 void StrictCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler,
6010 BranchInstr* branch) {
6011 __ Comment("StrictCompareInstr::EmitBranchCode");
6012 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
6013
6014 BranchLabels labels = compiler->CreateBranchLabels(branch);
6015 Condition true_condition = EmitComparisonCode(compiler, labels);
6016 EmitBranchOnCondition(compiler, true_condition, labels);
6017 }
6018
6019
6020 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone, 5897 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone,
6021 bool opt) const { 5898 bool opt) const {
6022 return LocationSummary::Make(zone, 1, Location::RequiresRegister(), 5899 return LocationSummary::Make(zone, 1, Location::RequiresRegister(),
6023 LocationSummary::kNoCall); 5900 LocationSummary::kNoCall);
6024 } 5901 }
6025 5902
6026 5903
6027 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5904 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6028 Register value = locs()->in(0).reg(); 5905 Register value = locs()->in(0).reg();
6029 Register result = locs()->out(0).reg(); 5906 Register result = locs()->out(0).reg();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
6084 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), 5961 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(),
6085 kGrowRegExpStackRuntimeEntry, 1, locs()); 5962 kGrowRegExpStackRuntimeEntry, 1, locs());
6086 __ lw(result, Address(SP, 1 * kWordSize)); 5963 __ lw(result, Address(SP, 1 * kWordSize));
6087 __ addiu(SP, SP, Immediate(2 * kWordSize)); 5964 __ addiu(SP, SP, Immediate(2 * kWordSize));
6088 } 5965 }
6089 5966
6090 5967
6091 } // namespace dart 5968 } // namespace dart
6092 5969
6093 #endif // defined TARGET_ARCH_MIPS 5970 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698