| OLD | NEW |
| 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/full-codegen/full-codegen.h" | 9 #include "src/full-codegen/full-codegen.h" |
| 10 #include "src/heap/slots-buffer.h" | 10 #include "src/heap/slots-buffer.h" |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 421 |
| 422 | 422 |
| 423 NewSpacePage* NewSpacePage::Initialize(Heap* heap, Address start, | 423 NewSpacePage* NewSpacePage::Initialize(Heap* heap, Address start, |
| 424 SemiSpace* semi_space) { | 424 SemiSpace* semi_space) { |
| 425 Address area_start = start + NewSpacePage::kObjectStartOffset; | 425 Address area_start = start + NewSpacePage::kObjectStartOffset; |
| 426 Address area_end = start + Page::kPageSize; | 426 Address area_end = start + Page::kPageSize; |
| 427 | 427 |
| 428 MemoryChunk* chunk = | 428 MemoryChunk* chunk = |
| 429 MemoryChunk::Initialize(heap, start, Page::kPageSize, area_start, | 429 MemoryChunk::Initialize(heap, start, Page::kPageSize, area_start, |
| 430 area_end, NOT_EXECUTABLE, semi_space); | 430 area_end, NOT_EXECUTABLE, semi_space); |
| 431 chunk->set_next_chunk(NULL); | |
| 432 chunk->set_prev_chunk(NULL); | |
| 433 chunk->initialize_scan_on_scavenge(true); | 431 chunk->initialize_scan_on_scavenge(true); |
| 434 bool in_to_space = (semi_space->id() != kFromSpace); | 432 bool in_to_space = (semi_space->id() != kFromSpace); |
| 435 chunk->SetFlag(in_to_space ? MemoryChunk::IN_TO_SPACE | 433 chunk->SetFlag(in_to_space ? MemoryChunk::IN_TO_SPACE |
| 436 : MemoryChunk::IN_FROM_SPACE); | 434 : MemoryChunk::IN_FROM_SPACE); |
| 437 DCHECK(!chunk->IsFlagSet(in_to_space ? MemoryChunk::IN_FROM_SPACE | 435 DCHECK(!chunk->IsFlagSet(in_to_space ? MemoryChunk::IN_FROM_SPACE |
| 438 : MemoryChunk::IN_TO_SPACE)); | 436 : MemoryChunk::IN_TO_SPACE)); |
| 439 NewSpacePage* page = static_cast<NewSpacePage*>(chunk); | 437 NewSpacePage* page = static_cast<NewSpacePage*>(chunk); |
| 440 heap->incremental_marking()->SetNewSpacePageFlags(page); | 438 heap->incremental_marking()->SetNewSpacePageFlags(page); |
| 441 return page; | 439 return page; |
| 442 } | 440 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 chunk->mutex_ = NULL; | 474 chunk->mutex_ = NULL; |
| 477 chunk->available_in_small_free_list_ = 0; | 475 chunk->available_in_small_free_list_ = 0; |
| 478 chunk->available_in_medium_free_list_ = 0; | 476 chunk->available_in_medium_free_list_ = 0; |
| 479 chunk->available_in_large_free_list_ = 0; | 477 chunk->available_in_large_free_list_ = 0; |
| 480 chunk->available_in_huge_free_list_ = 0; | 478 chunk->available_in_huge_free_list_ = 0; |
| 481 chunk->non_available_small_blocks_ = 0; | 479 chunk->non_available_small_blocks_ = 0; |
| 482 chunk->ResetLiveBytes(); | 480 chunk->ResetLiveBytes(); |
| 483 Bitmap::Clear(chunk); | 481 Bitmap::Clear(chunk); |
| 484 chunk->initialize_scan_on_scavenge(false); | 482 chunk->initialize_scan_on_scavenge(false); |
| 485 chunk->SetFlag(WAS_SWEPT); | 483 chunk->SetFlag(WAS_SWEPT); |
| 484 chunk->set_next_chunk(nullptr); |
| 485 chunk->set_prev_chunk(nullptr); |
| 486 | 486 |
| 487 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); | 487 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); |
| 488 DCHECK(OFFSET_OF(MemoryChunk, live_byte_count_) == kLiveBytesOffset); | 488 DCHECK(OFFSET_OF(MemoryChunk, live_byte_count_) == kLiveBytesOffset); |
| 489 | 489 |
| 490 if (executable == EXECUTABLE) { | 490 if (executable == EXECUTABLE) { |
| 491 chunk->SetFlag(IS_EXECUTABLE); | 491 chunk->SetFlag(IS_EXECUTABLE); |
| 492 } | 492 } |
| 493 | 493 |
| 494 return chunk; | 494 return chunk; |
| 495 } | 495 } |
| (...skipping 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3144 object->ShortPrint(); | 3144 object->ShortPrint(); |
| 3145 PrintF("\n"); | 3145 PrintF("\n"); |
| 3146 } | 3146 } |
| 3147 printf(" --------------------------------------\n"); | 3147 printf(" --------------------------------------\n"); |
| 3148 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3148 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3149 } | 3149 } |
| 3150 | 3150 |
| 3151 #endif // DEBUG | 3151 #endif // DEBUG |
| 3152 } // namespace internal | 3152 } // namespace internal |
| 3153 } // namespace v8 | 3153 } // namespace v8 |
| OLD | NEW |