Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: src/heap/spaces-inl.h

Issue 2689683002: [heap] Fix address space leak in Unmapper (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_SPACES_INL_H_ 5 #ifndef V8_HEAP_SPACES_INL_H_
6 #define V8_HEAP_SPACES_INL_H_ 6 #define V8_HEAP_SPACES_INL_H_
7 7
8 #include "src/heap/incremental-marking.h" 8 #include "src/heap/incremental-marking.h"
9 #include "src/heap/spaces.h" 9 #include "src/heap/spaces.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
11 #include "src/msan.h" 11 #include "src/msan.h"
12 #include "src/profiler/heap-profiler.h" 12 #include "src/profiler/heap-profiler.h"
13 #include "src/v8memory.h" 13 #include "src/v8memory.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 template <MemoryAllocator::AllocationMode alloc_mode, typename SpaceType>
19 Page* MemoryAllocator::AllocatePage(size_t size, SpaceType* owner,
20 Executability executable) {
21 MemoryChunk* chunk = nullptr;
22 if (alloc_mode == kPooled) {
23 DCHECK_EQ(size, static_cast<size_t>(MemoryChunk::kAllocatableMemory));
24 DCHECK_EQ(executable, NOT_EXECUTABLE);
25 chunk = AllocatePagePooled(owner);
26 }
27 if (chunk == nullptr) {
28 chunk = AllocateChunk(size, size, executable, owner);
29 }
30 if (chunk == nullptr) return nullptr;
31 return Page::Initialize(isolate_->heap(), chunk, executable, owner);
32 }
33
18 template <class PAGE_TYPE> 34 template <class PAGE_TYPE>
19 PageIteratorImpl<PAGE_TYPE>& PageIteratorImpl<PAGE_TYPE>::operator++() { 35 PageIteratorImpl<PAGE_TYPE>& PageIteratorImpl<PAGE_TYPE>::operator++() {
20 p_ = p_->next_page(); 36 p_ = p_->next_page();
21 return *this; 37 return *this;
22 } 38 }
23 39
24 template <class PAGE_TYPE> 40 template <class PAGE_TYPE>
25 PageIteratorImpl<PAGE_TYPE> PageIteratorImpl<PAGE_TYPE>::operator++(int) { 41 PageIteratorImpl<PAGE_TYPE> PageIteratorImpl<PAGE_TYPE>::operator++(int) {
26 PageIteratorImpl<PAGE_TYPE> tmp(*this); 42 PageIteratorImpl<PAGE_TYPE> tmp(*this);
27 operator++(); 43 operator++();
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 other->allocation_info_.Reset(nullptr, nullptr); 655 other->allocation_info_.Reset(nullptr, nullptr);
640 return true; 656 return true;
641 } 657 }
642 return false; 658 return false;
643 } 659 }
644 660
645 } // namespace internal 661 } // namespace internal
646 } // namespace v8 662 } // namespace v8
647 663
648 #endif // V8_HEAP_SPACES_INL_H_ 664 #endif // V8_HEAP_SPACES_INL_H_
OLDNEW
« src/heap/spaces.cc ('K') | « src/heap/spaces.cc ('k') | test/unittests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698