From 2243a8632b05861240e404bb0731cf662d4d3878 Mon Sep 17 00:00:00 2001 From: Wenyu Zhao Date: Thu, 27 May 2021 16:28:09 +1000 Subject: [PATCH] [heap] Fix third-party-heap PageFromAddress check in CSA Use compile-time DCHECK instead of Unreachable(). GenerateRecordWrite is disabled to prevent the use of PageFromAddress when TPH is enabled. Another user of PageFromAddress is TrapAllocationMemento, this will be disabled in https://chromium-review.googlesource.com/c/v8/v8/+/2897326. Bug: v8:11641 Change-Id: I1393d5ad52695a79750be00f2205648458f9c79d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2909216 Commit-Queue: Wenyu Zhao Reviewed-by: Jakob Gruber Cr-Commit-Position: refs/heads/master@{#74805} --- src/builtins/builtins-internal-gen.cc | 4 ++++ src/codegen/code-stub-assembler.cc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/builtins/builtins-internal-gen.cc b/src/builtins/builtins-internal-gen.cc index bd3809448f..1f17812368 100644 --- a/src/builtins/builtins-internal-gen.cc +++ b/src/builtins/builtins-internal-gen.cc @@ -345,6 +345,10 @@ class WriteBarrierCodeStubAssembler : public CodeStubAssembler { void GenerateRecordWrite(RememberedSetAction rs_mode, SaveFPRegsMode fp_mode) { + if (V8_DISABLE_WRITE_BARRIERS_BOOL) { + Return(TrueConstant()); + return; + } switch (rs_mode) { case RememberedSetAction::kEmit: GenerationalWriteBarrier(fp_mode); diff --git a/src/codegen/code-stub-assembler.cc b/src/codegen/code-stub-assembler.cc index a68a7b9ca0..fbd90ea28a 100644 --- a/src/codegen/code-stub-assembler.cc +++ b/src/codegen/code-stub-assembler.cc @@ -11236,7 +11236,7 @@ void CodeStubAssembler::TrapAllocationMemento(TNode object, } TNode CodeStubAssembler::PageFromAddress(TNode address) { - if (FLAG_enable_third_party_heap) Unreachable(); + DCHECK(!V8_ENABLE_THIRD_PARTY_HEAP_BOOL); return WordAnd(address, IntPtrConstant(~kPageAlignmentMask)); }