Commit 5b1c0c2b authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

[compiler] Fix endianness issue when reading HeapNumber

The value needs to be assembled in correct order depending
on the machine endianness.

Bug: v8:7790
Change-Id: I247ce97486721b846ea77de1f075f32c089537ed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2878296Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#74467}
parent e9a2ec8b
......@@ -26,10 +26,17 @@ uint64_t HeapNumber::value_as_bits() const {
}
uint64_t HeapNumber::value_as_bits_relaxed() const {
#if defined(V8_TARGET_BIG_ENDIAN)
return (static_cast<uint64_t>(RELAXED_READ_UINT32_FIELD(*this, kValueOffset))
<< 32) |
static_cast<uint64_t>(
RELAXED_READ_UINT32_FIELD(*this, kValueOffset + kUInt32Size));
#else
return static_cast<uint64_t>(RELAXED_READ_UINT32_FIELD(*this, kValueOffset)) |
(static_cast<uint64_t>(
RELAXED_READ_UINT32_FIELD(*this, kValueOffset + kUInt32Size))
<< 32);
#endif
}
void HeapNumber::set_value_as_bits(uint64_t bits) {
......
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