Reviewers: ulan, Hannes Payer,
Description:
Support full deoptimization during GC via stack guard.
This adds support to the stack guard to trigger a full deoptimization of
all optimized code when the GC kicks into high promotion mode. Global
pretenuring decisions in optimized code can then be based on the high
promotion mode.
R=u...@chromium.org
Please review this at https://codereview.chromium.org/14173007/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/execution.h
M src/execution.cc
M src/heap.h
M src/heap.cc
Index: src/execution.cc
diff --git a/src/execution.cc b/src/execution.cc
index
dee31126829f55095662a3e1e6e9b402ff6b478f..f343868060da516624815c727dbe526ebc116c7a
100644
--- a/src/execution.cc
+++ b/src/execution.cc
@@ -33,6 +33,7 @@
#include "bootstrapper.h"
#include "codegen.h"
#include "debug.h"
+#include "deoptimizer.h"
#include "isolate-inl.h"
#include "runtime-profiler.h"
#include "simulator.h"
@@ -448,6 +449,19 @@ void StackGuard::RequestGC() {
}
+bool StackGuard::IsFullDeopt() {
+ ExecutionAccess access(isolate_);
+ return (thread_local_.interrupt_flags_ & FULL_DEOPT) != 0;
+}
+
+
+void StackGuard::FullDeopt() {
+ ExecutionAccess access(isolate_);
+ thread_local_.interrupt_flags_ |= FULL_DEOPT;
+ set_interrupt_limits(access);
+}
+
+
#ifdef ENABLE_DEBUGGER_SUPPORT
bool StackGuard::IsDebugBreak() {
ExecutionAccess access(isolate_);
@@ -880,7 +894,6 @@ MaybeObject*
Execution::HandleStackGuardInterrupt(Isolate* isolate) {
stack_guard->Continue(GC_REQUEST);
}
-
isolate->counters()->stack_interrupts()->Increment();
isolate->counters()->runtime_profiler_ticks()->Increment();
isolate->runtime_profiler()->OptimizeNow();
@@ -898,6 +911,10 @@ MaybeObject*
Execution::HandleStackGuardInterrupt(Isolate* isolate) {
stack_guard->Continue(INTERRUPT);
return isolate->StackOverflow();
}
+ if (stack_guard->IsFullDeopt()) {
+ stack_guard->Continue(FULL_DEOPT);
+ Deoptimizer::DeoptimizeAll(isolate);
+ }
return isolate->heap()->undefined_value();
}
Index: src/execution.h
diff --git a/src/execution.h b/src/execution.h
index
b104180c9e0c1c87c71213c389dc2ec05601303c..9cf8ac649c9e683f6a8254bf3559ceedaf1326cc
100644
--- a/src/execution.h
+++ b/src/execution.h
@@ -41,7 +41,8 @@ enum InterruptFlag {
DEBUGCOMMAND = 1 << 2,
PREEMPT = 1 << 3,
TERMINATE = 1 << 4,
- GC_REQUEST = 1 << 5
+ GC_REQUEST = 1 << 5,
+ FULL_DEOPT = 1 << 6
};
@@ -197,6 +198,8 @@ class StackGuard {
#endif
bool IsGCRequest();
void RequestGC();
+ bool IsFullDeopt();
+ void FullDeopt();
void Continue(InterruptFlag after_what);
// This provides an asynchronous read of the stack limits for the current
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
f71d9cc8f836e2f13f1bcb9fc35df5f1d03a649e..2aa699946e5323be62e086456a68ef643dfb900c
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -952,6 +952,13 @@ bool Heap::PerformGarbageCollection(GarbageCollector
collector,
PrintPID("Limited new space size due to high promotion rate: %d
MB\n",
new_space_.InitialCapacity() / MB);
}
+ // Support for global pre-tenuring uses the high promotion mode as a
+ // heuristic indicator of whether to pretenure or not, we trigger
+ // deoptimization here to take advantage of pre-tenuring as soon as
+ // possible.
+ if (FLAG_pretenure_literals) {
+ isolate_->stack_guard()->FullDeopt();
+ }
} else if (new_space_high_promotion_mode_active_ &&
IsStableOrDecreasingSurvivalTrend() &&
IsLowSurvivalRate()) {
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index
9e758aaa06441317d2952d32feb9eddb2a34de6f..46c75fe141efb7789d6eebc52508543952c2dd13
100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -1498,6 +1498,12 @@ class Heap {
MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length,
PretenureFlag
pretenure);
+ // Predicate that governs global pre-tenuring decisions based on observed
+ // promotion rates of previous collections.
+ inline bool ShouldGloballyPretenure() {
+ return new_space_high_promotion_mode_active_;
+ }
+
inline intptr_t PromotedTotalSize() {
return PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize();
}
--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.