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

Unified Diff: src/debug.cc

Issue 1037013002: Reland: Debugger: deduplicate shared function info when setting script break points. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 9 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/liveedit.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 7f96ddc4ad4dcff1014f5cd81ead1add60a746ab..32cbf6f8e6f538834289cbfbda30e786bb4dfdab 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1506,23 +1506,22 @@ Handle<Object> Debug::GetSourceBreakLocations(
Handle<FixedArray> locations =
isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount());
int count = 0;
- for (int i = 0; i < debug_info->break_points()->length(); i++) {
+ for (int i = 0; i < debug_info->break_points()->length(); ++i) {
if (!debug_info->break_points()->get(i)->IsUndefined()) {
BreakPointInfo* break_point_info =
BreakPointInfo::cast(debug_info->break_points()->get(i));
- if (break_point_info->GetBreakPointCount() > 0) {
- Smi* position = NULL;
- switch (position_alignment) {
- case STATEMENT_ALIGNED:
- position = break_point_info->statement_position();
- break;
- case BREAK_POSITION_ALIGNED:
- position = break_point_info->source_position();
- break;
- }
-
- locations->set(count++, position);
+ int break_points = break_point_info->GetBreakPointCount();
+ if (break_points == 0) continue;
+ Smi* position = NULL;
+ switch (position_alignment) {
+ case STATEMENT_ALIGNED:
+ position = break_point_info->statement_position();
+ break;
+ case BREAK_POSITION_ALIGNED:
+ position = break_point_info->source_position();
+ break;
}
+ for (int j = 0; j < break_points; ++j) locations->set(count++, position);
}
}
return locations;
@@ -1822,7 +1821,6 @@ static void RecompileAndRelocateSuspendedGenerators(
static bool SkipSharedFunctionInfo(SharedFunctionInfo* shared,
Object* active_code_marker) {
if (!shared->allows_lazy_compilation()) return true;
- if (!shared->script()->IsScript()) return true;
Object* script = shared->script();
if (!script->IsScript()) return true;
if (Script::cast(script)->type()->value() == Script::TYPE_NATIVE) return true;
@@ -2103,6 +2101,21 @@ Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script,
}
} // End while loop.
+ // JSFunctions from the same literal may not have the same shared function
+ // info. Find those JSFunctions and deduplicate the shared function info.
+ HeapIterator iterator(heap, FLAG_lazy ? HeapIterator::kNoFiltering
+ : HeapIterator::kFilterUnreachable);
+ for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
+ if (!obj->IsJSFunction()) continue;
+ JSFunction* function = JSFunction::cast(obj);
+ SharedFunctionInfo* shared = function->shared();
+ if (shared != *target && shared->script() == target->script() &&
+ shared->start_position_and_type() ==
+ target->start_position_and_type()) {
+ function->set_shared(*target);
+ }
+ }
+
return target;
}
« no previous file with comments | « src/compiler.cc ('k') | src/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698