| Index: src/heap/heap.cc
|
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
| index 931d55e3111e06828fb8040ad4f41ca180f794e5..94c8937d4592c6a1cc93377c18b609daa2e478dc 100644
|
| --- a/src/heap/heap.cc
|
| +++ b/src/heap/heap.cc
|
| @@ -61,6 +61,7 @@ Heap::Heap()
|
| reserved_semispace_size_(8 * (kPointerSize / 4) * MB),
|
| max_semi_space_size_(8 * (kPointerSize / 4) * MB),
|
| initial_semispace_size_(Page::kPageSize),
|
| + target_semispace_size_(Page::kPageSize),
|
| max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
|
| max_executable_size_(256ul * (kPointerSize / 4) * MB),
|
| // Variables set based on semispace_size_ and old_generation_size_ in
|
| @@ -1398,6 +1399,10 @@ void PromotionQueue::RelocateQueueHead() {
|
| while (head_start != head_end) {
|
| int size = static_cast<int>(*(head_start++));
|
| HeapObject* obj = reinterpret_cast<HeapObject*>(*(head_start++));
|
| + // New space allocation in SemiSpaceCopyObject marked the region
|
| + // overlapping with promotion queue as uninitialized.
|
| + MSAN_MEMORY_IS_INITIALIZED(&size, sizeof(size));
|
| + MSAN_MEMORY_IS_INITIALIZED(&obj, sizeof(obj));
|
| emergency_stack_->Add(Entry(obj, size));
|
| }
|
| rear_ = head_end;
|
| @@ -1565,6 +1570,8 @@ void Heap::Scavenge() {
|
| LOG(isolate_, ResourceEvent("scavenge", "end"));
|
|
|
| gc_state_ = NOT_IN_GC;
|
| +
|
| + gc_idle_time_handler_.NotifyScavenge();
|
| }
|
|
|
|
|
| @@ -2901,7 +2908,7 @@ void Heap::CreateInitialObjects() {
|
| set_undefined_cell(*factory->NewCell(factory->undefined_value()));
|
|
|
| // The symbol registry is initialized lazily.
|
| - set_symbol_registry(undefined_value());
|
| + set_symbol_registry(Smi::FromInt(0));
|
|
|
| // Allocate object to hold object observation state.
|
| set_observation_state(*factory->NewJSObjectFromMap(
|
| @@ -4296,6 +4303,23 @@ void Heap::MakeHeapIterable() {
|
| }
|
|
|
|
|
| +void Heap::IdleMarkCompact(const char* message) {
|
| + bool uncommit = false;
|
| + if (gc_count_at_last_idle_gc_ == gc_count_) {
|
| + // No GC since the last full GC, the mutator is probably not active.
|
| + isolate_->compilation_cache()->Clear();
|
| + uncommit = true;
|
| + }
|
| + CollectAllGarbage(kReduceMemoryFootprintMask, message);
|
| + gc_idle_time_handler_.NotifyIdleMarkCompact();
|
| + gc_count_at_last_idle_gc_ = gc_count_;
|
| + if (uncommit) {
|
| + new_space_.Shrink();
|
| + UncommitFromSpace();
|
| + }
|
| +}
|
| +
|
| +
|
| void Heap::TryFinalizeIdleIncrementalMarking(
|
| size_t idle_time_in_ms, size_t size_of_objects,
|
| size_t mark_compact_speed_in_bytes_per_ms) {
|
| @@ -4304,20 +4328,7 @@ void Heap::TryFinalizeIdleIncrementalMarking(
|
| gc_idle_time_handler_.ShouldDoMarkCompact(
|
| idle_time_in_ms, size_of_objects,
|
| mark_compact_speed_in_bytes_per_ms))) {
|
| - bool uncommit = false;
|
| - if (gc_count_at_last_idle_gc_ == gc_count_) {
|
| - // No GC since the last full GC, the mutator is probably not active.
|
| - isolate_->compilation_cache()->Clear();
|
| - uncommit = true;
|
| - }
|
| - CollectAllGarbage(kReduceMemoryFootprintMask,
|
| - "idle notification: finalize incremental");
|
| - gc_idle_time_handler_.NotifyIdleMarkCompact();
|
| - gc_count_at_last_idle_gc_ = gc_count_;
|
| - if (uncommit) {
|
| - new_space_.Shrink();
|
| - UncommitFromSpace();
|
| - }
|
| + IdleMarkCompact("idle notification: finalize incremental");
|
| }
|
| }
|
|
|
| @@ -4387,11 +4398,14 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
|
| }
|
| case DO_FULL_GC: {
|
| HistogramTimerScope scope(isolate_->counters()->gc_context());
|
| - const char* message = contexts_disposed_
|
| - ? "idle notification: contexts disposed"
|
| - : "idle notification: finalize idle round";
|
| - CollectAllGarbage(kReduceMemoryFootprintMask, message);
|
| - gc_idle_time_handler_.NotifyIdleMarkCompact();
|
| + if (contexts_disposed_) {
|
| + CollectAllGarbage(kReduceMemoryFootprintMask,
|
| + "idle notification: contexts disposed");
|
| + gc_idle_time_handler_.NotifyIdleMarkCompact();
|
| + gc_count_at_last_idle_gc_ = gc_count_;
|
| + } else {
|
| + IdleMarkCompact("idle notification: finalize idle round");
|
| + }
|
| break;
|
| }
|
| case DO_SCAVENGE:
|
| @@ -4537,6 +4551,19 @@ bool Heap::InSpace(Address addr, AllocationSpace space) {
|
| }
|
|
|
|
|
| +bool Heap::RootIsImmortalImmovable(int root_index) {
|
| + switch (root_index) {
|
| +#define CASE(name) \
|
| + case Heap::k##name##RootIndex: \
|
| + return true;
|
| + IMMORTAL_IMMOVABLE_ROOT_LIST(CASE);
|
| +#undef CASE
|
| + default:
|
| + return false;
|
| + }
|
| +}
|
| +
|
| +
|
| #ifdef VERIFY_HEAP
|
| void Heap::Verify() {
|
| CHECK(HasBeenSetUp());
|
| @@ -4940,9 +4967,9 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size,
|
| initial_semispace_size_ = max_semi_space_size_;
|
| if (FLAG_trace_gc) {
|
| PrintPID(
|
| - "Min semi-space size cannot be more than the maximum"
|
| + "Min semi-space size cannot be more than the maximum "
|
| "semi-space size of %d MB\n",
|
| - max_semi_space_size_);
|
| + max_semi_space_size_ / MB);
|
| }
|
| } else {
|
| initial_semispace_size_ = initial_semispace_size;
|
| @@ -4951,6 +4978,31 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size,
|
|
|
| initial_semispace_size_ = Min(initial_semispace_size_, max_semi_space_size_);
|
|
|
| + if (FLAG_target_semi_space_size > 0) {
|
| + int target_semispace_size = FLAG_target_semi_space_size * MB;
|
| + if (target_semispace_size < initial_semispace_size_) {
|
| + target_semispace_size_ = initial_semispace_size_;
|
| + if (FLAG_trace_gc) {
|
| + PrintPID(
|
| + "Target semi-space size cannot be less than the minimum "
|
| + "semi-space size of %d MB\n",
|
| + initial_semispace_size_ / MB);
|
| + }
|
| + } else if (target_semispace_size > max_semi_space_size_) {
|
| + target_semispace_size_ = max_semi_space_size_;
|
| + if (FLAG_trace_gc) {
|
| + PrintPID(
|
| + "Target semi-space size cannot be less than the maximum "
|
| + "semi-space size of %d MB\n",
|
| + max_semi_space_size_ / MB);
|
| + }
|
| + } else {
|
| + target_semispace_size_ = target_semispace_size;
|
| + }
|
| + }
|
| +
|
| + target_semispace_size_ = Max(initial_semispace_size_, target_semispace_size_);
|
| +
|
| // The old generation is paged and needs at least one page for each space.
|
| int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1;
|
| max_old_generation_size_ =
|
|
|