Commit 5115bea2 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

[csa] Fix unmatching argument signedness on ComputeSeededHash

CodeStubAssembler::ComputeSeededHash is passing key as Int32 to
ComputeSeededIntegerHash, but ComputeSeededIntegerHash only accepts
Uint32 value.
This could cause problems on s390 and ppc because GCC expects any
value less than 8 bytes sign/zero-extending to 64-bits by the caller,
therefore, the static cast from uint32->uint64 will be treated as
no-op (expecting zero-ext instead), which leads to unexpected
behaviors.

Change-Id: Icd1eecaea1415e36c0c13eef513ff69cc418f247
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1940209Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#65239}
parent 5d272cf8
......@@ -7982,10 +7982,11 @@ Node* CodeStubAssembler::ComputeSeededHash(Node* key) {
MachineType type_ptr = MachineType::Pointer();
MachineType type_uint32 = MachineType::Uint32();
MachineType type_int32 = MachineType::Int32();
Node* const result = CallCFunction(
function_addr, type_uint32, std::make_pair(type_ptr, isolate_ptr),
std::make_pair(type_uint32, TruncateIntPtrToInt32(key)));
std::make_pair(type_int32, TruncateIntPtrToInt32(key)));
return result;
}
......
......@@ -628,9 +628,9 @@ static Address JSReceiverCreateIdentityHash(Isolate* isolate, Address raw_key) {
FUNCTION_REFERENCE(jsreceiver_create_identity_hash,
JSReceiverCreateIdentityHash)
static uint32_t ComputeSeededIntegerHash(Isolate* isolate, uint32_t key) {
static uint32_t ComputeSeededIntegerHash(Isolate* isolate, int32_t key) {
DisallowHeapAllocation no_gc;
return ComputeSeededHash(key, HashSeed(isolate));
return ComputeSeededHash(static_cast<uint32_t>(key), HashSeed(isolate));
}
FUNCTION_REFERENCE(compute_integer_hash, ComputeSeededIntegerHash)
......
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