Commit 642828eb authored by Manos Koukoutos's avatar Manos Koukoutos Committed by V8 LUCI CQ

[wasm] Use plain Load for instance cache nodes

Bug: v8:11510
Change-Id: I15d3758532d964ce6a7203c4152ba3e34c3d9601
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3448375Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79011}
parent 959d67e1
......@@ -90,6 +90,11 @@ MachineType assert_size(int expected_size, MachineType type) {
assert_size(WASM_INSTANCE_OBJECT_SIZE(name), type), GetInstance(), \
wasm::ObjectAccess::ToTagged(WasmInstanceObject::k##name##Offset))
#define LOAD_INSTANCE_FIELD_NO_ELIMINATION(name, type) \
gasm_->Load( \
assert_size(WASM_INSTANCE_OBJECT_SIZE(name), type), GetInstance(), \
wasm::ObjectAccess::ToTagged(WasmInstanceObject::k##name##Offset))
// Use MachineType::Pointer() over Tagged() to load root pointers because they
// do not get compressed.
#define LOAD_ROOT(root_name, factory_name) \
......@@ -780,8 +785,12 @@ void WasmGraphBuilder::StackCheck(
// We only need to refresh the size of a shared memory, as its start can never
// change.
if (shared_memory_instance_cache != nullptr) {
// We handle caching of the instance cache nodes manually, and we may reload
// them in contexts where load elimination would eliminate the reload.
// Therefore, we use plain Load nodes which are not subject to load
// elimination.
Node* new_memory_size =
LOAD_MUTABLE_INSTANCE_FIELD(MemorySize, MachineType::UintPtr());
LOAD_INSTANCE_FIELD_NO_ELIMINATION(MemorySize, MachineType::UintPtr());
shared_memory_instance_cache->mem_size = CreateOrMergeIntoPhi(
MachineType::PointerRepresentation(), merge,
shared_memory_instance_cache->mem_size, new_memory_size);
......@@ -3501,19 +3510,23 @@ Node* WasmGraphBuilder::BuildConvertUint32ToSmiWithSaturation(Node* value,
void WasmGraphBuilder::InitInstanceCache(
WasmInstanceCacheNodes* instance_cache) {
// We handle caching of the instance cache nodes manually, and we may reload
// them in contexts where load elimination would eliminate the reload.
// Therefore, we use plain Load nodes which are not subject to load
// elimination.
// Load the memory start.
#ifdef V8_SANDBOXED_POINTERS
instance_cache->mem_start =
LOAD_MUTABLE_INSTANCE_FIELD(MemoryStart, MachineType::SandboxedPointer());
instance_cache->mem_start = LOAD_INSTANCE_FIELD_NO_ELIMINATION(
MemoryStart, MachineType::SandboxedPointer());
#else
instance_cache->mem_start =
LOAD_MUTABLE_INSTANCE_FIELD(MemoryStart, MachineType::UintPtr());
LOAD_INSTANCE_FIELD_NO_ELIMINATION(MemoryStart, MachineType::UintPtr());
#endif
// Load the memory size.
instance_cache->mem_size =
LOAD_MUTABLE_INSTANCE_FIELD(MemorySize, MachineType::UintPtr());
LOAD_INSTANCE_FIELD_NO_ELIMINATION(MemorySize, MachineType::UintPtr());
}
void WasmGraphBuilder::PrepareInstanceCacheForLoop(
......
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