OLD | NEW |
---|---|
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_DBC. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC. |
6 #if defined(TARGET_ARCH_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 M(ExtractNthOutput) \ | 101 M(ExtractNthOutput) \ |
102 M(BinaryUint32Op) \ | 102 M(BinaryUint32Op) \ |
103 M(ShiftUint32Op) \ | 103 M(ShiftUint32Op) \ |
104 M(UnaryUint32Op) \ | 104 M(UnaryUint32Op) \ |
105 M(UnboxedIntConverter) \ | 105 M(UnboxedIntConverter) \ |
106 M(GrowRegExpStack) \ | 106 M(GrowRegExpStack) \ |
107 M(BoxInteger32) \ | 107 M(BoxInteger32) \ |
108 M(UnboxInteger32) \ | 108 M(UnboxInteger32) \ |
109 M(CheckedSmiOp) \ | 109 M(CheckedSmiOp) \ |
110 M(CheckArrayBound) \ | 110 M(CheckArrayBound) \ |
111 M(CheckClassId) \ | |
112 M(CheckClass) \ | 111 M(CheckClass) \ |
113 M(BinarySmiOp) \ | |
114 M(TestSmi) \ | 112 M(TestSmi) \ |
115 M(RelationalOp) \ | 113 M(RelationalOp) \ |
116 M(EqualityCompare) \ | 114 M(EqualityCompare) \ |
117 M(LoadIndexed) | 115 M(LoadIndexed) |
118 | 116 |
119 // Location summaries actually are not used by the unoptimizing DBC compiler | 117 // Location summaries actually are not used by the unoptimizing DBC compiler |
120 // because we don't allocate any registers. | 118 // because we don't allocate any registers. |
121 static LocationSummary* CreateLocationSummary( | 119 static LocationSummary* CreateLocationSummary( |
122 Zone* zone, | 120 Zone* zone, |
123 intptr_t num_inputs, | 121 intptr_t num_inputs, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 FOR_EACH_UNIMPLEMENTED_INSTRUCTION(DEFINE_UNIMPLEMENTED) | 175 FOR_EACH_UNIMPLEMENTED_INSTRUCTION(DEFINE_UNIMPLEMENTED) |
178 | 176 |
179 #undef DEFINE_UNIMPLEMENTED | 177 #undef DEFINE_UNIMPLEMENTED |
180 | 178 |
181 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(TestCids) | 179 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(TestCids) |
182 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(TestSmi) | 180 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(TestSmi) |
183 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(RelationalOp) | 181 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(RelationalOp) |
184 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(EqualityCompare) | 182 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(EqualityCompare) |
185 | 183 |
186 | 184 |
187 DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 2, Location::SameAsFirstInput()); | 185 DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 2, |
186 Location::RequiresRegister(), | |
187 LocationSummary::kCall); | |
188 | 188 |
189 | 189 |
190 EMIT_NATIVE_CODE(AssertBoolean, | 190 EMIT_NATIVE_CODE(AssertBoolean, |
191 1, Location::SameAsFirstInput(), | 191 1, Location::SameAsFirstInput(), |
192 LocationSummary::kCall) { | 192 LocationSummary::kCall) { |
193 if (compiler->is_optimizing()) { | 193 if (compiler->is_optimizing()) { |
194 __ Push(locs()->in(0).reg()); | 194 __ Push(locs()->in(0).reg()); |
195 } | 195 } |
196 __ AssertBoolean(Isolate::Current()->type_checks() ? 1 : 0); | 196 __ AssertBoolean(Isolate::Current()->type_checks() ? 1 : 0); |
197 compiler->RecordSafepoint(locs()); | 197 compiler->RecordSafepoint(locs()); |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
906 } | 906 } |
907 | 907 |
908 | 908 |
909 EMIT_NATIVE_CODE(CheckSmi, 1) { | 909 EMIT_NATIVE_CODE(CheckSmi, 1) { |
910 __ CheckSmi(locs()->in(0).reg()); | 910 __ CheckSmi(locs()->in(0).reg()); |
911 compiler->EmitDeopt(deopt_id(), | 911 compiler->EmitDeopt(deopt_id(), |
912 ICData::kDeoptCheckSmi, | 912 ICData::kDeoptCheckSmi, |
913 licm_hoisted_ ? ICData::kHoisted : 0); | 913 licm_hoisted_ ? ICData::kHoisted : 0); |
914 } | 914 } |
915 | 915 |
916 | |
917 EMIT_NATIVE_CODE(CheckClassId, 1) { | |
918 __ Push(locs()->in(0).reg()); | |
Vyacheslav Egorov (Google)
2016/06/16 08:31:53
CheckClassId should also probably be a single inst
| |
919 __ PushConstant(Smi::Handle(Smi::New(cid_))); | |
920 __ IfNeStrictTOS(); | |
921 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass); | |
922 } | |
923 | |
924 | |
925 EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) { | |
926 const Register left = locs()->in(0).reg(); | |
927 const Register right = locs()->in(1).reg(); | |
928 const Register out = locs()->out(0).reg(); | |
929 const bool can_deopt = CanDeoptimize(); | |
930 bool needs_nop = false; | |
931 switch (op_kind()) { | |
932 case Token::kADD: | |
933 __ Add(out, left, right); | |
934 needs_nop = true; | |
935 break; | |
936 case Token::kSUB: | |
937 __ Sub(out, left, right); | |
938 needs_nop = true; | |
939 break; | |
940 case Token::kMUL: | |
941 __ Mul(out, left, right); | |
942 needs_nop = true; | |
943 break; | |
944 case Token::kTRUNCDIV: | |
945 ASSERT(can_deopt); | |
946 __ Div(out, left, right); | |
947 break; | |
948 case Token::kBIT_AND: | |
949 ASSERT(!can_deopt); | |
950 __ BitAnd(out, left, right); | |
951 break; | |
952 case Token::kBIT_OR: | |
953 ASSERT(!can_deopt); | |
954 __ BitOr(out, left, right); | |
955 break; | |
956 case Token::kBIT_XOR: | |
957 ASSERT(!can_deopt); | |
958 __ BitXor(out, left, right); | |
959 break; | |
960 case Token::kMOD: | |
961 __ Mod(out, left, right); | |
962 needs_nop = true; | |
963 break; | |
964 case Token::kSHR: | |
965 __ Shr(out, left, right); | |
966 needs_nop = true; | |
967 break; | |
968 case Token::kSHL: | |
969 __ Shl(out, left, right); | |
970 needs_nop = true; | |
971 break; | |
972 default: | |
973 UNREACHABLE(); | |
974 } | |
975 if (can_deopt) { | |
976 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinarySmiOp); | |
977 } else if (needs_nop) { | |
978 __ Nop(); | |
979 } | |
980 } | |
981 | |
916 } // namespace dart | 982 } // namespace dart |
917 | 983 |
918 #endif // defined TARGET_ARCH_DBC | 984 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |