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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 12001 matching lines...) Expand 10 before | Expand all | Expand 10 after
12012 Object* check; 12012 Object* check;
12013 { MaybeObject* maybe_check = Runtime_CheckExecutionState( 12013 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
12014 RUNTIME_ARGUMENTS(isolate, args)); 12014 RUNTIME_ARGUMENTS(isolate, args));
12015 if (!maybe_check->ToObject(&check)) return maybe_check; 12015 if (!maybe_check->ToObject(&check)) return maybe_check;
12016 } 12016 }
12017 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); 12017 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
12018 12018
12019 // Get the frame where the debugging is performed. 12019 // Get the frame where the debugging is performed.
12020 StackFrame::Id id = UnwrapFrameId(wrapped_id); 12020 StackFrame::Id id = UnwrapFrameId(wrapped_id);
12021 JavaScriptFrameIterator frame_it(isolate, id); 12021 JavaScriptFrameIterator frame_it(isolate, id);
12022 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
12023 return isolate->ThrowIllegalOperation();
12024 }
12025
12022 JavaScriptFrame* frame = frame_it.frame(); 12026 JavaScriptFrame* frame = frame_it.frame();
12023 12027
12024 Handle<JSFunction> fun = 12028 Handle<JSFunction> fun =
12025 Handle<JSFunction>(frame->function()); 12029 Handle<JSFunction>(frame->function());
12026 Handle<SharedFunctionInfo> shared = 12030 Handle<SharedFunctionInfo> shared =
12027 Handle<SharedFunctionInfo>(fun->shared()); 12031 Handle<SharedFunctionInfo>(fun->shared());
12028 12032
12029 if (!isolate->debug()->EnsureDebugInfo(shared, fun)) { 12033 if (!isolate->debug()->EnsureDebugInfo(shared, fun)) {
12030 return isolate->heap()->undefined_value(); 12034 return isolate->heap()->undefined_value();
12031 } 12035 }
12032 12036
12033 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared); 12037 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared);
12034 12038
12035 int len = 0; 12039 int len = 0;
12036 Handle<JSArray> array(isolate->factory()->NewJSArray(10)); 12040 Handle<JSArray> array(isolate->factory()->NewJSArray(10));
12037 // Find the break point where execution has stopped. 12041 // Find the break point where execution has stopped.
12038 BreakLocationIterator break_location_iterator(debug_info, 12042 BreakLocationIterator break_location_iterator(debug_info,
12039 ALL_BREAK_LOCATIONS); 12043 ALL_BREAK_LOCATIONS);
12040 12044
12041 break_location_iterator.FindBreakLocationFromAddress(frame->pc()); 12045 break_location_iterator.FindBreakLocationFromAddress(frame->pc() - 1);
12042 int current_statement_pos = break_location_iterator.statement_position(); 12046 int current_statement_pos = break_location_iterator.statement_position();
12043 12047
12044 while (!break_location_iterator.Done()) { 12048 while (!break_location_iterator.Done()) {
12049 bool accept;
12045 if (break_location_iterator.pc() > frame->pc()) { 12050 if (break_location_iterator.pc() > frame->pc()) {
12051 accept = true;
12052 } else {
12053 StackFrame::Id break_frame_id = isolate->debug()->break_frame_id();
12054 // The break point is near our pc. Could be a step-in possibility,
12055 // that is currently taken by active debugger call.
12056 if (break_frame_id == StackFrame::NO_ID) {
12057 // We are not stepping.
12058 accept = false;
12059 } else {
12060 JavaScriptFrameIterator additional_frame_it(isolate, break_frame_id);
12061 // If our frame is a top frame and we are stepping, we can do step-in
12062 // at this place.
12063 accept = additional_frame_it.frame()->id() == id;
12064 }
12065 }
12066 if (accept) {
12046 if (break_location_iterator.IsStepInLocation(isolate)) { 12067 if (break_location_iterator.IsStepInLocation(isolate)) {
12047 Smi* position_value = Smi::FromInt(break_location_iterator.position()); 12068 Smi* position_value = Smi::FromInt(break_location_iterator.position());
12048 JSObject::SetElement(array, len, 12069 JSObject::SetElement(array, len,
12049 Handle<Object>(position_value, isolate), 12070 Handle<Object>(position_value, isolate),
12050 NONE, kNonStrictMode); 12071 NONE, kNonStrictMode);
12051 len++; 12072 len++;
12052 } 12073 }
12053 } 12074 }
12054 // Advance iterator. 12075 // Advance iterator.
12055 break_location_iterator.Next(); 12076 break_location_iterator.Next();
(...skipping 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after
14481 // Handle last resort GC and make sure to allow future allocations 14502 // Handle last resort GC and make sure to allow future allocations
14482 // to grow the heap without causing GCs (if possible). 14503 // to grow the heap without causing GCs (if possible).
14483 isolate->counters()->gc_last_resort_from_js()->Increment(); 14504 isolate->counters()->gc_last_resort_from_js()->Increment();
14484 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14505 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14485 "Runtime::PerformGC"); 14506 "Runtime::PerformGC");
14486 } 14507 }
14487 } 14508 }
14488 14509
14489 14510
14490 } } // namespace v8::internal 14511 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698