Reviewers: ulan,
Message:
Committed patchset #5 (id:80001) manually as 23965 (presubmit successful).
Description:
Introduce DONE state in idle notification handler.
BUG=
[email protected]
Committed: https://code.google.com/p/v8/source/detail?r=23965
Please review this at https://codereview.chromium.org/577573002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+20, -7 lines):
M src/heap/gc-idle-time-handler.h
M src/heap/gc-idle-time-handler.cc
M src/heap/gc-idle-time-handler-unittest.cc
M src/heap/heap.cc
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
56ff2f313cd3c5807df57a5b825af14f69b7da7d..165cac37c101e9188b129581b9de653f6c5f7345
100644
--- a/src/heap/gc-idle-time-handler-unittest.cc
+++ b/src/heap/gc-idle-time-handler-unittest.cc
@@ -182,7 +182,7 @@ TEST_F(GCIdleTimeHandlerTest, StopEventually1) {
handler()->NotifyIdleMarkCompact();
}
GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
+ EXPECT_EQ(DONE, action.type);
}
@@ -195,7 +195,7 @@ TEST_F(GCIdleTimeHandlerTest, StopEventually2) {
handler()->NotifyIdleMarkCompact();
}
GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
+ EXPECT_EQ(DONE, action.type);
}
@@ -211,7 +211,7 @@ TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop1) {
handler()->NotifyIdleMarkCompact();
}
GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
+ EXPECT_EQ(DONE, action.type);
// Emulate mutator work.
for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
handler()->NotifyScavenge();
@@ -226,12 +226,12 @@ TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop2) {
int idle_time_ms = 10;
for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++)
{
GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- if (action.type == DO_NOTHING) break;
+ if (action.type == DONE) break;
EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
handler()->NotifyIdleMarkCompact();
}
GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
+ EXPECT_EQ(DONE, action.type);
// Emulate mutator work.
for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
handler()->NotifyScavenge();
Index: src/heap/gc-idle-time-handler.cc
diff --git a/src/heap/gc-idle-time-handler.cc
b/src/heap/gc-idle-time-handler.cc
index
cd7efe06523347dd70eff4848568648e266d3287..bc182ae5e40076513222193586cb2ed9ab6ab65d
100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -18,6 +18,9 @@ const int GCIdleTimeHandler::kIdleScavengeThreshold = 5;
void GCIdleTimeAction::Print() {
switch (type) {
+ case DONE:
+ PrintF("done");
+ break;
case DO_NOTHING:
PrintF("no action");
break;
@@ -74,7 +77,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(size_t
idle_time_in_ms,
if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed
0) {
StartIdleRound();
} else {
- return GCIdleTimeAction::Nothing();
+ return GCIdleTimeAction::Done();
}
}
if (heap_state.incremental_marking_stopped) {
Index: src/heap/gc-idle-time-handler.h
diff --git a/src/heap/gc-idle-time-handler.h
b/src/heap/gc-idle-time-handler.h
index
28905785525e33238c5f8acbcdc1152814f630c0..899f289e22c0a265025d89e7ff54b1912b7c48dd
100644
--- a/src/heap/gc-idle-time-handler.h
+++ b/src/heap/gc-idle-time-handler.h
@@ -11,6 +11,7 @@ namespace v8 {
namespace internal {
enum GCIdleTimeActionType {
+ DONE,
DO_NOTHING,
DO_INCREMENTAL_MARKING,
DO_SCAVENGE,
@@ -21,6 +22,13 @@ enum GCIdleTimeActionType {
class GCIdleTimeAction {
public:
+ static GCIdleTimeAction Done() {
+ GCIdleTimeAction result;
+ result.type = DONE;
+ result.parameter = 0;
+ return result;
+ }
+
static GCIdleTimeAction Nothing() {
GCIdleTimeAction result;
result.type = DO_NOTHING;
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index
6b66818baef11911abc38f86b19ad2ab9de3acfc..e6770e5b4310471e9fb2b8ec2af367a7805aae54
100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4318,6 +4318,9 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
bool result = false;
switch (action.type) {
+ case DONE:
+ result = true;
+ break;
case DO_INCREMENTAL_MARKING:
if (incremental_marking()->IsStopped()) {
incremental_marking()->Start();
@@ -4340,7 +4343,6 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
mark_compact_collector()->EnsureSweepingCompleted();
break;
case DO_NOTHING:
- result = true;
break;
}
if (FLAG_trace_idle_notification) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.