Commit ce1ad779 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[heap] Support code space in PagedSpace::ExpandBackground

Bug: v8:12054
Change-Id: I7edcb864e2fefe105c4da9120fbe3891822c4f85
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3240787
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77546}
parent b824e884
...@@ -5005,6 +5005,7 @@ bool Overlapping(const MemoryRange& a, const MemoryRange& b) { ...@@ -5005,6 +5005,7 @@ bool Overlapping(const MemoryRange& a, const MemoryRange& b) {
#endif // DEBUG #endif // DEBUG
void Isolate::AddCodeMemoryRange(MemoryRange range) { void Isolate::AddCodeMemoryRange(MemoryRange range) {
base::MutexGuard guard(&code_pages_mutex_);
std::vector<MemoryRange>* old_code_pages = GetCodePages(); std::vector<MemoryRange>* old_code_pages = GetCodePages();
DCHECK_NOT_NULL(old_code_pages); DCHECK_NOT_NULL(old_code_pages);
#ifdef DEBUG #ifdef DEBUG
......
...@@ -2315,6 +2315,8 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { ...@@ -2315,6 +2315,8 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
std::atomic<std::vector<MemoryRange>*> code_pages_{nullptr}; std::atomic<std::vector<MemoryRange>*> code_pages_{nullptr};
std::vector<MemoryRange> code_pages_buffer1_; std::vector<MemoryRange> code_pages_buffer1_;
std::vector<MemoryRange> code_pages_buffer2_; std::vector<MemoryRange> code_pages_buffer2_;
// The mutex only guards adding pages, the retrieval is signal safe.
base::Mutex code_pages_mutex_;
// Enables the host application to provide a mechanism for recording a // Enables the host application to provide a mechanism for recording a
// predefined set of data as crash keys to be used in postmortem debugging // predefined set of data as crash keys to be used in postmortem debugging
......
...@@ -339,6 +339,9 @@ base::Optional<std::pair<Address, size_t>> PagedSpace::ExpandBackground( ...@@ -339,6 +339,9 @@ base::Optional<std::pair<Address, size_t>> PagedSpace::ExpandBackground(
if (page == nullptr) return {}; if (page == nullptr) return {};
base::MutexGuard lock(&space_mutex_); base::MutexGuard lock(&space_mutex_);
AddPage(page); AddPage(page);
if (identity() == CODE_SPACE || identity() == CODE_LO_SPACE) {
heap()->isolate()->AddCodeMemoryChunk(page);
}
Address object_start = page->area_start(); Address object_start = page->area_start();
CHECK_LE(size_in_bytes, page->area_size()); CHECK_LE(size_in_bytes, page->area_size());
Free(page->area_start() + size_in_bytes, page->area_size() - size_in_bytes, Free(page->area_start() + size_in_bytes, page->area_size() - size_in_bytes,
......
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