Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: src/debug/debug.cc

Issue 2237423002: [debugger] PrepareFunctionForBreakPoints handles both fcg code and bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler.cc ('k') | src/objects-inl.h » ('j') | src/objects-inl.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index 22a8b49016132f07e9786a3f162d2f5b080cdfcc..6495dce2e2f1caeb3d5cd19493feb157512b9b0a 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -1283,7 +1283,7 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
"prepare for break points");
DCHECK(shared->is_compiled());
- bool is_interpreted = shared->HasBytecodeArray();
+ bool baseline_exists = shared->HasBaselineCode();
{
// TODO(yangguo): with bytecode, we still walk the heap to find all
@@ -1291,7 +1291,8 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
// smarter here and avoid the heap walk.
HeapIterator iterator(isolate_->heap());
HeapObject* obj;
- bool find_resumables = !is_interpreted && shared->is_resumable();
+ // Continuation from old-style generators need to be recomputed.
+ bool find_resumables = baseline_exists && shared->is_resumable();
while ((obj = iterator.next())) {
if (obj->IsJSFunction()) {
@@ -1300,8 +1301,9 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) {
Deoptimizer::DeoptimizeFunction(function);
}
- if (is_interpreted) continue;
- if (function->shared() == *shared) functions.Add(handle(function));
+ 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.
@@ -1319,11 +1321,11 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
}
// We do not need to replace code to debug bytecode.
- DCHECK(!is_interpreted || functions.length() == 0);
- DCHECK(!is_interpreted || suspended_generators.length() == 0);
+ DCHECK(baseline_exists || functions.is_empty());
+ DCHECK(baseline_exists || suspended_generators.is_empty());
// We do not need to recompile to debug bytecode.
- if (!is_interpreted && !shared->HasDebugCode()) {
+ if (baseline_exists && !shared->HasDebugCode()) {
DCHECK(functions.length() > 0);
if (!Compiler::CompileDebugCode(functions.first())) return false;
}
@@ -1502,23 +1504,17 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
return false;
}
- if (shared->HasBytecodeArray()) {
- // To prepare bytecode for debugging, we already need to have the debug
- // info (containing the debug copy) upfront, but since we do not recompile,
- // preparing for break points cannot fail.
- CreateDebugInfo(shared);
- CHECK(PrepareFunctionForBreakPoints(shared));
- } else {
- if (!PrepareFunctionForBreakPoints(shared)) return false;
- CreateDebugInfo(shared);
- }
+ // To prepare bytecode for debugging, we already need to have the debug
+ // info (containing the debug copy) upfront, but since we do not recompile,
+ // preparing for break points cannot fail.
+ CreateDebugInfo(shared);
+ CHECK(PrepareFunctionForBreakPoints(shared));
return true;
}
void Debug::CreateDebugInfo(Handle<SharedFunctionInfo> shared) {
// Create the debug info object.
- DCHECK(shared->HasDebugCode());
Handle<DebugInfo> debug_info = isolate_->factory()->NewDebugInfo(shared);
// Add debug info to the list.
« no previous file with comments | « src/compiler.cc ('k') | src/objects-inl.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698