Commit 8414fd56 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][liftoff] Implement write barrier for global.set on arm platforms

R=ulan@chromium.org, thibaudm@chromium.org

Bug: v8:7581
Change-Id: Ie41f09339a1f5c022bd74fb3140ca66f40cc4476
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2412185Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69974}
parent 433b4984
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef V8_WASM_BASELINE_ARM_LIFTOFF_ASSEMBLER_ARM_H_ #ifndef V8_WASM_BASELINE_ARM_LIFTOFF_ASSEMBLER_ARM_H_
#define V8_WASM_BASELINE_ARM_LIFTOFF_ASSEMBLER_ARM_H_ #define V8_WASM_BASELINE_ARM_LIFTOFF_ASSEMBLER_ARM_H_
#include "src/heap/memory-chunk.h"
#include "src/wasm/baseline/liftoff-assembler.h" #include "src/wasm/baseline/liftoff-assembler.h"
#include "src/wasm/baseline/liftoff-register.h" #include "src/wasm/baseline/liftoff-register.h"
...@@ -663,7 +664,23 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr, ...@@ -663,7 +664,23 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
int32_t offset_imm, int32_t offset_imm,
LiftoffRegister src, LiftoffRegister src,
LiftoffRegList pinned) { LiftoffRegList pinned) {
bailout(kRefTypes, "GlobalSet"); STATIC_ASSERT(kTaggedSize == kInt32Size);
// Store the value.
MemOperand dst_op(dst_addr, offset_imm);
str(src.gp(), dst_op);
// The write barrier.
Label write_barrier;
Label exit;
CheckPageFlag(dst_addr, MemoryChunk::kPointersFromHereAreInterestingMask, ne,
&write_barrier);
b(&exit);
bind(&write_barrier);
JumpIfSmi(src.gp(), &exit);
CheckPageFlag(src.gp(), MemoryChunk::kPointersToHereAreInterestingMask, eq,
&exit);
CallRecordWriteStub(dst_addr, Operand(offset_imm), EMIT_REMEMBERED_SET,
kSaveFPRegs, wasm::WasmCode::kRecordWrite);
bind(&exit);
} }
void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef V8_WASM_BASELINE_ARM64_LIFTOFF_ASSEMBLER_ARM64_H_ #ifndef V8_WASM_BASELINE_ARM64_LIFTOFF_ASSEMBLER_ARM64_H_
#define V8_WASM_BASELINE_ARM64_LIFTOFF_ASSEMBLER_ARM64_H_ #define V8_WASM_BASELINE_ARM64_LIFTOFF_ASSEMBLER_ARM64_H_
#include "src/heap/memory-chunk.h"
#include "src/wasm/baseline/liftoff-assembler.h" #include "src/wasm/baseline/liftoff-assembler.h"
namespace v8 { namespace v8 {
...@@ -342,7 +343,25 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr, ...@@ -342,7 +343,25 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
int32_t offset_imm, int32_t offset_imm,
LiftoffRegister src, LiftoffRegister src,
LiftoffRegList pinned) { LiftoffRegList pinned) {
bailout(kRefTypes, "GlobalSet"); // Store the value.
MemOperand dst_op(dst_addr, offset_imm);
StoreTaggedField(src.gp(), dst_op);
// The write barrier.
Label write_barrier;
Label exit;
CheckPageFlag(dst_addr, MemoryChunk::kPointersFromHereAreInterestingMask, eq,
&write_barrier);
b(&exit);
bind(&write_barrier);
JumpIfSmi(src.gp(), &exit);
if (COMPRESS_POINTERS_BOOL) {
DecompressTaggedPointer(src.gp(), src.gp());
}
CheckPageFlag(src.gp(), MemoryChunk::kPointersToHereAreInterestingMask, ne,
&exit);
CallRecordWriteStub(dst_addr, Operand(offset_imm), EMIT_REMEMBERED_SET,
kSaveFPRegs, wasm::WasmCode::kRecordWrite);
bind(&exit);
} }
void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
......
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