Commit 56b7a5fa authored by yangguo's avatar yangguo Committed by Commit bot

Revert of [debugger] reapply break points after clearing one shots. (patchset...

Revert of [debugger] reapply break points after clearing one shots. (patchset #1 id:1 of https://codereview.chromium.org/2221333002/ )

Reason for revert:
Found better solution.

Original issue's description:
> [debugger] reapply break points after clearing one shots.
>
> On the debug info, we have a list of existing break points.  When we
> step in the debugger, we flood the function with one-shot break points.
> Afterwards, we clear these one-shots by clearing all break locations.
>
> Previously, while clearing break locations, we would skip ones that have
> actual break points. Now we clear all break locations, and then reapply
> break points. This is necessary for the next step, when we encode break
> point info by source position, and not code offset. Encoding by code
> offset would mean that break points are dependent on the code kind we
> use.
>
> R=jgruber@chromium.org
> BUG=v8:5265
>
> Committed: https://crrev.com/808981a22ee19461bbe981ab33b58792d991533e
> Cr-Commit-Position: refs/heads/master@{#38492}

TBR=jgruber@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:5265

Review-Url: https://codereview.chromium.org/2231653003
Cr-Commit-Position: refs/heads/master@{#38521}
parent 3899776f
......@@ -336,13 +336,6 @@ void BreakLocation::ClearBreakPoint(Handle<Object> break_point_object) {
}
}
void BreakLocation::ReapplyBreakPoint() {
// We indeed have a break point here to re-apply.
DCHECK(HasBreakPoint());
// The break point is currently not applied to code.
DCHECK(!IsDebugBreak());
SetDebugBreak();
}
void BreakLocation::SetOneShot() {
// Debugger statement always calls debugger. No need to modify it.
......@@ -363,6 +356,12 @@ void BreakLocation::ClearOneShot() {
// Debugger statement always calls debugger. No need to modify it.
if (IsDebuggerStatement()) return;
// If there is a real break point here no more to do.
if (HasBreakPoint()) {
DCHECK(IsDebugBreak());
return;
}
// Patch code removing debug break.
ClearDebugBreak();
DCHECK(!IsDebugBreak());
......@@ -1128,28 +1127,13 @@ void Debug::ClearOneShot() {
// The current implementation just runs through all the breakpoints. When the
// last break point for a function is removed that function is automatically
// removed from the list.
DisallowHeapAllocation no_gc;
for (DebugInfoListNode* node = debug_info_list_; node != NULL;
node = node->next()) {
Handle<DebugInfo> debug_info = node->debug_info();
for (std::unique_ptr<BreakLocation::Iterator> it(
BreakLocation::GetIterator(debug_info));
BreakLocation::GetIterator(node->debug_info()));
!it->Done(); it->Next()) {
it->GetBreakLocation().ClearOneShot();
}
// Re-apply break points after having cleared everything.
if (debug_info->break_points()->IsUndefined(isolate_)) continue;
FixedArray* break_points = debug_info->break_points();
for (int i = 0; i < break_points->length(); i++) {
if (break_points->get(i)->IsUndefined(isolate_)) continue;
BreakPointInfo* break_point_info =
BreakPointInfo::cast(break_points->get(i));
if (break_point_info->GetBreakPointCount() == 0) continue;
BreakLocation break_location = BreakLocation::FromPosition(
debug_info, break_point_info->source_position(),
BREAK_POSITION_ALIGNED);
break_location.ReapplyBreakPoint();
}
}
}
......
......@@ -97,7 +97,6 @@ class BreakLocation {
void SetBreakPoint(Handle<Object> break_point_object);
void ClearBreakPoint(Handle<Object> break_point_object);
void ReapplyBreakPoint();
void SetOneShot();
void ClearOneShot();
......
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