OLD | NEW |
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 12058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12069 Object* check; | 12069 Object* check; |
12070 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | 12070 { MaybeObject* maybe_check = Runtime_CheckExecutionState( |
12071 RUNTIME_ARGUMENTS(isolate, args)); | 12071 RUNTIME_ARGUMENTS(isolate, args)); |
12072 if (!maybe_check->ToObject(&check)) return maybe_check; | 12072 if (!maybe_check->ToObject(&check)) return maybe_check; |
12073 } | 12073 } |
12074 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 12074 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
12075 | 12075 |
12076 // Get the frame where the debugging is performed. | 12076 // Get the frame where the debugging is performed. |
12077 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 12077 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
12078 JavaScriptFrameIterator frame_it(isolate, id); | 12078 JavaScriptFrameIterator frame_it(isolate, id); |
| 12079 RUNTIME_ASSERT(!frame_it.done()); |
| 12080 |
12079 JavaScriptFrame* frame = frame_it.frame(); | 12081 JavaScriptFrame* frame = frame_it.frame(); |
12080 | 12082 |
12081 Handle<JSFunction> fun = | 12083 Handle<JSFunction> fun = |
12082 Handle<JSFunction>(frame->function()); | 12084 Handle<JSFunction>(frame->function()); |
12083 Handle<SharedFunctionInfo> shared = | 12085 Handle<SharedFunctionInfo> shared = |
12084 Handle<SharedFunctionInfo>(fun->shared()); | 12086 Handle<SharedFunctionInfo>(fun->shared()); |
12085 | 12087 |
12086 if (!isolate->debug()->EnsureDebugInfo(shared, fun)) { | 12088 if (!isolate->debug()->EnsureDebugInfo(shared, fun)) { |
12087 return isolate->heap()->undefined_value(); | 12089 return isolate->heap()->undefined_value(); |
12088 } | 12090 } |
12089 | 12091 |
12090 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared); | 12092 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared); |
12091 | 12093 |
12092 int len = 0; | 12094 int len = 0; |
12093 Handle<JSArray> array(isolate->factory()->NewJSArray(10)); | 12095 Handle<JSArray> array(isolate->factory()->NewJSArray(10)); |
12094 // Find the break point where execution has stopped. | 12096 // Find the break point where execution has stopped. |
12095 BreakLocationIterator break_location_iterator(debug_info, | 12097 BreakLocationIterator break_location_iterator(debug_info, |
12096 ALL_BREAK_LOCATIONS); | 12098 ALL_BREAK_LOCATIONS); |
12097 | 12099 |
12098 break_location_iterator.FindBreakLocationFromAddress(frame->pc()); | 12100 break_location_iterator.FindBreakLocationFromAddress(frame->pc() - 1); |
12099 int current_statement_pos = break_location_iterator.statement_position(); | 12101 int current_statement_pos = break_location_iterator.statement_position(); |
12100 | 12102 |
12101 while (!break_location_iterator.Done()) { | 12103 while (!break_location_iterator.Done()) { |
| 12104 bool accept; |
12102 if (break_location_iterator.pc() > frame->pc()) { | 12105 if (break_location_iterator.pc() > frame->pc()) { |
| 12106 accept = true; |
| 12107 } else { |
| 12108 StackFrame::Id break_frame_id = isolate->debug()->break_frame_id(); |
| 12109 // The break point is near our pc. Could be a step-in possibility, |
| 12110 // that is currently taken by active debugger call. |
| 12111 if (break_frame_id == StackFrame::NO_ID) { |
| 12112 // We are not stepping. |
| 12113 accept = false; |
| 12114 } else { |
| 12115 JavaScriptFrameIterator additional_frame_it(isolate, break_frame_id); |
| 12116 // If our frame is a top frame and we are stepping, we can do step-in |
| 12117 // at this place. |
| 12118 accept = additional_frame_it.frame()->id() == id; |
| 12119 } |
| 12120 } |
| 12121 if (accept) { |
12103 if (break_location_iterator.IsStepInLocation(isolate)) { | 12122 if (break_location_iterator.IsStepInLocation(isolate)) { |
12104 Smi* position_value = Smi::FromInt(break_location_iterator.position()); | 12123 Smi* position_value = Smi::FromInt(break_location_iterator.position()); |
12105 JSObject::SetElement(array, len, | 12124 JSObject::SetElement(array, len, |
12106 Handle<Object>(position_value, isolate), | 12125 Handle<Object>(position_value, isolate), |
12107 NONE, kNonStrictMode); | 12126 NONE, kNonStrictMode); |
12108 len++; | 12127 len++; |
12109 } | 12128 } |
12110 } | 12129 } |
12111 // Advance iterator. | 12130 // Advance iterator. |
12112 break_location_iterator.Next(); | 12131 break_location_iterator.Next(); |
(...skipping 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14695 // Handle last resort GC and make sure to allow future allocations | 14714 // Handle last resort GC and make sure to allow future allocations |
14696 // to grow the heap without causing GCs (if possible). | 14715 // to grow the heap without causing GCs (if possible). |
14697 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14716 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14698 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14717 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14699 "Runtime::PerformGC"); | 14718 "Runtime::PerformGC"); |
14700 } | 14719 } |
14701 } | 14720 } |
14702 | 14721 |
14703 | 14722 |
14704 } } // namespace v8::internal | 14723 } } // namespace v8::internal |
OLD | NEW |