[maglev] Fix missing truncation for Int32 Smi ops

We were truncating Number inputs for identity bitwise Int32 Smi ops, but
forgot to truncate Int32 ones (in particular, those with Uint32 inputs).

Bug: v8:7700
Change-Id: Ifda802d0e0030f0102201550eca05d3f0f9bd475
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4025984
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84252}
This commit is contained in:
Leszek Swirski 2022-11-14 18:06:27 +01:00 committed by V8 LUCI CQ
parent d7b4e86f9e
commit 8b06794a1a

View File

@ -575,7 +575,11 @@ void MaglevGraphBuilder::BuildInt32BinarySmiOperationNode() {
int32_t constant = iterator_.GetImmediateOperand(0);
if (base::Optional<int>(constant) == Int32Identity<kOperation>()) {
// If the constant is the unit of the operation, it already has the right
// value, so just return.
// value, so use the truncated value if necessary (and if not just a
// conversion) and return.
if (inputs_are_truncated && !left->properties().is_conversion()) {
current_interpreter_frame_.set_accumulator(left);
}
return;
}
if (ValueNode* result =