Revision: 12862
Author:   [email protected]
Date:     Tue Nov  6 03:54:05 2012
Log:      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.

[email protected]
BUG=chromium:159140

Review URL: https://codereview.chromium.org/11367105
http://code.google.com/p/v8/source/detail?r=12862

Modified:
 /branches/bleeding_edge/src/flag-definitions.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/test/cctest/test-heap.cc

=======================================
--- /branches/bleeding_edge/src/flag-definitions.h      Thu Oct 25 07:53:26 2012
+++ /branches/bleeding_edge/src/flag-definitions.h      Tue Nov  6 03:54:05 2012
@@ -393,7 +393,9 @@
 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,
=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Nov  5 02:25:32 2012
+++ /branches/bleeding_edge/src/heap.cc Tue Nov  6 03:54:05 2012
@@ -420,13 +420,9 @@
   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) {
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Fri Oct 26 02:44:34 2012
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Nov  6 03:54:05 2012
@@ -1470,6 +1470,11 @@

 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 @@
   // 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::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());
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Fri Oct 26 02:44:34 2012 +++ /branches/bleeding_edge/test/cctest/test-heap.cc Tue Nov 6 03:54:05 2012
@@ -1003,7 +1003,7 @@

 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(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;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to