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

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

Issue 2842303003: [heap] Remove max executable size configuration. (Closed)
Patch Set: comment Created 3 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 | « src/heap/spaces.h ('k') | src/mips/assembler-mips.h » ('j') | 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 <utility> 7 #include <utility>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 285
286 // ----------------------------------------------------------------------------- 286 // -----------------------------------------------------------------------------
287 // MemoryAllocator 287 // MemoryAllocator
288 // 288 //
289 289
290 MemoryAllocator::MemoryAllocator(Isolate* isolate) 290 MemoryAllocator::MemoryAllocator(Isolate* isolate)
291 : isolate_(isolate), 291 : isolate_(isolate),
292 code_range_(nullptr), 292 code_range_(nullptr),
293 capacity_(0), 293 capacity_(0),
294 capacity_executable_(0),
295 size_(0), 294 size_(0),
296 size_executable_(0), 295 size_executable_(0),
297 lowest_ever_allocated_(reinterpret_cast<void*>(-1)), 296 lowest_ever_allocated_(reinterpret_cast<void*>(-1)),
298 highest_ever_allocated_(reinterpret_cast<void*>(0)), 297 highest_ever_allocated_(reinterpret_cast<void*>(0)),
299 unmapper_(this) {} 298 unmapper_(this) {}
300 299
301 bool MemoryAllocator::SetUp(size_t capacity, size_t capacity_executable, 300 bool MemoryAllocator::SetUp(size_t capacity, size_t code_range_size) {
302 size_t code_range_size) {
303 capacity_ = RoundUp(capacity, Page::kPageSize); 301 capacity_ = RoundUp(capacity, Page::kPageSize);
304 capacity_executable_ = RoundUp(capacity_executable, Page::kPageSize);
305 DCHECK_GE(capacity_, capacity_executable_);
306 302
307 size_ = 0; 303 size_ = 0;
308 size_executable_ = 0; 304 size_executable_ = 0;
309 305
310 code_range_ = new CodeRange(isolate_); 306 code_range_ = new CodeRange(isolate_);
311 if (!code_range_->SetUp(code_range_size)) return false; 307 if (!code_range_->SetUp(code_range_size)) return false;
312 308
313 return true; 309 return true;
314 } 310 }
315 311
316 312
317 void MemoryAllocator::TearDown() { 313 void MemoryAllocator::TearDown() {
318 unmapper()->TearDown(); 314 unmapper()->TearDown();
319 315
320 // Check that spaces were torn down before MemoryAllocator. 316 // Check that spaces were torn down before MemoryAllocator.
321 DCHECK_EQ(size_.Value(), 0u); 317 DCHECK_EQ(size_.Value(), 0u);
322 // TODO(gc) this will be true again when we fix FreeMemory. 318 // TODO(gc) this will be true again when we fix FreeMemory.
323 // DCHECK(size_executable_ == 0); 319 // DCHECK(size_executable_ == 0);
324 capacity_ = 0; 320 capacity_ = 0;
325 capacity_executable_ = 0;
326 321
327 if (last_chunk_.IsReserved()) { 322 if (last_chunk_.IsReserved()) {
328 last_chunk_.Release(); 323 last_chunk_.Release();
329 } 324 }
330 325
331 delete code_range_; 326 delete code_range_;
332 code_range_ = nullptr; 327 code_range_ = nullptr;
333 } 328 }
334 329
335 class MemoryAllocator::Unmapper::UnmapFreeMemoryTask : public v8::Task { 330 class MemoryAllocator::Unmapper::UnmapFreeMemoryTask : public v8::Task {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 // +----------------------------+<- aligned at OS page boundary 686 // +----------------------------+<- aligned at OS page boundary
692 // | Reserved but not committed | 687 // | Reserved but not committed |
693 // +----------------------------+<- base + chunk_size 688 // +----------------------------+<- base + chunk_size
694 // 689 //
695 690
696 if (executable == EXECUTABLE) { 691 if (executable == EXECUTABLE) {
697 chunk_size = RoundUp(CodePageAreaStartOffset() + reserve_area_size, 692 chunk_size = RoundUp(CodePageAreaStartOffset() + reserve_area_size,
698 GetCommitPageSize()) + 693 GetCommitPageSize()) +
699 CodePageGuardSize(); 694 CodePageGuardSize();
700 695
701 // Check executable memory limit.
702 if ((size_executable_.Value() + chunk_size) > capacity_executable_) {
703 LOG(isolate_, StringEvent("MemoryAllocator::AllocateRawMemory",
704 "V8 Executable Allocation capacity exceeded"));
705 return NULL;
706 }
707
708 // Size of header (not executable) plus area (executable). 696 // Size of header (not executable) plus area (executable).
709 size_t commit_size = RoundUp(CodePageGuardStartOffset() + commit_area_size, 697 size_t commit_size = RoundUp(CodePageGuardStartOffset() + commit_area_size,
710 GetCommitPageSize()); 698 GetCommitPageSize());
711 // Allocate executable memory either from code range or from the 699 // Allocate executable memory either from code range or from the
712 // OS. 700 // OS.
713 #ifdef V8_TARGET_ARCH_MIPS64 701 #ifdef V8_TARGET_ARCH_MIPS64
714 // Use code range only for large object space on mips64 to keep address 702 // Use code range only for large object space on mips64 to keep address
715 // range within 256-MB memory region. 703 // range within 256-MB memory region.
716 if (code_range()->valid() && reserve_area_size > CodePageAreaSize()) { 704 if (code_range()->valid() && reserve_area_size > CodePageAreaSize()) {
717 #else 705 #else
(...skipping 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 PrintF("\n"); 3302 PrintF("\n");
3315 } 3303 }
3316 printf(" --------------------------------------\n"); 3304 printf(" --------------------------------------\n");
3317 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size, 3305 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size,
3318 MarkingState::Internal(this).live_bytes()); 3306 MarkingState::Internal(this).live_bytes());
3319 } 3307 }
3320 3308
3321 #endif // DEBUG 3309 #endif // DEBUG
3322 } // namespace internal 3310 } // namespace internal
3323 } // namespace v8 3311 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | src/mips/assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698