502 {
505 const BinaryFeedback& binary_feedback =
call->BinaryFeedback();
506 switch (op_kind) {
507 case Token::kADD:
508 case Token::kSUB:
509 case Token::kMUL:
510 if (binary_feedback.OperandsAre(kSmiCid)) {
511
512
513 operands_type =
514 call->ic_data()->HasDeoptReason(ICData::kDeoptBinarySmiOp)
515 ? kMintCid
516 : kSmiCid;
517 } else if (binary_feedback.OperandsAreSmiOrMint()) {
518
519
520 if (
call->ic_data()->HasDeoptReason(ICData::kDeoptBinaryInt64Op))
521 return false;
522 operands_type = kMintCid;
524 operands_type = kDoubleCid;
525 } else if (binary_feedback.OperandsAre(kFloat32x4Cid)) {
526 operands_type = kFloat32x4Cid;
527 } else if (binary_feedback.OperandsAre(kInt32x4Cid)) {
528 ASSERT(op_kind != Token::kMUL);
529 operands_type = kInt32x4Cid;
530 } else if (binary_feedback.OperandsAre(kFloat64x2Cid)) {
531 operands_type = kFloat64x2Cid;
532 } else {
533 return false;
534 }
535 break;
536 case Token::kDIV:
538 binary_feedback.OperandsAre(kSmiCid)) {
539 operands_type = kDoubleCid;
540 } else if (binary_feedback.OperandsAre(kFloat32x4Cid)) {
541 operands_type = kFloat32x4Cid;
542 } else if (binary_feedback.OperandsAre(kFloat64x2Cid)) {
543 operands_type = kFloat64x2Cid;
544 } else {
545 return false;
546 }
547 break;
548 case Token::kBIT_AND:
549 case Token::kBIT_OR:
550 case Token::kBIT_XOR:
551 if (binary_feedback.OperandsAre(kSmiCid)) {
552 operands_type = kSmiCid;
553 } else if (binary_feedback.OperandsAreSmiOrMint()) {
554 operands_type = kMintCid;
555 } else if (binary_feedback.OperandsAre(kInt32x4Cid)) {
556 operands_type = kInt32x4Cid;
557 } else {
558 return false;
559 }
560 break;
561 case Token::kSHL:
562 case Token::kSHR:
563 case Token::kUSHR:
564 if (binary_feedback.OperandsAre(kSmiCid)) {
565
566
567
568 if (
call->ic_data()->HasDeoptReason(ICData::kDeoptBinaryInt64Op)) {
569 return false;
570 }
571 operands_type =
572 call->ic_data()->HasDeoptReason(ICData::kDeoptBinarySmiOp)
573 ? kMintCid
574 : kSmiCid;
575 } else if (binary_feedback.OperandsAreSmiOrMint() &&
576 binary_feedback.ArgumentIs(kSmiCid)) {
577
578
579 if (
call->ic_data()->HasDeoptReason(ICData::kDeoptBinaryInt64Op)) {
580 return false;
581 }
582
583 operands_type = kMintCid;
584 } else {
585 return false;
586 }
587 break;
588 case Token::kMOD:
589 case Token::kTRUNCDIV:
590 if (binary_feedback.OperandsAre(kSmiCid)) {
591 if (
call->ic_data()->HasDeoptReason(ICData::kDeoptBinarySmiOp)) {
592 return false;
593 }
594 operands_type = kSmiCid;
595 } else {
596 return false;
597 }
598 break;
599 default:
601 }
602
605 Definition*
left =
call->ArgumentAt(0);
607 if (operands_type == kDoubleCid) {
609 return false;
610 }
611
612
613
614 if (op_kind != Token::kDIV) {
616 call,
617 new (
Z) CheckEitherNonSmiInstr(
620 }
621
622 BinaryDoubleOpInstr* double_bin_op =
new (
Z)
626 } else if (operands_type == kMintCid) {
627 if ((op_kind == Token::kSHL) || (op_kind == Token::kSHR) ||
628 (op_kind == Token::kUSHR)) {
629 SpeculativeShiftInt64OpInstr* shift_op =
new (
Z)
630 SpeculativeShiftInt64OpInstr(op_kind,
new (
Z)
Value(
left),
633 } else {
634 BinaryInt64OpInstr* bin_op =
new (
Z) BinaryInt64OpInstr(
637 }
638 } else if ((operands_type == kFloat32x4Cid) ||
639 (operands_type == kInt32x4Cid) ||
640 (operands_type == kFloat64x2Cid)) {
641 return InlineSimdBinaryOp(call, operands_type, op_kind);
642 } else if (op_kind == Token::kMOD) {
643 ASSERT(operands_type == kSmiCid);
644 if (
right->IsConstant()) {
645 const Object& obj =
right->AsConstant()->value();
647
648
655 BinarySmiOpInstr* bin_op =
656 new (
Z) BinarySmiOpInstr(Token::kBIT_AND,
new (
Z)
Value(
left),
659 return true;
660 }
661 }
662
663
666 BinarySmiOpInstr* bin_op =
new (
Z) BinarySmiOpInstr(
669 } else {
670 ASSERT(operands_type == kSmiCid);
671
672
675 if (
left->IsConstant() &&
676 ((op_kind == Token::kADD) || (op_kind == Token::kMUL))) {
677
678 Definition* temp =
left;
681 }
682 BinarySmiOpInstr* bin_op =
new (
Z) BinarySmiOpInstr(
685 }
686 return true;
687}
static bool right(const SkPoint &p0, const SkPoint &p1)
static constexpr bool IsPowerOfTwo(T x)
static bool ShouldSpecializeForDouble(const BinaryFeedback &binary_feedback)