3438 {
3439 if (!HasUses()) return nullptr;
3440
3441
3442 if (
auto constant =
value()->definition()->AsConstant()) {
3443 if (
from() != kUntagged &&
to() != kUntagged &&
3444 constant->representation() ==
from() && constant->value().IsInteger()) {
3445 const int64_t
value = Integer::Cast(constant->value()).AsInt64Value();
3450 box ^= box.Canonicalize(flow_graph->thread());
3451 return flow_graph->GetConstant(box,
to());
3452 }
3453 }
3454 }
3455
3456
3458 if ((first_converter != nullptr) &&
3459 (first_converter->representation() ==
from())) {
3461
3462 auto src_defn = first_converter->value()->definition();
3463 if (intermediate_rep == kUntagged) {
3464
3465
3466 }
else if (!
Range::Fits(src_defn->range(), intermediate_rep)) {
3467 return this;
3468 }
3469
3470
3471
3472 if (first_converter->from() ==
to()) {
3473 return src_defn;
3474 }
3475
3476
3477
3478
3479 if ((first_converter->from() == kUntagged) || (
to() == kUntagged)) {
3480 return this;
3481 }
3482
3485 first_converter->value()->CopyWithType(),
3486 (
to() == kUnboxedInt32) ? GetDeoptId() : DeoptId::
kNone);
3489 }
3492 }
3493
3495 if (unbox_defn !=
nullptr && (
from() == kUnboxedInt64) &&
3496 (
to() == kUnboxedInt32) && unbox_defn->HasOnlyInputUse(
value())) {
3497
3498
3499
3500 Definition* replacement =
3502 : UnboxInt32Instr::kNoTruncation,
3503 unbox_defn->
value()->CopyWithType(), GetDeoptId());
3505 return replacement;
3506 }
3507
3508 return this;
3509}
static int64_t TruncateTo(int64_t v, Representation r)
void InsertBefore(Instruction *next)
virtual Representation representation() const
IntConverterInstr(Representation from, Representation to, Value *value, intptr_t deopt_id)
virtual Representation representation() const
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
bool Fits(RangeBoundary::RangeSize size) const
static constexpr const char * kNone