Commit dbff2a67 authored by Darius M's avatar Darius M Committed by V8 LUCI CQ

[write-barrier] Add debug check for cleared weak refs in write barrier

Change-Id: I7f0d040b6e27ef5d24818c5c79aad9aa4b56ed2b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3560050Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79684}
parent 4dc4852f
......@@ -44,6 +44,7 @@ namespace internal {
V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function") \
V(kOperandIsASmiAndNotAGeneratorObject, \
"Operand is a smi and not a generator object") \
V(kOperandIsCleared, "Operand is cleared") \
V(kOperandIsNotABoundFunction, "Operand is not a bound function") \
V(kOperandIsNotAConstructor, "Operand is not a constructor") \
V(kOperandIsNotAFixedArray, "Operand is not a fixed array") \
......
......@@ -943,6 +943,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Register object = i.InputRegister(0);
Register value = i.InputRegister(2);
if (FLAG_debug_code) {
// Checking that |value| is not a cleared weakref: our write barrier
// does not support that for now.
__ cmp(value, Operand(kClearedWeakHeapObjectLower32));
__ Check(ne, AbortReason::kOperandIsCleared);
}
AddressingMode addressing_mode =
AddressingModeField::decode(instr->opcode());
Operand offset(0);
......
......@@ -963,6 +963,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
offset = Operand(i.InputRegister(1));
}
Register value = i.InputRegister(2);
if (FLAG_debug_code) {
// Checking that |value| is not a cleared weakref: our write barrier
// does not support that for now.
__ cmp(value, Operand(kClearedWeakHeapObjectLower32));
__ Check(ne, AbortReason::kOperandIsCleared);
}
auto ool = zone()->New<OutOfLineRecordWrite>(
this, object, offset, value, mode, DetermineStubCallMode(),
&unwinding_info_writer_);
......
......@@ -972,6 +972,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Register value = i.InputRegister(index);
Register scratch0 = i.TempRegister(0);
Register scratch1 = i.TempRegister(1);
if (FLAG_debug_code) {
// Checking that |value| is not a cleared weakref: our write barrier
// does not support that for now.
__ cmp(value, Immediate(kClearedWeakHeapObjectLower32));
__ Check(not_equal, AbortReason::kOperandIsCleared);
}
auto ool = zone()->New<OutOfLineRecordWrite>(this, object, operand, value,
scratch0, scratch1, mode,
DetermineStubCallMode());
......
......@@ -1495,6 +1495,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Register value = i.InputRegister(index);
Register scratch0 = i.TempRegister(0);
Register scratch1 = i.TempRegister(1);
if (FLAG_debug_code) {
// Checking that |value| is not a cleared weakref: our write barrier
// does not support that for now.
__ Cmp(value, kClearedWeakHeapObjectLower32);
__ Check(not_equal, AbortReason::kOperandIsCleared);
}
auto ool = zone()->New<OutOfLineRecordWrite>(this, object, operand, value,
scratch0, scratch1, mode,
DetermineStubCallMode());
......
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