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

Unified Diff: src/runtime/runtime-debug.cc

Issue 1233073005: Debugger: prepare code for debugging on a per-function basis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments. Created 5 years, 5 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/objects-inl.h ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-debug.cc
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index aff5ec996c6fec92aa326c289b813543ad37d847..f4c81c8c72b5ff499e66276462245f70e7acadb2 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -1396,14 +1396,14 @@ class ScopeIterator {
// Later we may optimize getting the nested scopes (cache the result?)
// and include nested scopes into the "fast" iteration case as well.
- if (!ignore_nested_scopes && !shared_info->debug_info()->IsUndefined()) {
+ if (!ignore_nested_scopes && shared_info->HasDebugInfo()) {
// The source position at return is always the end of the function,
// which is not consistent with the current scope chain. Therefore all
// nested with, catch and block contexts are skipped, and we can only
// inspect the function scope.
// This can only happen if we set a break point inside right before the
// return, which requires a debug info to be available.
- Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared_info);
+ Handle<DebugInfo> debug_info(shared_info->GetDebugInfo());
// PC points to the instruction after the current one, possibly a break
// location as well. So the "- 1" to exclude it from the search.
@@ -1818,59 +1818,14 @@ RUNTIME_FUNCTION(Runtime_GetStepInPositions) {
JavaScriptFrameIterator frame_it(isolate, id);
RUNTIME_ASSERT(!frame_it.done());
- List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
- frame_it.frame()->Summarize(&frames);
- FrameSummary summary = frames.first();
-
- Handle<JSFunction> fun = Handle<JSFunction>(summary.function());
- Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>(fun->shared());
-
- if (!isolate->debug()->EnsureDebugInfo(shared, fun)) {
- return isolate->heap()->undefined_value();
- }
-
- Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared);
-
- // Find range of break points starting from the break point where execution
- // has stopped.
- Address call_pc = summary.pc() - 1;
- List<BreakLocation> locations;
- BreakLocation::FromAddressSameStatement(debug_info, ALL_BREAK_LOCATIONS,
- call_pc, &locations);
-
- Handle<JSArray> array = isolate->factory()->NewJSArray(locations.length());
-
- int index = 0;
- for (BreakLocation location : locations) {
- bool accept;
- if (location.pc() > summary.pc()) {
- accept = true;
- } else {
- StackFrame::Id break_frame_id = isolate->debug()->break_frame_id();
- // The break point is near our pc. Could be a step-in possibility,
- // that is currently taken by active debugger call.
- if (break_frame_id == StackFrame::NO_ID) {
- // We are not stepping.
- accept = false;
- } else {
- JavaScriptFrameIterator additional_frame_it(isolate, break_frame_id);
- // If our frame is a top frame and we are stepping, we can do step-in
- // at this place.
- accept = additional_frame_it.frame()->id() == id;
- }
- }
- if (accept) {
- if (location.IsStepInLocation()) {
- Smi* position_value = Smi::FromInt(location.position());
- RETURN_FAILURE_ON_EXCEPTION(
- isolate,
- Object::SetElement(isolate, array, index,
- handle(position_value, isolate), SLOPPY));
- index++;
- }
- }
+ List<int> positions;
+ isolate->debug()->GetStepinPositions(frame_it.frame(), id, &positions);
+ Factory* factory = isolate->factory();
+ Handle<FixedArray> array = factory->NewFixedArray(positions.length());
+ for (int i = 0; i < positions.length(); ++i) {
+ array->set(i, Smi::FromInt(positions[i]));
}
- return *array;
+ return *factory->NewJSArrayWithElements(array, FAST_SMI_ELEMENTS);
}
« no previous file with comments | « src/objects-inl.h ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698