[debug] remove obsolete handling for suspended generator objects.

R=mstarzinger@chromium.org, neis@chromium.org

BUG=v8:5657

Review-Url: https://codereview.chromium.org/2526763002
Cr-Commit-Position: refs/heads/master@{#41225}
This commit is contained in:
yangguo 2016-11-23 05:56:33 -08:00 committed by Commit bot
parent da72a3176f
commit 47e30e4258

View File

@ -1176,20 +1176,6 @@ static Address ComputeNewPcForRedirect(Code* new_code, Code* old_code,
}
// Count the number of continuations at which the current pc offset is at.
static int ComputeContinuationIndexFromPcOffset(Code* code, int pc_offset) {
UNREACHABLE();
return 666;
}
// Find the pc offset for the given continuation index.
static int ComputePcOffsetFromContinuationIndex(Code* code, int index) {
UNREACHABLE();
return 666;
}
class RedirectActiveFunctions : public ThreadVisitor {
public:
explicit RedirectActiveFunctions(SharedFunctionInfo* shared)
@ -1253,7 +1239,6 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
}
List<Handle<JSFunction> > functions;
List<Handle<JSGeneratorObject> > suspended_generators;
// Flush all optimized code maps. Note that the below heap iteration does not
// cover this, because the given function might have been inlined into code
@ -1278,10 +1263,6 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
// smarter here and avoid the heap walk.
HeapIterator iterator(isolate_->heap());
HeapObject* obj;
// Continuation from old-style generators need to be recomputed.
// TODO(yangguo): Remove code for old-style generators.
bool find_resumables =
baseline_exists && IsResumableFunction(shared->kind());
while ((obj = iterator.next())) {
if (obj->IsJSFunction()) {
@ -1293,25 +1274,12 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
if (baseline_exists && function->shared() == *shared) {
functions.Add(handle(function));
}
} else if (find_resumables && obj->IsJSGeneratorObject()) {
// This case handles async functions as well, as they use generator
// objects for in-progress async function execution.
JSGeneratorObject* generator_obj = JSGeneratorObject::cast(obj);
if (!generator_obj->is_suspended()) continue;
JSFunction* function = generator_obj->function();
if (!function->Inlines(*shared)) continue;
int pc_offset = generator_obj->continuation();
int index =
ComputeContinuationIndexFromPcOffset(function->code(), pc_offset);
generator_obj->set_continuation(index);
suspended_generators.Add(handle(generator_obj));
}
}
}
// We do not need to replace code to debug bytecode.
DCHECK(baseline_exists || functions.is_empty());
DCHECK(baseline_exists || suspended_generators.is_empty());
// We do not need to recompile to debug bytecode.
if (baseline_exists && !shared->code()->has_debug_break_slots()) {
@ -1323,12 +1291,6 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
JSFunction::EnsureLiterals(function);
}
for (Handle<JSGeneratorObject> const generator_obj : suspended_generators) {
int index = generator_obj->continuation();
int pc_offset = ComputePcOffsetFromContinuationIndex(shared->code(), index);
generator_obj->set_continuation(pc_offset);
}
// Update PCs on the stack to point to recompiled code.
RedirectActiveFunctions redirect_visitor(*shared);
redirect_visitor.VisitThread(isolate_, isolate_->thread_local_top());