Commit 3dcb5171 authored by yangguo's avatar yangguo Committed by Commit bot

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}
parent a415f594
...@@ -1351,7 +1351,7 @@ void Debug::PrepareStep(StepAction step_action, ...@@ -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 // Fill the current function with one-shot break points even for step in on
...@@ -1509,12 +1509,8 @@ void Debug::ClearOneShot() { ...@@ -1509,12 +1509,8 @@ void Debug::ClearOneShot() {
} }
void Debug::ActivateStepIn(Handle<JSFunction> function, StackFrame* frame) { void Debug::ActivateStepIn(StackFrame* frame) {
DCHECK(!StepOutActive()); 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(); thread_local_.step_into_fp_ = frame->UnpaddedFP();
} }
...@@ -2070,6 +2066,11 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared, ...@@ -2070,6 +2066,11 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
return false; 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. // Create the debug info object.
Handle<DebugInfo> debug_info = isolate->factory()->NewDebugInfo(shared); Handle<DebugInfo> debug_info = isolate->factory()->NewDebugInfo(shared);
......
...@@ -624,7 +624,7 @@ class Debug { ...@@ -624,7 +624,7 @@ class Debug {
static bool CompileDebuggerScript(Isolate* isolate, int index); static bool CompileDebuggerScript(Isolate* isolate, int index);
void ClearOneShot(); void ClearOneShot();
void ActivateStepIn(Handle<JSFunction> function, StackFrame* frame); void ActivateStepIn(StackFrame* frame);
void ClearStepIn(); void ClearStepIn();
void ActivateStepOut(StackFrame* frame); void ActivateStepOut(StackFrame* frame);
void ClearStepNext(); void ClearStepNext();
......
...@@ -1210,6 +1210,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup, ...@@ -1210,6 +1210,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
isolate()); isolate());
if (!getter->IsJSFunction()) break; if (!getter->IsJSFunction()) break;
if (!holder->HasFastProperties()) 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); Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
if (!receiver->IsJSObject() && !function->IsBuiltin() && if (!receiver->IsJSObject() && !function->IsBuiltin() &&
is_sloppy(function->shared()->language_mode())) { is_sloppy(function->shared()->language_mode())) {
...@@ -1786,6 +1788,8 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup, ...@@ -1786,6 +1788,8 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup,
TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function"); TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function");
break; 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); Handle<JSFunction> function = Handle<JSFunction>::cast(setter);
CallOptimization call_optimization(function); CallOptimization call_optimization(function);
NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);
......
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