Commit 9433ad11 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Improve IsMarking() check in RecordWrite builtin

Store the is_marking_flag_ in the IsolateData to improve the generated
code for the RecordWrite builtin. This allows to load the value of the
flag directly using the root register, instead of loading that flag's
address first using the root register and only then loading its value.

Bug: v8:11708
Change-Id: Id4076a7e519c5f8126e310771c0ccd958dc07278
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780536
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82456}
parent 19722972
......@@ -53,7 +53,8 @@ class Isolate;
/* Linear allocation areas for the heap's new and old space */ \
V(kNewAllocationInfo, LinearAllocationArea::kSize, new_allocation_info) \
V(kOldAllocationInfo, LinearAllocationArea::kSize, old_allocation_info) \
V(kStackIsIterableOffset, kUInt8Size, stack_is_iterable)
V(kStackIsIterableOffset, kUInt8Size, stack_is_iterable) \
V(kIsMarkingFlag, kUInt8Size, is_marking_flag)
#ifdef V8_COMPRESS_POINTERS
#define ISOLATE_DATA_FIELDS_POINTER_COMPRESSION(V) \
......@@ -221,6 +222,8 @@ class IsolateData final {
// stack. Only valid values are 0 or 1.
uint8_t stack_is_iterable_ = 1;
bool is_marking_flag_ = false;
// Ensure the size is 8-byte aligned in order to make alignment of the field
// following the IsolateData field predictable. This solves the issue with
// C++ compilers for 32-bit platforms which are not consistent at aligning
......
......@@ -7535,6 +7535,14 @@ bool Heap::IsStressingScavenge() {
return FLAG_stress_scavenge > 0 && new_space();
}
void Heap::SetIsMarkingFlag(bool value) {
isolate()->isolate_data()->is_marking_flag_ = value;
}
bool* Heap::IsMarkingFlagAddress() {
return &isolate()->isolate_data()->is_marking_flag_;
}
// StrongRootBlocks are allocated as a block of addresses, prefixed with a
// StrongRootsEntry pointer:
//
......
......@@ -1074,9 +1074,7 @@ class Heap {
// ===========================================================================
// Used for query incremental marking status in generated code.
Address* IsMarkingFlagAddress() {
return reinterpret_cast<Address*>(&is_marking_flag_);
}
bool* IsMarkingFlagAddress();
void ClearRecordedSlot(HeapObject object, ObjectSlot slot);
void ClearRecordedSlotRange(Address start, Address end);
......@@ -2152,9 +2150,7 @@ class Heap {
bool IsStressingScavenge();
void SetIsMarkingFlag(bool value) {
is_marking_flag_ = static_cast<uint8_t>(value);
}
void SetIsMarkingFlag(bool value);
ExternalMemoryAccounting external_memory_;
......@@ -2393,9 +2389,6 @@ class Heap {
char trace_ring_buffer_[kTraceRingBufferSize];
// Used as boolean.
uint8_t is_marking_flag_ = 0;
// If it's not full then the data is from 0 to ring_buffer_end_. If it's
// full then the data is from ring_buffer_end_ to the end of the buffer and
// from 0 to ring_buffer_end_.
......
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