Revision: 19404
Author:   [email protected]
Date:     Mon Feb 17 12:15:16 2014 UTC
Log:      Added a special stack guard to deopt marked allocation sites.

BUG=
[email protected], [email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/execution.cc    Wed Feb 12 22:04:19 2014 UTC
+++ /branches/bleeding_edge/src/execution.cc    Mon Feb 17 12:15:16 2014 UTC
@@ -516,15 +516,15 @@
 }


-bool StackGuard::IsDeoptMarkedCode() {
+bool StackGuard::IsDeoptMarkedAllocationSites() {
   ExecutionAccess access(isolate_);
-  return (thread_local_.interrupt_flags_ & DEOPT_MARKED_CODE) != 0;
+ return (thread_local_.interrupt_flags_ & DEOPT_MARKED_ALLOCATION_SITES) != 0;
 }


-void StackGuard::DeoptMarkedCode() {
+void StackGuard::DeoptMarkedAllocationSites() {
   ExecutionAccess access(isolate_);
-  thread_local_.interrupt_flags_ |= DEOPT_MARKED_CODE;
+  thread_local_.interrupt_flags_ |= DEOPT_MARKED_ALLOCATION_SITES;
   set_interrupt_limits(access);
 }

@@ -1040,9 +1040,9 @@
     stack_guard->Continue(FULL_DEOPT);
     Deoptimizer::DeoptimizeAll(isolate);
   }
-  if (stack_guard->IsDeoptMarkedCode()) {
-    stack_guard->Continue(DEOPT_MARKED_CODE);
-    Deoptimizer::DeoptimizeMarkedCode(isolate);
+  if (stack_guard->IsDeoptMarkedAllocationSites()) {
+    stack_guard->Continue(DEOPT_MARKED_ALLOCATION_SITES);
+    isolate->heap()->DeoptMarkedAllocationSites();
   }
   if (stack_guard->IsInstallCodeRequest()) {
     ASSERT(isolate->concurrent_recompilation_enabled());
=======================================
--- /branches/bleeding_edge/src/execution.h     Wed Feb 12 22:04:19 2014 UTC
+++ /branches/bleeding_edge/src/execution.h     Mon Feb 17 12:15:16 2014 UTC
@@ -45,7 +45,7 @@
   FULL_DEOPT = 1 << 6,
   INSTALL_CODE = 1 << 7,
   API_INTERRUPT = 1 << 8,
-  DEOPT_MARKED_CODE = 1 << 9
+  DEOPT_MARKED_ALLOCATION_SITES = 1 << 9
 };


@@ -223,8 +223,8 @@
   void RequestInstallCode();
   bool IsFullDeopt();
   void FullDeopt();
-  bool IsDeoptMarkedCode();
-  void DeoptMarkedCode();
+  bool IsDeoptMarkedAllocationSites();
+  void DeoptMarkedAllocationSites();
   void Continue(InterruptFlag after_what);

   void RequestInterrupt(InterruptCallback callback, void* data);
=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Feb 17 10:41:25 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Mon Feb 17 12:15:16 2014 UTC
@@ -545,7 +545,9 @@
       }
     }

-    if (trigger_deoptimization) isolate_->stack_guard()->DeoptMarkedCode();
+    if (trigger_deoptimization) {
+      isolate_->stack_guard()->DeoptMarkedAllocationSites();
+    }

     FlushAllocationSitesScratchpad();

@@ -565,6 +567,25 @@
     }
   }
 }
+
+
+void Heap::DeoptMarkedAllocationSites() {
+  // TODO(hpayer): If iterating over the allocation sites list becomes a
+ // performance issue, use a cache heap data structure instead (similar to the
+  // allocation sites scratchpad).
+  Object* list_element = allocation_sites_list();
+  while (list_element->IsAllocationSite()) {
+    AllocationSite* site = AllocationSite::cast(list_element);
+    if (site->deopt_dependent_code()) {
+      site->dependent_code()->MarkCodeForDeoptimization(
+          isolate_,
+          DependentCode::kAllocationSiteTenuringChangedGroup);
+      site->set_deopt_dependent_code(false);
+    }
+    list_element = site->weak_next();
+  }
+  Deoptimizer::DeoptimizeMarkedCode(isolate_);
+}


 void Heap::GarbageCollectionEpilogue() {
@@ -2000,14 +2021,12 @@
     AllocationSite* casted = AllocationSite::cast(cur);
     if (casted->GetPretenureMode() == flag) {
       casted->ResetPretenureDecision();
- bool got_marked = casted->dependent_code()->MarkCodeForDeoptimization(
-          isolate_,
-          DependentCode::kAllocationSiteTenuringChangedGroup);
-      if (got_marked) marked = true;
+      casted->set_deopt_dependent_code(true);
+      marked = true;
     }
     cur = casted->weak_next();
   }
-  if (marked) isolate_->stack_guard()->DeoptMarkedCode();
+  if (marked) isolate_->stack_guard()->DeoptMarkedAllocationSites();
 }


=======================================
--- /branches/bleeding_edge/src/heap.h  Mon Feb 17 10:41:25 2014 UTC
+++ /branches/bleeding_edge/src/heap.h  Mon Feb 17 12:15:16 2014 UTC
@@ -1846,6 +1846,8 @@
   int64_t amount_of_external_allocated_memory() {
     return amount_of_external_allocated_memory_;
   }
+
+  void DeoptMarkedAllocationSites();

// ObjectStats are kept in two arrays, counts and sizes. Related stats are // stored in a contiguous linear buffer. Stats groups are stored one after
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Mon Feb 17 11:59:45 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Mon Feb 17 12:15:16 2014 UTC
@@ -1554,9 +1554,7 @@
     set_pretenure_decision(result);
     if (current_mode != GetPretenureMode()) {
       decision_changed = true;
-      dependent_code()->MarkCodeForDeoptimization(
-          GetIsolate(),
-          DependentCode::kAllocationSiteTenuringChangedGroup);
+      set_deopt_dependent_code(true);
     }
   }

=======================================
--- /branches/bleeding_edge/src/objects.h       Mon Feb 17 12:08:06 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Mon Feb 17 12:15:16 2014 UTC
@@ -8256,8 +8256,9 @@
   class DoNotInlineBit:         public BitField<bool,         29,  1> {};

   // Bitfields for pretenure_data
-  class MementoFoundCountBits:  public BitField<int,          0, 28> {};
- class PretenureDecisionBits: public BitField<PretenureDecision, 28, 2> {}; + class MementoFoundCountBits: public BitField<int, 0, 27> {}; + class PretenureDecisionBits: public BitField<PretenureDecision, 27, 2> {}; + class DeoptDependentCodeBit: public BitField<bool, 29, 1> {}; STATIC_ASSERT(PretenureDecisionBits::kMax >= kLastPretenureDecisionValue);

   // Increments the mementos found counter and returns true when the first
@@ -8281,6 +8282,18 @@
         Smi::FromInt(PretenureDecisionBits::update(value, decision)),
         SKIP_WRITE_BARRIER);
   }
+
+  bool deopt_dependent_code() {
+    int value = pretenure_data()->value();
+    return DeoptDependentCodeBit::decode(value);
+  }
+
+  void set_deopt_dependent_code(bool deopt) {
+    int value = pretenure_data()->value();
+    set_pretenure_data(
+        Smi::FromInt(DeoptDependentCodeBit::update(value, deopt)),
+        SKIP_WRITE_BARRIER);
+  }

   int memento_found_count() {
     int value = pretenure_data()->value();

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