Index: src/debug/debug.cc |
diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
index a34f2df6968d603088a623b3bd4a65954565c45f..3b8243d433dc8a5c41fa5ac15b383d331bc9eabf 100644 |
--- a/src/debug/debug.cc |
+++ b/src/debug/debug.cc |
@@ -1328,8 +1328,7 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { |
// We do not need to recompile to debug bytecode. |
if (baseline_exists && !shared->code()->has_debug_break_slots()) { |
- DCHECK(functions.length() > 0); |
- if (!Compiler::CompileDebugCode(functions.first())) return false; |
+ if (!Compiler::CompileDebugCode(shared)) return false; |
} |
for (Handle<JSFunction> const function : functions) { |
@@ -1406,6 +1405,8 @@ bool Debug::GetPossibleBreakpoints(Handle<Script> script, int start_position, |
bool was_compiled = false; |
for (int i = 0; i < candidates.length(); ++i) { |
+ // Code that cannot be compiled lazily are internal and not debuggable. |
+ DCHECK(candidates[i]->allows_lazy_compilation()); |
if (!candidates[i]->HasDebugCode()) { |
if (!Compiler::CompileDebugCode(candidates[i])) { |
return false; |
@@ -1527,44 +1528,11 @@ Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script, |
return shared_handle; |
} |
} |
- // If not, compile to reveal inner functions, if possible. |
- if (shared->allows_lazy_compilation()) { |
- HandleScope scope(isolate_); |
- if (!Compiler::CompileDebugCode(handle(shared))) break; |
- continue; |
- } |
- |
- // If not possible, comb the heap for the best suitable compile target. |
- JSFunction* closure; |
- { |
- HeapIterator it(isolate_->heap()); |
- SharedFunctionInfoFinder finder(position); |
- while (HeapObject* object = it.next()) { |
- JSFunction* candidate_closure = NULL; |
- SharedFunctionInfo* candidate = NULL; |
- if (object->IsJSFunction()) { |
- candidate_closure = JSFunction::cast(object); |
- candidate = candidate_closure->shared(); |
- } else if (object->IsSharedFunctionInfo()) { |
- candidate = SharedFunctionInfo::cast(object); |
- if (!candidate->allows_lazy_compilation()) continue; |
- } else { |
- continue; |
- } |
- if (candidate->script() == *script) { |
- finder.NewCandidate(candidate, candidate_closure); |
- } |
- } |
- closure = finder.ResultClosure(); |
- shared = finder.Result(); |
- } |
- if (shared == NULL) break; |
+ // If not, compile to reveal inner functions. |
HandleScope scope(isolate_); |
- if (closure == NULL) { |
- if (!Compiler::CompileDebugCode(handle(shared))) break; |
- } else { |
- if (!Compiler::CompileDebugCode(handle(closure))) break; |
- } |
+ // Code that cannot be compiled lazily are internal and not debuggable. |
+ DCHECK(shared->allows_lazy_compilation()); |
+ if (!Compiler::CompileDebugCode(handle(shared))) break; |
} |
return isolate_->factory()->undefined_value(); |
} |