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

Unified Diff: src/runtime.cc

Issue 23264015: In reporting step-in positions be more accurate with a position the debugger paused at (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: clean Created 7 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
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 10de6f9e5ec001c595a0b86632599f9be9a22074..72c70f686634e797ca5581b3b44b8a745a075d41 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -12019,6 +12019,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) {
// Get the frame where the debugging is performed.
StackFrame::Id id = UnwrapFrameId(wrapped_id);
JavaScriptFrameIterator frame_it(isolate, id);
+ if (frame_it.done()) {
Yang 2013/08/26 13:52:02 you could use RUNTIME_CHECK(!frame_it.done()) here
Peter.Rybin 2013/08/31 16:58:07 I guess you meant RUNTIME_ASSERT Done
+ return isolate->ThrowIllegalOperation();
+ }
+
JavaScriptFrame* frame = frame_it.frame();
Handle<JSFunction> fun =
@@ -12038,11 +12042,28 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) {
BreakLocationIterator break_location_iterator(debug_info,
ALL_BREAK_LOCATIONS);
- break_location_iterator.FindBreakLocationFromAddress(frame->pc());
+ break_location_iterator.FindBreakLocationFromAddress(frame->pc() - 1);
int current_statement_pos = break_location_iterator.statement_position();
while (!break_location_iterator.Done()) {
+ bool accept;
if (break_location_iterator.pc() > frame->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 (break_location_iterator.IsStepInLocation(isolate)) {
Smi* position_value = Smi::FromInt(break_location_iterator.position());
JSObject::SetElement(array, len,

Powered by Google App Engine
This is Rietveld 408576698