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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 | 245 |
246 // Push the target onto the stack. | 246 // Push the target onto the stack. |
247 if (with_checks()) { | 247 if (with_checks()) { |
248 const intptr_t length = targets_.length(); | 248 const intptr_t length = targets_.length(); |
249 if (!Utils::IsUint(8, length)) { | 249 if (!Utils::IsUint(8, length)) { |
250 Unsupported(compiler); | 250 Unsupported(compiler); |
251 UNREACHABLE(); | 251 UNREACHABLE(); |
252 } | 252 } |
253 bool using_ranges = false; | 253 bool using_ranges = false; |
254 for (intptr_t i = 0; i < length; i++) { | 254 for (intptr_t i = 0; i < length; i++) { |
255 if (targets_[i].cid_start != targets_[i].cid_end) { | 255 if (!targets_[i].IsSingleCid()) { |
256 using_ranges = true; | 256 using_ranges = true; |
257 break; | 257 break; |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 if (using_ranges) { | 261 if (using_ranges) { |
262 __ PushPolymorphicInstanceCallByRange(instance_call()->ArgumentCount(), | 262 __ PushPolymorphicInstanceCallByRange(instance_call()->ArgumentCount(), |
263 length); | 263 length); |
264 } else { | 264 } else { |
265 __ PushPolymorphicInstanceCall(instance_call()->ArgumentCount(), length); | 265 __ PushPolymorphicInstanceCall(instance_call()->ArgumentCount(), length); |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1483 EMIT_NATIVE_CODE(CheckEitherNonSmi, 2) { | 1483 EMIT_NATIVE_CODE(CheckEitherNonSmi, 2) { |
1484 const Register left = locs()->in(0).reg(); | 1484 const Register left = locs()->in(0).reg(); |
1485 const Register right = locs()->in(1).reg(); | 1485 const Register right = locs()->in(1).reg(); |
1486 __ CheckEitherNonSmi(left, right); | 1486 __ CheckEitherNonSmi(left, right); |
1487 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinaryDoubleOp, | 1487 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinaryDoubleOp, |
1488 licm_hoisted_ ? ICData::kHoisted : 0); | 1488 licm_hoisted_ ? ICData::kHoisted : 0); |
1489 } | 1489 } |
1490 | 1490 |
1491 | 1491 |
1492 EMIT_NATIVE_CODE(CheckClassId, 1) { | 1492 EMIT_NATIVE_CODE(CheckClassId, 1) { |
1493 __ CheckClassId(locs()->in(0).reg(), compiler->ToEmbeddableCid(cid_, this)); | 1493 if (cids_.IsSingleCid()) { |
1494 __ CheckClassId(locs()->in(0).reg(), | |
1495 compiler->ToEmbeddableCid(cids_.cid_start, this)); | |
1496 } else { | |
1497 __ CheckClassIdRange(locs()->in(0).reg(), | |
1498 compiler->ToEmbeddableCid(cids_.cid_start, this), | |
1499 compiler->ToEmbeddableCid(cids_.cid_end, this)); | |
kustermann
2017/05/18 09:59:45
Please ASSERT that the range is within [0, 255] he
erikcorry
2017/05/18 14:25:30
Nice catch, this was wrong, fixed with a double DB
| |
1500 } | |
1494 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass); | 1501 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass); |
1495 } | 1502 } |
1496 | 1503 |
1497 | 1504 |
1498 EMIT_NATIVE_CODE(CheckClass, 1) { | 1505 EMIT_NATIVE_CODE(CheckClass, 1) { |
1499 const Register value = locs()->in(0).reg(); | 1506 const Register value = locs()->in(0).reg(); |
1500 if (IsNullCheck()) { | 1507 if (IsNullCheck()) { |
1501 ASSERT(IsDeoptIfNull() || IsDeoptIfNotNull()); | 1508 ASSERT(IsDeoptIfNull() || IsDeoptIfNotNull()); |
1502 if (IsDeoptIfNull()) { | 1509 if (IsDeoptIfNull()) { |
1503 __ IfEqNull(value); | 1510 __ IfEqNull(value); |
(...skipping 12 matching lines...) Expand all Loading... | |
1516 if (is_bit_test) { | 1523 if (is_bit_test) { |
1517 intptr_t min = cids_.ComputeLowestCid(); | 1524 intptr_t min = cids_.ComputeLowestCid(); |
1518 __ CheckBitTest(value, may_be_smi); | 1525 __ CheckBitTest(value, may_be_smi); |
1519 __ Nop(compiler->ToEmbeddableCid(min, this)); | 1526 __ Nop(compiler->ToEmbeddableCid(min, this)); |
1520 __ Nop(__ AddConstant(Smi::Handle(Smi::New(cid_mask)))); | 1527 __ Nop(__ AddConstant(Smi::Handle(Smi::New(cid_mask)))); |
1521 } else { | 1528 } else { |
1522 bool using_ranges = false; | 1529 bool using_ranges = false; |
1523 int smi_adjustment = 0; | 1530 int smi_adjustment = 0; |
1524 int length = cids_.length(); | 1531 int length = cids_.length(); |
1525 for (intptr_t i = 0; i < length; i++) { | 1532 for (intptr_t i = 0; i < length; i++) { |
1526 if (cids_[i].cid_start != cids_[i].cid_end) { | 1533 if (!cids_[i].IsSingleCid()) { |
1527 using_ranges = true; | 1534 using_ranges = true; |
1528 } else if (cids_[i].cid_start == kSmiCid) { | 1535 } else if (cids_[i].cid_start == kSmiCid) { |
1529 ASSERT(cids_[i].cid_end == kSmiCid); // We are in the else clause. | 1536 ASSERT(cids_[i].cid_end == kSmiCid); // We are in the else clause. |
1530 ASSERT(smi_adjustment == 0); | 1537 ASSERT(smi_adjustment == 0); |
1531 smi_adjustment = 1; | 1538 smi_adjustment = 1; |
1532 } | 1539 } |
1533 } | 1540 } |
1534 | 1541 |
1535 if (!Utils::IsUint(8, length)) { | 1542 if (!Utils::IsUint(8, length)) { |
1536 Unsupported(compiler); | 1543 Unsupported(compiler); |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2083 } | 2090 } |
2084 __ IfULe(length, index); | 2091 __ IfULe(length, index); |
2085 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound, | 2092 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound, |
2086 (generalized_ ? ICData::kGeneralized : 0) | | 2093 (generalized_ ? ICData::kGeneralized : 0) | |
2087 (licm_hoisted_ ? ICData::kHoisted : 0)); | 2094 (licm_hoisted_ ? ICData::kHoisted : 0)); |
2088 } | 2095 } |
2089 | 2096 |
2090 } // namespace dart | 2097 } // namespace dart |
2091 | 2098 |
2092 #endif // defined TARGET_ARCH_DBC | 2099 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |