Commit dc5bcb2e authored by Omer Katz's avatar Omer Katz Committed by V8 LUCI CQ

[heap] Drop unnecessary ToSpaceContains methods

ToSpaceContainsSlow is only from Heap:InSpaceSlow that is never used for
new space.
FromSpaceContains is never called.
ToSpaceContains is called from unittests and from Heap::Contains, and
replacing it wioth  NewSpace::Contains should keep things fast as that
one relies on a page flag.

Bug: v8:12612
Change-Id: I58d63a85fd66aa27f9c4a7794e21838a59aab3d0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3610447Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80228}
parent 29e737bd
......@@ -4512,7 +4512,7 @@ bool Heap::Contains(HeapObject value) const {
return false;
}
return HasBeenSetUp() &&
((new_space_ && new_space_->ToSpaceContains(value)) ||
((new_space_ && new_space_->Contains(value)) ||
old_space_->Contains(value) || code_space_->Contains(value) ||
(map_space_ && map_space_->Contains(value)) ||
lo_space_->Contains(value) || code_lo_space_->Contains(value) ||
......@@ -4560,7 +4560,7 @@ bool Heap::InSpace(HeapObject value, AllocationSpace space) const {
switch (space) {
case NEW_SPACE:
return new_space_->ToSpaceContains(value);
return new_space_->Contains(value);
case OLD_SPACE:
return old_space_->Contains(value);
case CODE_SPACE:
......@@ -4590,7 +4590,7 @@ bool Heap::InSpaceSlow(Address addr, AllocationSpace space) const {
switch (space) {
case NEW_SPACE:
return new_space_->ToSpaceContainsSlow(addr);
return new_space_->ContainsSlow(addr);
case OLD_SPACE:
return old_space_->ContainsSlow(addr);
case CODE_SPACE:
......
......@@ -63,15 +63,6 @@ bool NewSpace::ContainsSlow(Address a) const {
return from_space_.ContainsSlow(a) || to_space_.ContainsSlow(a);
}
bool NewSpace::ToSpaceContainsSlow(Address a) const {
return to_space_.ContainsSlow(a);
}
bool NewSpace::ToSpaceContains(Object o) const { return to_space_.Contains(o); }
bool NewSpace::FromSpaceContains(Object o) const {
return from_space_.Contains(o);
}
V8_INLINE bool NewSpace::EnsureAllocation(int size_in_bytes,
AllocationAlignment alignment,
AllocationOrigin origin,
......
......@@ -459,10 +459,6 @@ class V8_EXPORT_PRIVATE NewSpace final : public NewSpaceBase {
// it in steps to guarantee that the observers are notified periodically.
void UpdateInlineAllocationLimit(size_t size_in_bytes) override;
inline bool ToSpaceContainsSlow(Address a) const;
inline bool ToSpaceContains(Object o) const;
inline bool FromSpaceContains(Object o) const;
// Try to switch the active semispace to a new, empty, page.
// Returns false if this isn't possible or reasonable (i.e., there
// are no pages, or the current page is already empty), or true
......
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