mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:00:09 +00:00
[vm/aot] Remove heuristic selection of checked Smi operations
TEST=existing tests Change-Id: Id1fb01d6efa51e272636f54595393cebab3d45b4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191760 Reviewed-by: Vyacheslav Egorov <vegorov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
97daca81be
commit
320ad6adb4
|
@ -224,33 +224,6 @@ bool AotCallSpecializer::TryReplaceWithHaveSameRuntimeType(
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool HasLikelySmiOperand(InstanceCallInstr* instr) {
|
||||
ASSERT(instr->type_args_len() == 0);
|
||||
|
||||
// If Smi is not assignable to the interface target of the call, the receiver
|
||||
// is definitely not a Smi.
|
||||
if (!instr->CanReceiverBeSmiBasedOnInterfaceTarget(
|
||||
Thread::Current()->zone())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Phis with at least one known smi are // guessed to be likely smi as well.
|
||||
for (intptr_t i = 0; i < instr->ArgumentCount(); ++i) {
|
||||
PhiInstr* phi = instr->ArgumentAt(i)->AsPhi();
|
||||
if (phi != NULL) {
|
||||
for (intptr_t j = 0; j < phi->InputCount(); ++j) {
|
||||
if (phi->InputAt(j)->Type()->ToCid() == kSmiCid) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If all of the inputs are known smis or the result of CheckedSmiOp,
|
||||
// we guess the operand to be likely smi.
|
||||
for (intptr_t i = 0; i < instr->ArgumentCount(); ++i) {
|
||||
if (!instr->ArgumentAt(i)->IsCheckedSmiOp()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AotCallSpecializer::TryInlineFieldAccess(InstanceCallInstr* call) {
|
||||
const Token::Kind op_kind = call->token_kind();
|
||||
if ((op_kind == Token::kGET) && TryInlineInstanceGetter(call)) {
|
||||
|
@ -798,53 +771,6 @@ void AotCallSpecializer::VisitInstanceCall(InstanceCallInstr* instr) {
|
|||
}
|
||||
}
|
||||
|
||||
switch (instr->token_kind()) {
|
||||
case Token::kEQ:
|
||||
case Token::kNE:
|
||||
case Token::kLT:
|
||||
case Token::kLTE:
|
||||
case Token::kGT:
|
||||
case Token::kGTE: {
|
||||
if (instr->BinaryFeedback().OperandsAre(kSmiCid) ||
|
||||
HasLikelySmiOperand(instr)) {
|
||||
ASSERT(receiver_idx == 0);
|
||||
Definition* left = instr->ArgumentAt(0);
|
||||
Definition* right = instr->ArgumentAt(1);
|
||||
CheckedSmiComparisonInstr* smi_op = new (Z)
|
||||
CheckedSmiComparisonInstr(instr->token_kind(), new (Z) Value(left),
|
||||
new (Z) Value(right), instr);
|
||||
ReplaceCall(instr, smi_op);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Token::kSHL:
|
||||
case Token::kSHR:
|
||||
case Token::kUSHR:
|
||||
case Token::kBIT_OR:
|
||||
case Token::kBIT_XOR:
|
||||
case Token::kBIT_AND:
|
||||
case Token::kADD:
|
||||
case Token::kSUB:
|
||||
case Token::kMUL: {
|
||||
if (instr->BinaryFeedback().OperandsAre(kSmiCid) ||
|
||||
HasLikelySmiOperand(instr)) {
|
||||
ASSERT(receiver_idx == 0);
|
||||
Definition* left = instr->ArgumentAt(0);
|
||||
Definition* right = instr->ArgumentAt(1);
|
||||
CheckedSmiOpInstr* smi_op =
|
||||
new (Z) CheckedSmiOpInstr(instr->token_kind(), new (Z) Value(left),
|
||||
new (Z) Value(right), instr);
|
||||
|
||||
ReplaceCall(instr, smi_op);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// No IC data checks. Try resolve target using the propagated cid.
|
||||
const intptr_t receiver_cid =
|
||||
instr->ArgumentValueAt(receiver_idx)->Type()->ToCid();
|
||||
|
|
|
@ -208,8 +208,6 @@ ISOLATE_UNIT_TEST_CASE(IRTest_TypedDataAOT_FunctionalGetSet) {
|
|||
kMatchAndMoveLoadIndexed,
|
||||
kMoveGlob,
|
||||
// Store 1
|
||||
kMatchAndMoveGenericCheckBound,
|
||||
kMoveGlob,
|
||||
kMoveParallelMoves,
|
||||
kMatchAndMoveLoadUntagged,
|
||||
kMoveParallelMoves,
|
||||
|
@ -253,8 +251,6 @@ ISOLATE_UNIT_TEST_CASE(IRTest_TypedDataAOT_FunctionalGetSet) {
|
|||
kMatchAndMoveLoadIndexed,
|
||||
kMoveGlob,
|
||||
// Store 1
|
||||
kMatchAndMoveGenericCheckBound,
|
||||
kMoveGlob,
|
||||
kMoveParallelMoves,
|
||||
kMatchAndMoveLoadUntagged,
|
||||
kMoveParallelMoves,
|
||||
|
|
|
@ -111,16 +111,7 @@ bool CallSpecializer::TryCreateICData(InstanceCallInstr* call) {
|
|||
}
|
||||
|
||||
const Token::Kind op_kind = call->token_kind();
|
||||
if (FLAG_guess_icdata_cid) {
|
||||
if (CompilerState::Current().is_aot()) {
|
||||
// In precompiler speculate that both sides of bitwise operation
|
||||
// are Smi-s.
|
||||
if (Token::IsBinaryBitwiseOperator(op_kind) &&
|
||||
call->CanReceiverBeSmiBasedOnInterfaceTarget(zone())) {
|
||||
class_ids[0] = kSmiCid;
|
||||
class_ids[1] = kSmiCid;
|
||||
}
|
||||
}
|
||||
if (FLAG_guess_icdata_cid && !CompilerState::Current().is_aot()) {
|
||||
if (Token::IsRelationalOperator(op_kind) ||
|
||||
Token::IsEqualityOperator(op_kind) ||
|
||||
Token::IsBinaryOperator(op_kind)) {
|
||||
|
|
Loading…
Reference in a new issue