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

Unified Diff: runtime/vm/pages.cc

Issue 2984883002: Remove fields from Isolate in Product mode (Closed)
Patch Set: Address comments Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/pages.cc
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index afda7bb609034de169be4c345c4cee8e6d894b72..895d2b2439878d29e023f9e705cc918890b98eed 100644
--- a/runtime/vm/pages.cc
+++ b/runtime/vm/pages.cc
@@ -543,6 +543,7 @@ void PageSpace::AbandonBumpAllocation() {
}
void PageSpace::UpdateMaxCapacityLocked() {
+#if !defined(PRODUCT)
if (heap_ == NULL) {
// Some unit tests.
return;
@@ -552,9 +553,11 @@ void PageSpace::UpdateMaxCapacityLocked() {
Isolate* isolate = heap_->isolate();
isolate->GetHeapOldCapacityMaxMetric()->SetValue(
static_cast<int64_t>(usage_.capacity_in_words) * kWordSize);
+#endif // !defined(PRODUCT)
}
void PageSpace::UpdateMaxUsed() {
+#if !defined(PRODUCT)
if (heap_ == NULL) {
// Some unit tests.
return;
@@ -563,6 +566,7 @@ void PageSpace::UpdateMaxUsed() {
ASSERT(heap_->isolate() != NULL);
Isolate* isolate = heap_->isolate();
isolate->GetHeapOldUsedMaxMetric()->SetValue(UsedInWords() * kWordSize);
+#endif // !defined(PRODUCT)
}
bool PageSpace::Contains(uword addr) const {
@@ -864,8 +868,12 @@ void PageSpace::MarkSweep(bool invoke_api_callbacks) {
SpaceUsage usage_before = GetCurrentUsage();
// Mark all reachable old-gen objects.
+#if defined(PRODUCT)
+ bool collect_code = FLAG_collect_code && ShouldCollectCode();
+#else
bool collect_code = FLAG_collect_code && ShouldCollectCode() &&
!isolate->HasAttemptedReload();
+#endif // !defined(PRODUCT)
GCMarker marker(heap_);
marker.MarkObjects(isolate, this, invoke_api_callbacks, collect_code);
usage_.used_in_words = marker.marked_words();
@@ -1141,6 +1149,7 @@ bool PageSpaceController::NeedsGarbageCollection(SpaceUsage after) const {
intptr_t capacity_increase_in_pages =
capacity_increase_in_words / PageSpace::kPageSizeInWords;
double multiplier = 1.0;
+#if !defined(PRODUCT)
// To avoid waste, the first GC should be triggered before too long. After
// kInitialTimeoutSeconds, gradually lower the capacity limit.
static const double kInitialTimeoutSeconds = 1.00;
@@ -1151,6 +1160,7 @@ bool PageSpaceController::NeedsGarbageCollection(SpaceUsage after) const {
multiplier *= seconds_since_init / kInitialTimeoutSeconds;
}
}
+#endif // !defined(PRODUCT)
bool needs_gc = capacity_increase_in_pages * multiplier > grow_heap_;
if (FLAG_log_growth) {
OS::PrintErr("%s: %" Pd " * %f %s %" Pd "\n",
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698