Revert "cppgc: Fix data race ObjectSizeTrait"
This reverts commit 76f6c27674
.
Reason for revert: Mac64 ASAN is unhappy, please see https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Mac64%20ASAN%20-%20builder/194/overview
Original change's description:
> cppgc: Fix data race ObjectSizeTrait
>
> Fix benign race in
> https://clusterfuzz.com/testcase-detail/5203237072076800
>
> Change-Id: I558b230e4905a48342d8e7cf70d39be5a1b7fdb8
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3306375
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Omer Katz <omerkatz@chromium.org>
> Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Omer Katz <omerkatz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#78121}
Change-Id: I96c40a1e3421f59cf97efd4a844a041280989171
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3306377
Auto-Submit: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78122}
This commit is contained in:
parent
76f6c27674
commit
b52a7c66a2
@ -36,7 +36,7 @@ class ObjectSizeCounter : private HeapVisitor<ObjectSizeCounter> {
|
||||
|
||||
private:
|
||||
static size_t ObjectSize(const HeapObjectHeader& header) {
|
||||
return ObjectView<>(header).Size();
|
||||
return ObjectView(header).Size();
|
||||
}
|
||||
|
||||
bool VisitHeapObjectHeader(HeapObjectHeader& header) {
|
||||
|
@ -124,7 +124,7 @@ bool MarkingVerifierBase::VisitHeapObjectHeader(HeapObjectHeader& header) {
|
||||
}
|
||||
|
||||
verifier_found_marked_bytes_ +=
|
||||
ObjectView<>(header).Size() + sizeof(HeapObjectHeader);
|
||||
ObjectView(header).Size() + sizeof(HeapObjectHeader);
|
||||
|
||||
verification_state_.SetCurrentParent(nullptr);
|
||||
|
||||
|
@ -14,8 +14,8 @@ namespace internal {
|
||||
// static
|
||||
size_t BaseObjectSizeTrait::GetObjectSizeForGarbageCollected(
|
||||
const void* object) {
|
||||
return ObjectView<AccessMode::kAtomic>(HeapObjectHeader::FromObject(object))
|
||||
.Size();
|
||||
return ObjectView(HeapObjectHeader::FromObject(object))
|
||||
.Size<AccessMode::kAtomic>();
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -15,13 +15,13 @@ namespace internal {
|
||||
|
||||
// ObjectView allows accessing a header within the bounds of the actual object.
|
||||
// It is not exposed externally and does not keep the underlying object alive.
|
||||
template <AccessMode = AccessMode::kNonAtomic>
|
||||
class ObjectView final {
|
||||
public:
|
||||
V8_INLINE explicit ObjectView(const HeapObjectHeader& header);
|
||||
|
||||
V8_INLINE Address Start() const;
|
||||
V8_INLINE ConstAddress End() const;
|
||||
template <AccessMode = AccessMode::kNonAtomic>
|
||||
V8_INLINE size_t Size() const;
|
||||
|
||||
private:
|
||||
@ -30,30 +30,25 @@ class ObjectView final {
|
||||
const bool is_large_object_;
|
||||
};
|
||||
|
||||
template <AccessMode access_mode>
|
||||
ObjectView<access_mode>::ObjectView(const HeapObjectHeader& header)
|
||||
ObjectView::ObjectView(const HeapObjectHeader& header)
|
||||
: header_(header),
|
||||
base_page_(
|
||||
BasePage::FromPayload(const_cast<HeapObjectHeader*>(&header_))),
|
||||
is_large_object_(header_.IsLargeObject<access_mode>()) {
|
||||
is_large_object_(header_.IsLargeObject()) {
|
||||
DCHECK_EQ(Start() + Size(), End());
|
||||
}
|
||||
|
||||
template <AccessMode access_mode>
|
||||
Address ObjectView<access_mode>::Start() const {
|
||||
return header_.ObjectStart();
|
||||
}
|
||||
Address ObjectView::Start() const { return header_.ObjectStart(); }
|
||||
|
||||
template <AccessMode access_mode>
|
||||
ConstAddress ObjectView<access_mode>::End() const {
|
||||
ConstAddress ObjectView::End() const {
|
||||
return is_large_object_ ? LargePage::From(base_page_)->PayloadEnd()
|
||||
: header_.ObjectEnd();
|
||||
}
|
||||
|
||||
template <AccessMode access_mode>
|
||||
size_t ObjectView<access_mode>::Size() const {
|
||||
template <AccessMode mode>
|
||||
size_t ObjectView::Size() const {
|
||||
return is_large_object_ ? LargePage::From(base_page_)->ObjectSize()
|
||||
: header_.ObjectSize<access_mode>();
|
||||
: header_.ObjectSize<mode>();
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -32,7 +32,7 @@ namespace {
|
||||
|
||||
void TraceConservatively(ConservativeTracingVisitor* conservative_visitor,
|
||||
const HeapObjectHeader& header) {
|
||||
const auto object_view = ObjectView<>(header);
|
||||
const auto object_view = ObjectView(header);
|
||||
Address* object = reinterpret_cast<Address*>(object_view.Start());
|
||||
for (size_t i = 0; i < (object_view.Size() / sizeof(Address)); ++i) {
|
||||
Address maybe_ptr = object[i];
|
||||
|
@ -207,7 +207,7 @@ class ObjectSizeCounter final : private HeapVisitor<ObjectSizeCounter> {
|
||||
|
||||
private:
|
||||
static size_t ObjectSize(const HeapObjectHeader& header) {
|
||||
return ObjectView<>(header).Size();
|
||||
return ObjectView(header).Size();
|
||||
}
|
||||
|
||||
bool VisitHeapObjectHeader(HeapObjectHeader& header) {
|
||||
|
Loading…
Reference in New Issue
Block a user