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

Side by Side Diff: src/heap/spaces.cc

Issue 1958403003: [heap] Properly deal with OOM during committing of pooled pages (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "src/heap/spaces.h" 5 #include "src/heap/spaces.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/base/platform/semaphore.h" 9 #include "src/base/platform/semaphore.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 } 873 }
874 874
875 template <typename SpaceType> 875 template <typename SpaceType>
876 MemoryChunk* MemoryAllocator::AllocatePagePooled(SpaceType* owner) { 876 MemoryChunk* MemoryAllocator::AllocatePagePooled(SpaceType* owner) {
877 MemoryChunk* chunk = unmapper()->TryGetPooledMemoryChunkSafe(); 877 MemoryChunk* chunk = unmapper()->TryGetPooledMemoryChunkSafe();
878 if (chunk == nullptr) return nullptr; 878 if (chunk == nullptr) return nullptr;
879 const int size = MemoryChunk::kPageSize; 879 const int size = MemoryChunk::kPageSize;
880 const Address start = reinterpret_cast<Address>(chunk); 880 const Address start = reinterpret_cast<Address>(chunk);
881 const Address area_start = start + MemoryChunk::kObjectStartOffset; 881 const Address area_start = start + MemoryChunk::kObjectStartOffset;
882 const Address area_end = start + size; 882 const Address area_end = start + size;
883 CommitBlock(reinterpret_cast<Address>(chunk), size, NOT_EXECUTABLE); 883 if (!CommitBlock(reinterpret_cast<Address>(chunk), size, NOT_EXECUTABLE)) {
884 return nullptr;
885 }
884 base::VirtualMemory reservation(start, size); 886 base::VirtualMemory reservation(start, size);
885 MemoryChunk::Initialize(isolate_->heap(), start, size, area_start, area_end, 887 MemoryChunk::Initialize(isolate_->heap(), start, size, area_start, area_end,
886 NOT_EXECUTABLE, owner, &reservation); 888 NOT_EXECUTABLE, owner, &reservation);
887 size_.Increment(size); 889 size_.Increment(size);
888 return chunk; 890 return chunk;
889 } 891 }
890 892
891 bool MemoryAllocator::CommitBlock(Address start, size_t size, 893 bool MemoryAllocator::CommitBlock(Address start, size_t size,
892 Executability executable) { 894 Executability executable) {
893 if (!CommitMemory(start, size, executable)) return false; 895 if (!CommitMemory(start, size, executable)) return false;
(...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after
3222 object->ShortPrint(); 3224 object->ShortPrint();
3223 PrintF("\n"); 3225 PrintF("\n");
3224 } 3226 }
3225 printf(" --------------------------------------\n"); 3227 printf(" --------------------------------------\n");
3226 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3228 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3227 } 3229 }
3228 3230
3229 #endif // DEBUG 3231 #endif // DEBUG
3230 } // namespace internal 3232 } // namespace internal
3231 } // namespace v8 3233 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698