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

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

Issue 2455103002: [heap] Add debug checks for linear allocation area top and limit. (Closed)
Patch Set: Created 4 years, 1 month 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 <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 2545 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 return node; 2556 return node;
2557 } 2557 }
2558 2558
2559 // Allocation on the old space free list. If it succeeds then a new linear 2559 // Allocation on the old space free list. If it succeeds then a new linear
2560 // allocation space has been set up with the top and limit of the space. If 2560 // allocation space has been set up with the top and limit of the space. If
2561 // the allocation fails then NULL is returned, and the caller can perform a GC 2561 // the allocation fails then NULL is returned, and the caller can perform a GC
2562 // or allocate a new page before retrying. 2562 // or allocate a new page before retrying.
2563 HeapObject* FreeList::Allocate(size_t size_in_bytes) { 2563 HeapObject* FreeList::Allocate(size_t size_in_bytes) {
2564 DCHECK(size_in_bytes <= kMaxBlockSize); 2564 DCHECK(size_in_bytes <= kMaxBlockSize);
2565 DCHECK(IsAligned(size_in_bytes, kPointerSize)); 2565 DCHECK(IsAligned(size_in_bytes, kPointerSize));
2566 DCHECK_LE(owner_->top(), owner_->limit());
2567 #ifdef DEBUG
2568 if (owner_->top() != owner_->limit()) {
2569 DCHECK_EQ(Page::FromAddress(owner_->top()),
2570 Page::FromAddress(owner_->limit() - 1));
2571 }
2572 #endif
2566 // Don't free list allocate if there is linear space available. 2573 // Don't free list allocate if there is linear space available.
2567 DCHECK_LT(static_cast<size_t>(owner_->limit() - owner_->top()), 2574 DCHECK_LT(static_cast<size_t>(owner_->limit() - owner_->top()),
2568 size_in_bytes); 2575 size_in_bytes);
2569 2576
2570 // Mark the old linear allocation area with a free space map so it can be 2577 // Mark the old linear allocation area with a free space map so it can be
2571 // skipped when scanning the heap. This also puts it back in the free list 2578 // skipped when scanning the heap. This also puts it back in the free list
2572 // if it is big enough. 2579 // if it is big enough.
2573 owner_->EmptyAllocationInfo(); 2580 owner_->EmptyAllocationInfo();
2574 2581
2575 owner_->heap()->StartIncrementalMarkingIfAllocationLimitIsReached( 2582 owner_->heap()->StartIncrementalMarkingIfAllocationLimitIsReached(
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
3238 object->ShortPrint(); 3245 object->ShortPrint();
3239 PrintF("\n"); 3246 PrintF("\n");
3240 } 3247 }
3241 printf(" --------------------------------------\n"); 3248 printf(" --------------------------------------\n");
3242 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3249 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3243 } 3250 }
3244 3251
3245 #endif // DEBUG 3252 #endif // DEBUG
3246 } // namespace internal 3253 } // namespace internal
3247 } // namespace v8 3254 } // 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