Commit ab2ebc29 authored by Nico Hartmann's avatar Nico Hartmann Committed by Commit Bot

[turbofan] Fix representation changing for bigints

RepresentationChanger::GetTaggedPointerRepresentation did not handle
kCompressed cases correctly for BigInts. This led to a crash of BigInt
benchmarks in js-perf-test.

Bug: v8:9407
Change-Id: Id1d60a81afc528c8d4180bd5de9d237f2f0abd0a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1701848Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62718}
parent fd1a211c
......@@ -473,7 +473,20 @@ Node* RepresentationChanger::GetTaggedPointerRepresentationFor(
}
op = simplified()->CheckBigInt(use_info.feedback());
} else if (output_rep == MachineRepresentation::kCompressedPointer) {
if (use_info.type_check() == TypeCheckKind::kBigInt &&
!output_type.Is(Type::BigInt())) {
node = InsertChangeCompressedToTagged(node);
op = simplified()->CheckBigInt(use_info.feedback());
} else {
op = machine()->ChangeCompressedPointerToTaggedPointer();
}
} else if (output_rep == MachineRepresentation::kCompressed &&
output_type.Is(Type::BigInt())) {
op = machine()->ChangeCompressedPointerToTaggedPointer();
} else if (output_rep == MachineRepresentation::kCompressed &&
use_info.type_check() == TypeCheckKind::kBigInt) {
node = InsertChangeCompressedToTagged(node);
op = simplified()->CheckBigInt(use_info.feedback());
} else if (CanBeCompressedSigned(output_rep) &&
use_info.type_check() == TypeCheckKind::kHeapObject) {
if (!output_type.Maybe(Type::SignedSmall())) {
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --opt
{
let a = 0n;
a = 3n;
function TestAdd() {
let sum = 0n;
for (let i = 0; i < 3; ++i) {
sum = a + sum;
}
return sum;
}
%PrepareFunctionForOptimization(TestAdd);
TestAdd();
TestAdd();
%OptimizeFunctionOnNextCall(TestAdd);
TestAdd();
TestAdd();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment