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

Unified Diff: src/debug/debug.cc

Issue 1454673002: Debugger: speed up setting break points in nested SFI. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix condition Created 5 years, 1 month 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/debug/debug.h ('k') | no next file » | no next file with comments »
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 d6b4ebb62271092029783e50cdad6c6e698ea53c..9e7fc53ae8cdf8354cb1c6eb8efe565bd9212687 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -1377,6 +1377,7 @@ class SharedFunctionInfoFinder {
target_position_(target_position) {}
void NewCandidate(SharedFunctionInfo* shared, JSFunction* closure = NULL) {
+ if (!shared->IsSubjectToDebugging()) return;
int start_position = shared->function_token_position();
if (start_position == RelocInfo::kNoPosition) {
start_position = shared->start_position();
@@ -1426,7 +1427,7 @@ class SharedFunctionInfoFinder {
// cannot be compiled without context (need to find outer compilable SFI etc.)
Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script,
int position) {
- while (true) {
+ for (int iteration = 0;; iteration++) {
// Go through all shared function infos associated with this script to
// find the inner most function containing this position.
// If there is no shared function info for this script at all, there is
@@ -1444,7 +1445,18 @@ Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script,
shared = finder.Result();
if (shared == NULL) break;
// We found it if it's already compiled and has debug code.
- if (shared->HasDebugCode()) return handle(shared);
+ if (shared->HasDebugCode()) {
+ Handle<SharedFunctionInfo> shared_handle(shared);
+ // If the iteration count is larger than 1, we had to compile the outer
+ // function in order to create this shared function info. So there can
+ // be no JSFunction referencing it. We can anticipate creating a debug
+ // info while bypassing PrepareFunctionForBreakpoints.
+ if (iteration > 1) {
+ AllowHeapAllocation allow_before_return;
+ CreateDebugInfo(shared_handle);
+ }
+ return shared_handle;
+ }
}
// If not, compile to reveal inner functions, if possible.
if (shared->allows_lazy_compilation_without_context()) {
@@ -1509,6 +1521,13 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
shared->code()->ClearInlineCaches();
shared->ClearTypeFeedbackInfo();
+ CreateDebugInfo(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);
@@ -1517,8 +1536,6 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
DebugInfoListNode* node = new DebugInfoListNode(*debug_info);
node->set_next(debug_info_list_);
debug_info_list_ = node;
-
- return true;
}
« no previous file with comments | « src/debug/debug.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698