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

Unified Diff: runtime/vm/scavenger.cc

Issue 343303005: Avoid infinities because they are not supported by JSON. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/pages.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scavenger.cc
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc
index c6a3e3e7aa566f3c6b7a03cefd48368abf797b86..e40c5a6ddfaaf54dee25aae10c048d558babe7fc 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -844,7 +844,7 @@ void Scavenger::PrintToJSONObject(JSONObject* object) {
space.AddProperty("name", "Scavenger");
space.AddProperty("user_name", "new");
space.AddProperty("collections", collections());
- {
+ if (collections() > 0) {
int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time();
run_time = Utils::Maximum(run_time, static_cast<int64_t>(0));
double run_time_millis = MicrosecondsToMilliseconds(run_time);
@@ -852,6 +852,8 @@ void Scavenger::PrintToJSONObject(JSONObject* object) {
run_time_millis / static_cast<double>(collections());
space.AddProperty("avgCollectionPeriodMillis",
avg_time_between_collections);
+ } else {
+ space.AddProperty("avgCollectionPeriodMillis", 0.0);
}
space.AddProperty("used", UsedInWords() * kWordSize);
space.AddProperty("capacity", CapacityInWords() * kWordSize);
« no previous file with comments | « runtime/vm/pages.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698