Debugger: do not compile IC for accessors when debugging.

The invariant is that as long as there is a debug info on
the shared function info, no accessor IC is compiled for
its code. That way we can guarantee that stepping into
accessors, which requires a debug info, works for accessors.

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

Cr-Commit-Position: refs/heads/master@{#29546}
This commit is contained in:
yangguo 2015-07-09 00:05:28 -07:00 committed by Commit bot
parent a415f59458
commit 3dcb5171e9
3 changed files with 12 additions and 7 deletions

View File

@ -1351,7 +1351,7 @@ void Debug::PrepareStep(StepAction step_action,
}
}
ActivateStepIn(function, frame);
ActivateStepIn(frame);
}
// Fill the current function with one-shot break points even for step in on
@ -1509,12 +1509,8 @@ void Debug::ClearOneShot() {
}
void Debug::ActivateStepIn(Handle<JSFunction> function, StackFrame* frame) {
void Debug::ActivateStepIn(StackFrame* frame) {
DCHECK(!StepOutActive());
// Make sure IC state is clean. This is so that we correct flood
// accessor pairs when stepping in.
function->code()->ClearInlineCaches();
function->shared()->feedback_vector()->ClearICSlots(function->shared());
thread_local_.step_into_fp_ = frame->UnpaddedFP();
}
@ -2070,6 +2066,11 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
return false;
}
// Make sure IC state is clean. This is so that we correctly flood
// accessor pairs when stepping in.
shared->code()->ClearInlineCaches();
shared->feedback_vector()->ClearICSlots(*shared);
// Create the debug info object.
Handle<DebugInfo> debug_info = isolate->factory()->NewDebugInfo(shared);

View File

@ -624,7 +624,7 @@ class Debug {
static bool CompileDebuggerScript(Isolate* isolate, int index);
void ClearOneShot();
void ActivateStepIn(Handle<JSFunction> function, StackFrame* frame);
void ActivateStepIn(StackFrame* frame);
void ClearStepIn();
void ActivateStepOut(StackFrame* frame);
void ClearStepNext();

View File

@ -1210,6 +1210,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
isolate());
if (!getter->IsJSFunction()) break;
if (!holder->HasFastProperties()) break;
// When debugging we need to go the slow path to flood the accessor.
if (!GetSharedFunctionInfo()->debug_info()->IsUndefined()) break;
Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
if (!receiver->IsJSObject() && !function->IsBuiltin() &&
is_sloppy(function->shared()->language_mode())) {
@ -1786,6 +1788,8 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup,
TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function");
break;
}
// When debugging we need to go the slow path to flood the accessor.
if (!GetSharedFunctionInfo()->debug_info()->IsUndefined()) break;
Handle<JSFunction> function = Handle<JSFunction>::cast(setter);
CallOptimization call_optimization(function);
NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);