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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 221 } |
222 | 222 |
223 | 223 |
224 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( | 224 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( |
225 Zone* zone, bool optimizing) const { | 225 Zone* zone, bool optimizing) const { |
226 return MakeCallSummary(zone); | 226 return MakeCallSummary(zone); |
227 } | 227 } |
228 | 228 |
229 | 229 |
230 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 230 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
231 #if defined(PRODUCT) | 231 Unsupported(compiler); |
232 compiler->Bailout("PolymorphicInstanceCallInstr::EmitNativeCode"); | 232 UNREACHABLE(); |
233 #else // defined(PRODUCT) | |
234 compiler->Bailout(ToCString()); | |
235 #endif // defined(PRODUCT) | |
236 } | 233 } |
237 | 234 |
238 | 235 |
239 EMIT_NATIVE_CODE(Stop, 0) { | 236 EMIT_NATIVE_CODE(Stop, 0) { |
240 __ Stop(message()); | 237 __ Stop(message()); |
241 } | 238 } |
242 | 239 |
243 | 240 |
244 EMIT_NATIVE_CODE(CheckStackOverflow, | 241 EMIT_NATIVE_CODE(CheckStackOverflow, |
245 0, Location::NoLocation(), | 242 0, Location::NoLocation(), |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 compiler->RecordSafepoint(locs()); | 555 compiler->RecordSafepoint(locs()); |
559 if (compiler->is_optimizing()) { | 556 if (compiler->is_optimizing()) { |
560 __ PopLocal(locs()->out(0).reg()); | 557 __ PopLocal(locs()->out(0).reg()); |
561 } | 558 } |
562 } | 559 } |
563 | 560 |
564 | 561 |
565 EMIT_NATIVE_CODE(StoreIndexed, 3) { | 562 EMIT_NATIVE_CODE(StoreIndexed, 3) { |
566 if (compiler->is_optimizing()) { | 563 if (compiler->is_optimizing()) { |
567 if (class_id() != kArrayCid) { | 564 if (class_id() != kArrayCid) { |
568 #if defined(PRODUCT) | 565 Unsupported(compiler); |
569 compiler->Bailout("StoreIndexed"); | 566 UNREACHABLE(); |
570 #else // defined(PRODUCT) | |
571 compiler->Bailout(ToCString()); | |
572 #endif // defined(PRODUCT) | |
573 } | 567 } |
574 | |
575 __ StoreIndexed(locs()->in(kArrayPos).reg(), | 568 __ StoreIndexed(locs()->in(kArrayPos).reg(), |
576 locs()->in(kIndexPos).reg(), | 569 locs()->in(kIndexPos).reg(), |
577 locs()->in(kValuePos).reg()); | 570 locs()->in(kValuePos).reg()); |
578 } else { | 571 } else { |
579 ASSERT(class_id() == kArrayCid); | 572 ASSERT(class_id() == kArrayCid); |
580 __ StoreIndexedTOS(); | 573 __ StoreIndexedTOS(); |
581 } | 574 } |
582 } | 575 } |
583 | 576 |
584 | 577 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinaryDoubleOp, | 1001 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinaryDoubleOp, |
1009 licm_hoisted_ ? ICData::kHoisted : 0); | 1002 licm_hoisted_ ? ICData::kHoisted : 0); |
1010 __ CheckSmi(right); | 1003 __ CheckSmi(right); |
1011 } | 1004 } |
1012 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinaryDoubleOp, | 1005 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinaryDoubleOp, |
1013 licm_hoisted_ ? ICData::kHoisted : 0); | 1006 licm_hoisted_ ? ICData::kHoisted : 0); |
1014 } | 1007 } |
1015 | 1008 |
1016 | 1009 |
1017 EMIT_NATIVE_CODE(CheckClassId, 1) { | 1010 EMIT_NATIVE_CODE(CheckClassId, 1) { |
1018 if (!Utils::IsUint(16, cid_)) { | 1011 __ CheckClassId(locs()->in(0).reg(), |
1019 #if defined(PRODUCT) | 1012 compiler->ToEmbeddableCid(cid_, this)); |
1020 compiler->Bailout("CheckClassInstr::EmitNativeCode"); | |
1021 #else // defined(PRODUCT) | |
1022 compiler->Bailout(ToCString()); | |
1023 #endif // defined(PRODUCT) | |
1024 } | |
1025 __ CheckClassId(locs()->in(0).reg(), cid_); | |
1026 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass); | 1013 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass); |
1027 } | 1014 } |
1028 | 1015 |
1029 | 1016 |
1030 EMIT_NATIVE_CODE(CheckClass, 1) { | 1017 EMIT_NATIVE_CODE(CheckClass, 1) { |
1031 #if defined(PRODUCT) | |
1032 const char* bailout_msg = "CheckClassInstr::EmitNativeCode"; | |
1033 #else // defined(PRODUCT) | |
1034 const char* bailout_msg = ToCString(); | |
1035 #endif // defined(PRODUCT) | |
1036 const Register value = locs()->in(0).reg(); | 1018 const Register value = locs()->in(0).reg(); |
1037 if (IsNullCheck()) { | 1019 if (IsNullCheck()) { |
1038 ASSERT(DeoptIfNull() || DeoptIfNotNull()); | 1020 ASSERT(DeoptIfNull() || DeoptIfNotNull()); |
1039 if (DeoptIfNull()) { | 1021 if (DeoptIfNull()) { |
1040 __ IfEqNull(value); | 1022 __ IfEqNull(value); |
1041 } else { | 1023 } else { |
1042 __ IfNeNull(value); | 1024 __ IfNeNull(value); |
1043 } | 1025 } |
1044 } else { | 1026 } else { |
1045 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) || | 1027 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) || |
1046 (unary_checks().NumberOfChecks() > 1)); | 1028 (unary_checks().NumberOfChecks() > 1)); |
1047 const intptr_t may_be_smi = | 1029 const intptr_t may_be_smi = |
1048 (unary_checks().GetReceiverClassIdAt(0) == kSmiCid) ? 1 : 0; | 1030 (unary_checks().GetReceiverClassIdAt(0) == kSmiCid) ? 1 : 0; |
1049 if (IsDenseSwitch()) { | 1031 if (IsDenseSwitch()) { |
1050 ASSERT(cids_[0] < cids_[cids_.length() - 1]); | 1032 ASSERT(cids_[0] < cids_[cids_.length() - 1]); |
1051 const intptr_t low_cid = cids_[0]; | 1033 const intptr_t low_cid = cids_[0]; |
1052 if (!Utils::IsUint(16, low_cid)) { | |
1053 compiler->Bailout(bailout_msg); | |
1054 } | |
1055 const intptr_t cid_mask = ComputeCidMask(); | 1034 const intptr_t cid_mask = ComputeCidMask(); |
1056 __ CheckDenseSwitch(value, may_be_smi); | 1035 __ CheckDenseSwitch(value, may_be_smi); |
1057 __ Nop(low_cid); | 1036 __ Nop(compiler->ToEmbeddableCid(low_cid, this)); |
1058 __ Nop(__ AddConstant(Smi::Handle(Smi::New(cid_mask)))); | 1037 __ Nop(__ AddConstant(Smi::Handle(Smi::New(cid_mask)))); |
1059 } else { | 1038 } else { |
1060 GrowableArray<CidTarget> sorted_ic_data; | 1039 GrowableArray<CidTarget> sorted_ic_data; |
1061 FlowGraphCompiler::SortICDataByCount(unary_checks(), | 1040 FlowGraphCompiler::SortICDataByCount(unary_checks(), |
1062 &sorted_ic_data, | 1041 &sorted_ic_data, |
1063 /* drop_smi = */ true); | 1042 /* drop_smi = */ true); |
1064 const intptr_t sorted_length = sorted_ic_data.length(); | 1043 const intptr_t sorted_length = sorted_ic_data.length(); |
1065 ASSERT(sorted_length >= 1); | 1044 if (!Utils::IsUint(8, sorted_length)) { |
1066 if (sorted_length == 1) { | 1045 Unsupported(compiler); |
1067 const intptr_t cid = sorted_ic_data[0].cid; | 1046 UNREACHABLE(); |
1068 if (!Utils::IsUint(16, cid)) { | 1047 } |
1069 compiler->Bailout(bailout_msg); | 1048 __ CheckCids(value, may_be_smi, sorted_length); |
1070 } | 1049 for (intptr_t i = 0; i < sorted_length; i++) { |
1071 __ CheckClassId(value, cid); | 1050 __ Nop(compiler->ToEmbeddableCid(sorted_ic_data[i].cid, this)); |
1072 } else { | |
1073 if (!Utils::IsUint(8, sorted_length)) { | |
1074 compiler->Bailout(bailout_msg); | |
1075 } | |
1076 __ CheckCids(value, may_be_smi, sorted_length); | |
1077 for (intptr_t i = 0; i < sorted_length; i++) { | |
1078 const intptr_t cid = sorted_ic_data[i].cid; | |
1079 if (!Utils::IsUint(16, cid)) { | |
1080 compiler->Bailout(bailout_msg); | |
1081 } | |
1082 __ Nop(cid); | |
1083 } | |
1084 } | 1051 } |
1085 } | 1052 } |
1086 } | 1053 } |
1087 compiler->EmitDeopt(deopt_id(), | 1054 compiler->EmitDeopt(deopt_id(), |
1088 ICData::kDeoptCheckClass, | 1055 ICData::kDeoptCheckClass, |
1089 licm_hoisted_ ? ICData::kHoisted : 0); | 1056 licm_hoisted_ ? ICData::kHoisted : 0); |
1090 } | 1057 } |
1091 | 1058 |
1092 | 1059 |
1093 EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) { | 1060 EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 __ BitNot(locs()->out(0).reg(), locs()->in(0).reg()); | 1126 __ BitNot(locs()->out(0).reg(), locs()->in(0).reg()); |
1160 break; | 1127 break; |
1161 default: | 1128 default: |
1162 UNREACHABLE(); | 1129 UNREACHABLE(); |
1163 } | 1130 } |
1164 } | 1131 } |
1165 | 1132 |
1166 } // namespace dart | 1133 } // namespace dart |
1167 | 1134 |
1168 #endif // defined TARGET_ARCH_DBC | 1135 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |