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

Unified Diff: src/heap/gc-idle-time-handler-unittest.cc

Issue 563493002: Allow IdleNotification to trigger Scavenges. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | « src/heap/gc-idle-time-handler.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/gc-idle-time-handler-unittest.cc
diff --git a/src/heap/gc-idle-time-handler-unittest.cc b/src/heap/gc-idle-time-handler-unittest.cc
index b9989a8c46a1d689b977a7d80a7dfba4f71b8a30..80d120faf0d9d34dff8938763f7a2d3ae77a3e25 100644
--- a/src/heap/gc-idle-time-handler-unittest.cc
+++ b/src/heap/gc-idle-time-handler-unittest.cc
@@ -28,12 +28,17 @@ class GCIdleTimeHandlerTest : public ::testing::Test {
result.sweeping_in_progress = false;
result.mark_compact_speed_in_bytes_per_ms = kMarkCompactSpeed;
result.incremental_marking_speed_in_bytes_per_ms = kMarkingSpeed;
+ result.scavenge_speed_in_bytes_per_ms = kScavengeSpeed;
+ result.available_new_space_memory = kNewSpaceCapacity;
+ result.new_space_capacity = kNewSpaceCapacity;
return result;
}
static const size_t kSizeOfObjects = 100 * MB;
static const size_t kMarkCompactSpeed = 100 * KB;
static const size_t kMarkingSpeed = 100 * KB;
+ static const size_t kScavengeSpeed = 100 * KB;
+ static const size_t kNewSpaceCapacity = 1 * MB;
private:
GCIdleTimeHandler handler_;
@@ -101,6 +106,21 @@ TEST(GCIdleTimeHandler, EstimateMarkCompactTimeMax) {
}
+TEST(GCIdleTimeHandler, EstimateScavengeTimeInitial) {
+ size_t size = 1 * MB;
+ size_t time = GCIdleTimeHandler::EstimateScavengeTime(size, 0);
+ EXPECT_EQ(size / GCIdleTimeHandler::kInitialConservativeScavengeSpeed, time);
+}
+
+
+TEST(GCIdleTimeHandler, EstimateScavengeTimeNonZero) {
+ size_t size = 1 * MB;
+ size_t speed = 1 * MB;
+ size_t time = GCIdleTimeHandler::EstimateScavengeTime(size, speed);
+ EXPECT_EQ(size / speed, time);
+}
+
+
TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeLargeIdleTime) {
GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
heap_state.contexts_disposed = 1;
« no previous file with comments | « src/heap/gc-idle-time-handler.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698