Put incremental code flushing behind a flag.

This is used to disable incremental code flushing by default for now
until we can stabilize it and make it ready for production.

R=verwaest@chromium.org
BUG=chromium:159140

Review URL: https://codereview.chromium.org/11367105

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12862 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2012-11-06 11:54:05 +00:00
parent 85bda7bc09
commit 03ba764f3e
4 changed files with 24 additions and 9 deletions

View File

@ -393,7 +393,9 @@ DEFINE_bool(trace_external_memory, false,
DEFINE_bool(collect_maps, true,
"garbage collect maps from which no objects can be reached")
DEFINE_bool(flush_code, true,
"flush code that we expect not to use again before full gc")
"flush code that we expect not to use again (during full gc)")
DEFINE_bool(flush_code_incrementally, false,
"flush code that we expect not to use again (incrementally)")
DEFINE_bool(incremental_marking, true, "use incremental marking")
DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps")
DEFINE_bool(trace_incremental_marking, false,

View File

@ -420,13 +420,9 @@ void Heap::GarbageCollectionPrologue() {
gc_count_++;
unflattened_strings_length_ = 0;
bool should_enable_code_flushing = FLAG_flush_code;
#ifdef ENABLE_DEBUGGER_SUPPORT
if (isolate_->debug()->IsLoaded() || isolate_->debug()->has_break_points()) {
should_enable_code_flushing = false;
if (FLAG_flush_code && FLAG_flush_code_incrementally) {
mark_compact_collector()->EnableCodeFlushing(true);
}
#endif
mark_compact_collector()->EnableCodeFlushing(should_enable_code_flushing);
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {

View File

@ -1471,6 +1471,11 @@ void MarkCompactCollector::PrepareThreadForCodeFlushing(Isolate* isolate,
void MarkCompactCollector::PrepareForCodeFlushing() {
ASSERT(heap() == Isolate::Current()->heap());
// Enable code flushing for non-incremental cycles.
if (FLAG_flush_code && !FLAG_flush_code_incrementally) {
EnableCodeFlushing(!was_marked_incrementally_);
}
// If code flushing is disabled, there is no need to prepare for it.
if (!is_code_flushing_enabled()) return;
@ -2033,6 +2038,11 @@ void MarkCompactCollector::AfterMarking() {
// Flush code from collected candidates.
if (is_code_flushing_enabled()) {
code_flusher_->ProcessCandidates();
// If incremental marker does not support code flushing, we need to
// disable it before incremental marking steps for next cycle.
if (FLAG_flush_code && !FLAG_flush_code_incrementally) {
EnableCodeFlushing(false);
}
}
if (!FLAG_watch_ic_patching) {
@ -3607,6 +3617,13 @@ void MarkCompactCollector::SweepSpaces() {
void MarkCompactCollector::EnableCodeFlushing(bool enable) {
#ifdef ENABLE_DEBUGGER_SUPPORT
if (heap()->isolate()->debug()->IsLoaded() ||
heap()->isolate()->debug()->has_break_points()) {
enable = false;
}
#endif
if (enable) {
if (code_flusher_ != NULL) return;
code_flusher_ = new CodeFlusher(heap()->isolate());

View File

@ -1003,7 +1003,7 @@ TEST(TestCodeFlushing) {
TEST(TestCodeFlushingIncremental) {
// If we do not flush code this test is invalid.
if (!FLAG_flush_code) return;
if (!FLAG_flush_code || !FLAG_flush_code_incrementally) return;
i::FLAG_allow_natives_syntax = true;
InitializeVM();
v8::HandleScope scope;
@ -1071,7 +1071,7 @@ TEST(TestCodeFlushingIncremental) {
TEST(TestCodeFlushingIncrementalScavenge) {
// If we do not flush code this test is invalid.
if (!FLAG_flush_code) return;
if (!FLAG_flush_code || !FLAG_flush_code_incrementally) return;
i::FLAG_allow_natives_syntax = true;
InitializeVM();
v8::HandleScope scope;