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 <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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 Executability executable, Space* owner, | 498 Executability executable, Space* owner, |
499 base::VirtualMemory* reservation) { | 499 base::VirtualMemory* reservation) { |
500 MemoryChunk* chunk = FromAddress(base); | 500 MemoryChunk* chunk = FromAddress(base); |
501 | 501 |
502 DCHECK(base == chunk->address()); | 502 DCHECK(base == chunk->address()); |
503 | 503 |
504 chunk->heap_ = heap; | 504 chunk->heap_ = heap; |
505 chunk->size_ = size; | 505 chunk->size_ = size; |
506 chunk->area_start_ = area_start; | 506 chunk->area_start_ = area_start; |
507 chunk->area_end_ = area_end; | 507 chunk->area_end_ = area_end; |
508 chunk->flags_ = 0; | 508 chunk->flags_ = Flags(NO_FLAGS); |
509 chunk->set_owner(owner); | 509 chunk->set_owner(owner); |
510 chunk->InitializeReservedMemory(); | 510 chunk->InitializeReservedMemory(); |
511 chunk->old_to_new_slots_ = nullptr; | 511 chunk->old_to_new_slots_ = nullptr; |
512 chunk->old_to_old_slots_ = nullptr; | 512 chunk->old_to_old_slots_ = nullptr; |
513 chunk->typed_old_to_new_slots_ = nullptr; | 513 chunk->typed_old_to_new_slots_ = nullptr; |
514 chunk->typed_old_to_old_slots_ = nullptr; | 514 chunk->typed_old_to_old_slots_ = nullptr; |
515 chunk->skip_list_ = nullptr; | 515 chunk->skip_list_ = nullptr; |
516 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; | 516 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; |
517 chunk->progress_bar_ = 0; | 517 chunk->progress_bar_ = 0; |
518 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base)); | 518 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base)); |
519 chunk->concurrent_sweeping_state().SetValue(kSweepingDone); | 519 chunk->concurrent_sweeping_state().SetValue(kSweepingDone); |
520 chunk->mutex_ = new base::Mutex(); | 520 chunk->mutex_ = new base::Mutex(); |
521 chunk->available_in_free_list_ = 0; | 521 chunk->available_in_free_list_ = 0; |
522 chunk->wasted_memory_ = 0; | 522 chunk->wasted_memory_ = 0; |
523 chunk->ResetLiveBytes(); | 523 chunk->ResetLiveBytes(); |
524 chunk->ClearLiveness(); | 524 chunk->ClearLiveness(); |
525 chunk->set_next_chunk(nullptr); | 525 chunk->set_next_chunk(nullptr); |
526 chunk->set_prev_chunk(nullptr); | 526 chunk->set_prev_chunk(nullptr); |
527 chunk->local_tracker_ = nullptr; | 527 chunk->local_tracker_ = nullptr; |
528 chunk->black_area_end_marker_map_ = nullptr; | 528 chunk->black_area_end_marker_map_ = nullptr; |
529 | 529 |
530 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); | 530 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); |
531 DCHECK(OFFSET_OF(MemoryChunk, live_byte_count_) == kLiveBytesOffset); | |
532 | 531 |
533 if (executable == EXECUTABLE) { | 532 if (executable == EXECUTABLE) { |
534 chunk->SetFlag(IS_EXECUTABLE); | 533 chunk->SetFlag(IS_EXECUTABLE); |
535 } | 534 } |
536 | 535 |
537 if (reservation != nullptr) { | 536 if (reservation != nullptr) { |
538 chunk->reservation_.TakeControl(reservation); | 537 chunk->reservation_.TakeControl(reservation); |
539 } | 538 } |
540 | 539 |
541 return chunk; | 540 return chunk; |
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3166 object->ShortPrint(); | 3165 object->ShortPrint(); |
3167 PrintF("\n"); | 3166 PrintF("\n"); |
3168 } | 3167 } |
3169 printf(" --------------------------------------\n"); | 3168 printf(" --------------------------------------\n"); |
3170 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3169 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3171 } | 3170 } |
3172 | 3171 |
3173 #endif // DEBUG | 3172 #endif // DEBUG |
3174 } // namespace internal | 3173 } // namespace internal |
3175 } // namespace v8 | 3174 } // namespace v8 |
OLD | NEW |