[rwx][mac] Add missing CodePageHeaderModificationScopes
... for configurations with disabled pointer compression. Bug: v8:12797, v8:13059 Change-Id: I0547ded7934f1f28a4c2ca45738fefd7311576c3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3763868 Auto-Submit: Igor Sheludko <ishell@chromium.org> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/main@{#81776}
This commit is contained in:
parent
5e269d565d
commit
3a82e6eaa1
@ -1275,9 +1275,6 @@ PipelineCompilationJob::Status PipelineCompilationJob::FinalizeJobImpl(
|
||||
compilation_info()->SetCode(code);
|
||||
Handle<NativeContext> context(compilation_info()->native_context(), isolate);
|
||||
if (CodeKindCanDeoptimize(code->kind())) {
|
||||
CodeTPageHeaderModificationScope rwx_write_scope(
|
||||
"Storing a CodeT object triggers marking barrier which requires "
|
||||
"write access to the CodeT page header");
|
||||
context->AddOptimizedCode(ToCodeT(*code));
|
||||
}
|
||||
RegisterWeakObjectsInOptimizedCode(isolate, context, code);
|
||||
|
@ -36,6 +36,8 @@ V8_EXPORT_PRIVATE void Heap_GenerationalBarrierForCodeSlow(Code host,
|
||||
V8_EXPORT_PRIVATE void Heap_GenerationalEphemeronKeyBarrierSlow(
|
||||
Heap* heap, HeapObject table, Address slot);
|
||||
|
||||
inline bool IsCodeSpaceObject(HeapObject object);
|
||||
|
||||
// Do not use these internal details anywhere outside of this file. These
|
||||
// internals are only intended to shortcut write barrier checks.
|
||||
namespace heap_internals {
|
||||
@ -114,6 +116,15 @@ inline void CombinedWriteBarrierInternal(HeapObject host, HeapObjectSlot slot,
|
||||
|
||||
// Marking barrier: mark value & record slots when marking is on.
|
||||
if (is_marking) {
|
||||
#ifdef V8_EXTERNAL_CODE_SPACE
|
||||
// CodePageHeaderModificationScope is not required because the only case
|
||||
// when a Code value is stored somewhere is during creation of a new Code
|
||||
// object which is then stored to CodeDataContainer's code field and this
|
||||
// case is already guarded by CodePageMemoryModificationScope.
|
||||
#else
|
||||
CodePageHeaderModificationScope rwx_write_scope(
|
||||
"Marking a Code object requires write access to the Code page header");
|
||||
#endif
|
||||
WriteBarrier::MarkingSlow(host_chunk->GetHeap(), host, HeapObjectSlot(slot),
|
||||
value);
|
||||
}
|
||||
@ -190,6 +201,9 @@ inline void CombinedEphemeronWriteBarrier(EphemeronHashTable host,
|
||||
|
||||
// Marking barrier: mark value & record slots when marking is on.
|
||||
if (is_marking) {
|
||||
// Currently Code values are never stored in EphemeronTables. If this ever
|
||||
// changes then the CodePageHeaderModificationScope might be required here.
|
||||
DCHECK(!IsCodeSpaceObject(heap_object_value));
|
||||
WriteBarrier::MarkingSlow(host_chunk->GetHeap(), host, HeapObjectSlot(slot),
|
||||
heap_object_value);
|
||||
}
|
||||
@ -260,21 +274,26 @@ base::Optional<Heap*> WriteBarrier::GetHeapIfMarking(HeapObject object) {
|
||||
void WriteBarrier::Marking(HeapObject host, ObjectSlot slot, Object value) {
|
||||
DCHECK(!HasWeakHeapObjectTag(value));
|
||||
if (!value.IsHeapObject()) return;
|
||||
Marking(host, HeapObjectSlot(slot), HeapObject::cast(value));
|
||||
}
|
||||
|
||||
void WriteBarrier::Marking(HeapObject host, ObjectSlot slot, Code value) {
|
||||
DCHECK(!HasWeakHeapObjectTag(value));
|
||||
if (!value.IsHeapObject()) return;
|
||||
CodePageHeaderModificationScope rwx_write_scope(
|
||||
"Marking a Code object requires write access to the Code page header");
|
||||
Marking(host, HeapObjectSlot(slot), HeapObject::cast(value));
|
||||
HeapObject value_heap_object = HeapObject::cast(value);
|
||||
// Currently this marking barrier is never used for Code values. If this ever
|
||||
// changes then the CodePageHeaderModificationScope might be required here.
|
||||
DCHECK(!IsCodeSpaceObject(value_heap_object));
|
||||
Marking(host, HeapObjectSlot(slot), value_heap_object);
|
||||
}
|
||||
|
||||
void WriteBarrier::Marking(HeapObject host, MaybeObjectSlot slot,
|
||||
MaybeObject value) {
|
||||
HeapObject value_heap_object;
|
||||
if (!value->GetHeapObject(&value_heap_object)) return;
|
||||
#ifdef V8_EXTERNAL_CODE_SPACE
|
||||
// This barrier is called from generated code and from C++ code.
|
||||
// There must be no stores of Code values from generated code and all stores
|
||||
// of Code values in C++ must be handled by CombinedWriteBarrierInternal().
|
||||
DCHECK(!IsCodeSpaceObject(value_heap_object));
|
||||
#else
|
||||
CodePageHeaderModificationScope rwx_write_scope(
|
||||
"Marking a Code object requires write access to the Code page header");
|
||||
#endif
|
||||
Marking(host, HeapObjectSlot(slot), value_heap_object);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,6 @@ inline bool IsReadOnlyHeapObject(HeapObject object);
|
||||
class V8_EXPORT_PRIVATE WriteBarrier {
|
||||
public:
|
||||
static inline void Marking(HeapObject host, ObjectSlot, Object value);
|
||||
static inline void Marking(HeapObject host, ObjectSlot, Code value);
|
||||
static inline void Marking(HeapObject host, HeapObjectSlot, HeapObject value);
|
||||
static inline void Marking(HeapObject host, MaybeObjectSlot,
|
||||
MaybeObject value);
|
||||
|
@ -7365,6 +7365,10 @@ void Heap::WriteBarrierForRangeImpl(MemoryChunk* source_page, HeapObject object,
|
||||
MarkingBarrier* marking_barrier = WriteBarrier::CurrentMarkingBarrier(this);
|
||||
MarkCompactCollector* collector = this->mark_compact_collector();
|
||||
|
||||
CodeTPageHeaderModificationScope rwx_write_scope(
|
||||
"Marking CodeT objects might require write access to the CodeT page "
|
||||
"header");
|
||||
|
||||
for (TSlot slot = start_slot; slot < end_slot; ++slot) {
|
||||
typename TSlot::TObject value = *slot;
|
||||
HeapObject value_heap_object;
|
||||
|
Loading…
Reference in New Issue
Block a user