Commit 76284bdc authored by hpayer@chromium.org's avatar hpayer@chromium.org

Deopt marked code at safe deoptimization point when pretenuring.

BUG=
R=bmeurer@chromium.org, mvstanton@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18641 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 95b0c6eb
......@@ -502,6 +502,19 @@ void StackGuard::FullDeopt() {
}
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
bool StackGuard::IsDebugBreak() {
ExecutionAccess access(isolate_);
......@@ -1013,6 +1026,10 @@ MaybeObject* Execution::HandleStackGuardInterrupt(Isolate* isolate) {
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);
......
......@@ -44,7 +44,8 @@ enum InterruptFlag {
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 @@ class StackGuard {
void RequestInstallCode();
bool IsFullDeopt();
void FullDeopt();
bool IsDeoptMarkedCode();
void DeoptMarkedCode();
void Continue(InterruptFlag after_what);
void RequestInterrupt(InterruptCallback callback, void* data);
......
......@@ -521,6 +521,7 @@ void Heap::ProcessPretenuringFeedback() {
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 @@ void Heap::ProcessPretenuringFeedback() {
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 @@ void Heap::ProcessPretenuringFeedback() {
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 @@ void Heap::ResetAllAllocationSitesDependentCode(PretenureFlag flag) {
}
cur = casted->weak_next();
}
if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate_);
if (marked) isolate_->stack_guard()->DeoptMarkedCode();
}
......
......@@ -1397,7 +1397,7 @@ inline void AllocationSite::IncrementMementoCreateCount() {
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 @@ inline bool AllocationSite::DigestPretenuringFeedback() {
? 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 @@ inline bool AllocationSite::DigestPretenuringFeedback() {
// Clear feedback calculation fields until the next gc.
set_memento_found_count(0);
set_memento_create_count(0);
return decision_made;
return decision_changed;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment