Revision: 18641
Author:   [email protected]
Date:     Thu Jan 16 11:54:12 2014 UTC
Log:      Deopt marked code at safe deoptimization point when pretenuring.

BUG=
[email protected], [email protected]

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

Modified:
 /branches/bleeding_edge/src/execution.cc
 /branches/bleeding_edge/src/execution.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/objects-inl.h

=======================================
--- /branches/bleeding_edge/src/execution.cc    Thu Dec 19 17:09:38 2013 UTC
+++ /branches/bleeding_edge/src/execution.cc    Thu Jan 16 11:54:12 2014 UTC
@@ -500,6 +500,19 @@
   thread_local_.interrupt_flags_ |= FULL_DEOPT;
   set_interrupt_limits(access);
 }
+
+
+bool StackGuard::IsDeoptMarkedCode() {
+  ExecutionAccess access(isolate_);
+  return (thread_local_.interrupt_flags_ & DEOPT_MARKED_CODE) != 0;
+}
+
+
+void StackGuard::DeoptMarkedCode() {
+  ExecutionAccess access(isolate_);
+  thread_local_.interrupt_flags_ |= DEOPT_MARKED_CODE;
+  set_interrupt_limits(access);
+}


 #ifdef ENABLE_DEBUGGER_SUPPORT
@@ -1013,6 +1026,10 @@
     stack_guard->Continue(FULL_DEOPT);
     Deoptimizer::DeoptimizeAll(isolate);
   }
+  if (stack_guard->IsDeoptMarkedCode()) {
+    stack_guard->Continue(DEOPT_MARKED_CODE);
+    Deoptimizer::DeoptimizeMarkedCode(isolate);
+  }
   if (stack_guard->IsInstallCodeRequest()) {
     ASSERT(isolate->concurrent_recompilation_enabled());
     stack_guard->Continue(INSTALL_CODE);
=======================================
--- /branches/bleeding_edge/src/execution.h     Thu Dec 19 16:45:58 2013 UTC
+++ /branches/bleeding_edge/src/execution.h     Thu Jan 16 11:54:12 2014 UTC
@@ -44,7 +44,8 @@
   GC_REQUEST = 1 << 5,
   FULL_DEOPT = 1 << 6,
   INSTALL_CODE = 1 << 7,
-  API_INTERRUPT = 1 << 8
+  API_INTERRUPT = 1 << 8,
+  DEOPT_MARKED_CODE = 1 << 9
 };


@@ -221,6 +222,8 @@
   void RequestInstallCode();
   bool IsFullDeopt();
   void FullDeopt();
+  bool IsDeoptMarkedCode();
+  void DeoptMarkedCode();
   void Continue(InterruptFlag after_what);

   void RequestInterrupt(InterruptCallback callback, void* data);
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Jan 16 10:00:03 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Thu Jan 16 11:54:12 2014 UTC
@@ -521,6 +521,7 @@

     int i = 0;
     Object* list_element = allocation_sites_list();
+    bool trigger_deoptimization = false;
     while (use_scratchpad ?
               i < allocation_sites_scratchpad_length :
               list_element->IsAllocationSite()) {
@@ -530,12 +531,11 @@
       if (site->memento_found_count() > 0) {
         active_allocation_sites++;
       }
-      if (site->DigestPretenuringFeedback()) {
-        if (site->GetPretenureMode() == TENURED) {
-          tenure_decisions++;
-        } else {
-          dont_tenure_decisions++;
-        }
+      if (site->DigestPretenuringFeedback()) trigger_deoptimization = true;
+      if (site->GetPretenureMode() == TENURED) {
+        tenure_decisions++;
+      } else {
+        dont_tenure_decisions++;
       }
       allocation_sites++;
       if (use_scratchpad) {
@@ -544,6 +544,9 @@
         list_element = site->weak_next();
       }
     }
+
+    if (trigger_deoptimization) isolate_->stack_guard()->DeoptMarkedCode();
+
     allocation_sites_scratchpad_length = 0;

// TODO(mvstanton): Pretenure decisions are only made once for an allocation
@@ -1998,7 +2001,7 @@
     }
     cur = casted->weak_next();
   }
-  if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate_);
+  if (marked) isolate_->stack_guard()->DeoptMarkedCode();
 }


=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Mon Jan 13 10:28:01 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Thu Jan 16 11:54:12 2014 UTC
@@ -1397,7 +1397,7 @@


 inline bool AllocationSite::DigestPretenuringFeedback() {
-  bool decision_made = false;
+  bool decision_changed = false;
   int create_count = memento_create_count();
   if (create_count >= kPretenureMinimumCreated) {
     int found_count = memento_found_count();
@@ -1411,9 +1411,9 @@
         ? kTenure
         : kDontTenure;
     set_pretenure_decision(result);
-    decision_made = true;
     if (current_mode != GetPretenureMode()) {
-      dependent_code()->DeoptimizeDependentCodeGroup(
+      decision_changed = true;
+      dependent_code()->MarkCodeForDeoptimization(
           GetIsolate(),
           DependentCode::kAllocationSiteTenuringChangedGroup);
     }
@@ -1422,7 +1422,7 @@
   // Clear feedback calculation fields until the next gc.
   set_memento_found_count(0);
   set_memento_create_count(0);
-  return decision_made;
+  return decision_changed;
 }


--
--
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/groups/opt_out.

Reply via email to