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

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

Issue 7247002: Estimate a (close) upper bound on the size of black-marked objects on each page. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Address review comments. Make compile on x64. Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/spaces.cc ('k') | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 19 matching lines...) Expand all
30 30
31 #include "isolate.h" 31 #include "isolate.h"
32 #include "spaces.h" 32 #include "spaces.h"
33 #include "v8memory.h" 33 #include "v8memory.h"
34 34
35 namespace v8 { 35 namespace v8 {
36 namespace internal { 36 namespace internal {
37 37
38 38
39 // ----------------------------------------------------------------------------- 39 // -----------------------------------------------------------------------------
40 // Bitmap
41
42 void Bitmap::Clear(MemoryChunk* chunk) {
43 Bitmap* bitmap = chunk->markbits();
44 for (int i = 0; i < bitmap->CellsCount(); i++) bitmap->cells()[i] = 0;
45 chunk->ResetLiveBytes();
46 }
47
48
49 // -----------------------------------------------------------------------------
40 // PageIterator 50 // PageIterator
41 51
42 52
43 PageIterator::PageIterator(PagedSpace* space) 53 PageIterator::PageIterator(PagedSpace* space)
44 : space_(space), 54 : space_(space),
45 prev_page_(&space->anchor_), 55 prev_page_(&space->anchor_),
46 next_page_(prev_page_->next_page()) { } 56 next_page_(prev_page_->next_page()) { }
47 57
48 58
49 bool PageIterator::has_next() { 59 bool PageIterator::has_next() {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 #endif 157 #endif
148 158
149 159
150 // -------------------------------------------------------------------------- 160 // --------------------------------------------------------------------------
151 // PagedSpace 161 // PagedSpace
152 Page* Page::Initialize(Heap* heap, 162 Page* Page::Initialize(Heap* heap,
153 MemoryChunk* chunk, 163 MemoryChunk* chunk,
154 Executability executable, 164 Executability executable,
155 PagedSpace* owner) { 165 PagedSpace* owner) {
156 Page* page = reinterpret_cast<Page*>(chunk); 166 Page* page = reinterpret_cast<Page*>(chunk);
157 MemoryChunk::Initialize(heap, 167 ASSERT(chunk->size() == static_cast<size_t>(kPageSize));
158 reinterpret_cast<Address>(chunk), 168 ASSERT(chunk->owner() == owner);
159 kPageSize,
160 executable,
161 owner);
162 owner->IncreaseCapacity(Page::kObjectAreaSize); 169 owner->IncreaseCapacity(Page::kObjectAreaSize);
163 owner->Free(page->ObjectAreaStart(), 170 owner->Free(page->ObjectAreaStart(),
164 page->ObjectAreaEnd() - page->ObjectAreaStart()); 171 page->ObjectAreaEnd() - page->ObjectAreaStart());
165 172
166 heap->incremental_marking()->SetOldSpacePageFlags(chunk); 173 heap->incremental_marking()->SetOldSpacePageFlags(chunk);
167 174
168 return page; 175 return page;
169 } 176 }
170 177
171 178
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 return ObjectSizeFor(heap()->isolate()->memory_allocator()->Available()); 334 return ObjectSizeFor(heap()->isolate()->memory_allocator()->Available());
328 } 335 }
329 336
330 337
331 template <typename StringType> 338 template <typename StringType>
332 void NewSpace::ShrinkStringAtAllocationBoundary(String* string, int length) { 339 void NewSpace::ShrinkStringAtAllocationBoundary(String* string, int length) {
333 ASSERT(length <= string->length()); 340 ASSERT(length <= string->length());
334 ASSERT(string->IsSeqString()); 341 ASSERT(string->IsSeqString());
335 ASSERT(string->address() + StringType::SizeFor(string->length()) == 342 ASSERT(string->address() + StringType::SizeFor(string->length()) ==
336 allocation_info_.top); 343 allocation_info_.top);
344 Address old_top = allocation_info_.top;
337 allocation_info_.top = 345 allocation_info_.top =
338 string->address() + StringType::SizeFor(length); 346 string->address() + StringType::SizeFor(length);
339 string->set_length(length); 347 string->set_length(length);
348 if (Marking::IsBlack(Marking::MarkBitFrom(string))) {
349 int delta = static_cast<int>(old_top - allocation_info_.top);
350 MemoryChunk::IncrementLiveBytes(string->address(), -delta);
351 }
340 } 352 }
341 353
342 354
343 bool FreeListNode::IsFreeListNode(HeapObject* object) { 355 bool FreeListNode::IsFreeListNode(HeapObject* object) {
344 // TODO(gc) ISOLATES MERGE 356 // TODO(gc) ISOLATES MERGE
345 return object->map() == HEAP->raw_unchecked_free_space_map() 357 return object->map() == HEAP->raw_unchecked_free_space_map()
346 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() 358 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map()
347 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); 359 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map();
348 } 360 }
349 361
350 } } // namespace v8::internal 362 } } // namespace v8::internal
351 363
352 #endif // V8_SPACES_INL_H_ 364 #endif // V8_SPACES_INL_H_
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698