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

heap: fix endianness issue with PopulateEmbedderDataSnapshot

Need to reverse the index on big endian platforms due to
this previous change: https://crrev.com/c/1508572

Change-Id: I12e0230d929f5f16ecd2300a49970f92b0d3be50
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3402363Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#78699}
parent 0a6c1a77
......@@ -207,11 +207,17 @@ void EmbedderDataSlot::PopulateEmbedderDataSnapshot(
const Address field_base =
FIELD_ADDR(js_object, js_object.GetEmbedderFieldOffset(entry_index));
reinterpret_cast<AtomicTagged_t*>(&snapshot)[0] =
#if defined(V8_TARGET_BIG_ENDIAN) && defined(V8_COMPRESS_POINTERS)
const int index = 1;
#else
const int index = 0;
#endif
reinterpret_cast<AtomicTagged_t*>(&snapshot)[index] =
AsAtomicTagged::Relaxed_Load(
reinterpret_cast<AtomicTagged_t*>(field_base + kTaggedPayloadOffset));
#ifdef V8_COMPRESS_POINTERS
reinterpret_cast<AtomicTagged_t*>(&snapshot)[1] =
reinterpret_cast<AtomicTagged_t*>(&snapshot)[1 - index] =
AsAtomicTagged::Relaxed_Load(
reinterpret_cast<AtomicTagged_t*>(field_base + kRawPayloadOffset));
#endif // V8_COMPRESS_POINTERS
......
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