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

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

Issue 2910203002: [api] Add an API function to set the GetExternallyAllocatedMemoryInBytesCallback. (Closed)
Patch Set: comment Created 3 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
« no previous file with comments | « src/heap/heap.h ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include <unordered_map> 7 #include <unordered_map>
8 #include <unordered_set> 8 #include <unordered_set>
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 lo_space_->CommittedMemory() / KB); 374 lo_space_->CommittedMemory() / KB);
375 PrintIsolate(isolate_, "All spaces, used: %6" PRIuS 375 PrintIsolate(isolate_, "All spaces, used: %6" PRIuS
376 " KB" 376 " KB"
377 ", available: %6" PRIuS 377 ", available: %6" PRIuS
378 " KB" 378 " KB"
379 ", committed: %6" PRIuS "KB\n", 379 ", committed: %6" PRIuS "KB\n",
380 this->SizeOfObjects() / KB, this->Available() / KB, 380 this->SizeOfObjects() / KB, this->Available() / KB,
381 this->CommittedMemory() / KB); 381 this->CommittedMemory() / KB);
382 PrintIsolate(isolate_, "External memory reported: %6" PRId64 " KB\n", 382 PrintIsolate(isolate_, "External memory reported: %6" PRId64 " KB\n",
383 external_memory_ / KB); 383 external_memory_ / KB);
384 PrintIsolate(isolate_, "External memory global %zu KB\n",
385 external_memory_callback_() / KB);
384 PrintIsolate(isolate_, "Total time spent in GC : %.1f ms\n", 386 PrintIsolate(isolate_, "Total time spent in GC : %.1f ms\n",
385 total_gc_time_ms_); 387 total_gc_time_ms_);
386 } 388 }
387 389
388 // TODO(1238405): Combine the infrastructure for --heap-stats and 390 // TODO(1238405): Combine the infrastructure for --heap-stats and
389 // --log-gc to avoid the complicated preprocessor and flag testing. 391 // --log-gc to avoid the complicated preprocessor and flag testing.
390 void Heap::ReportStatisticsAfterGC() { 392 void Heap::ReportStatisticsAfterGC() {
391 // Similar to the before GC, we use some complicated logic to ensure that 393 // Similar to the before GC, we use some complicated logic to ensure that
392 // NewSpace statistics are logged exactly once when --log-gc is turned on. 394 // NewSpace statistics are logged exactly once when --log-gc is turned on.
393 #if defined(DEBUG) 395 #if defined(DEBUG)
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 DCHECK_GE(1, pressure); 959 DCHECK_GE(1, pressure);
958 const double kMaxStepSizeOnExternalLimit = 25; 960 const double kMaxStepSizeOnExternalLimit = 25;
959 const double deadline = MonotonicallyIncreasingTimeInMs() + 961 const double deadline = MonotonicallyIncreasingTimeInMs() +
960 pressure * kMaxStepSizeOnExternalLimit; 962 pressure * kMaxStepSizeOnExternalLimit;
961 incremental_marking()->AdvanceIncrementalMarking( 963 incremental_marking()->AdvanceIncrementalMarking(
962 deadline, IncrementalMarking::GC_VIA_STACK_GUARD, 964 deadline, IncrementalMarking::GC_VIA_STACK_GUARD,
963 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); 965 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
964 } 966 }
965 } 967 }
966 968
967
968 void Heap::EnsureFillerObjectAtTop() { 969 void Heap::EnsureFillerObjectAtTop() {
969 // There may be an allocation memento behind objects in new space. Upon 970 // There may be an allocation memento behind objects in new space. Upon
970 // evacuation of a non-full new space (or if we are on the last page) there 971 // evacuation of a non-full new space (or if we are on the last page) there
971 // may be uninitialized memory behind top. We fill the remainder of the page 972 // may be uninitialized memory behind top. We fill the remainder of the page
972 // with a filler. 973 // with a filler.
973 Address to_top = new_space_->top(); 974 Address to_top = new_space_->top();
974 Page* page = Page::FromAddress(to_top - kPointerSize); 975 Page* page = Page::FromAddress(to_top - kPointerSize);
975 if (page->Contains(to_top)) { 976 if (page->Contains(to_top)) {
976 int remaining_in_page = static_cast<int>(page->area_end() - to_top); 977 int remaining_in_page = static_cast<int>(page->area_end() - to_top);
977 CreateFillerObjectAt(to_top, remaining_in_page, ClearRecordedSlots::kNo); 978 CreateFillerObjectAt(to_top, remaining_in_page, ClearRecordedSlots::kNo);
(...skipping 4754 matching lines...) Expand 10 before | Expand all | Expand 10 after
5732 5733
5733 mark_compact_collector()->SetUp(); 5734 mark_compact_collector()->SetUp();
5734 if (minor_mark_compact_collector() != nullptr) { 5735 if (minor_mark_compact_collector() != nullptr) {
5735 minor_mark_compact_collector()->SetUp(); 5736 minor_mark_compact_collector()->SetUp();
5736 } 5737 }
5737 5738
5738 idle_scavenge_observer_ = new IdleScavengeObserver( 5739 idle_scavenge_observer_ = new IdleScavengeObserver(
5739 *this, ScavengeJob::kBytesAllocatedBeforeNextIdleTask); 5740 *this, ScavengeJob::kBytesAllocatedBeforeNextIdleTask);
5740 new_space()->AddAllocationObserver(idle_scavenge_observer_); 5741 new_space()->AddAllocationObserver(idle_scavenge_observer_);
5741 5742
5743 SetGetExternallyAllocatedMemoryInBytesCallback(
5744 DefaultGetExternallyAllocatedMemoryInBytesCallback);
5745
5742 return true; 5746 return true;
5743 } 5747 }
5744 5748
5745 5749
5746 bool Heap::CreateHeapObjects() { 5750 bool Heap::CreateHeapObjects() {
5747 // Create initial maps. 5751 // Create initial maps.
5748 if (!CreateInitialMaps()) return false; 5752 if (!CreateInitialMaps()) return false;
5749 if (!CreateApiObjects()) return false; 5753 if (!CreateApiObjects()) return false;
5750 5754
5751 // Create initial objects 5755 // Create initial objects
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
6604 case LO_SPACE: 6608 case LO_SPACE:
6605 return "LO_SPACE"; 6609 return "LO_SPACE";
6606 default: 6610 default:
6607 UNREACHABLE(); 6611 UNREACHABLE();
6608 } 6612 }
6609 return NULL; 6613 return NULL;
6610 } 6614 }
6611 6615
6612 } // namespace internal 6616 } // namespace internal
6613 } // namespace v8 6617 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698