| 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 11993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12004 RUNTIME_ARGUMENTS(isolate, args)); | 12004 RUNTIME_ARGUMENTS(isolate, args)); |
| 12005 if (!maybe_check->ToObject(&check)) return maybe_check; | 12005 if (!maybe_check->ToObject(&check)) return maybe_check; |
| 12006 } | 12006 } |
| 12007 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 12007 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
| 12008 | 12008 |
| 12009 // Get the frame where the debugging is performed. | 12009 // Get the frame where the debugging is performed. |
| 12010 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 12010 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
| 12011 JavaScriptFrameIterator frame_it(isolate, id); | 12011 JavaScriptFrameIterator frame_it(isolate, id); |
| 12012 JavaScriptFrame* frame = frame_it.frame(); | 12012 JavaScriptFrame* frame = frame_it.frame(); |
| 12013 | 12013 |
| 12014 Handle<JSFunction> fun = |
| 12015 Handle<JSFunction>(frame->function()); |
| 12014 Handle<SharedFunctionInfo> shared = | 12016 Handle<SharedFunctionInfo> shared = |
| 12015 Handle<SharedFunctionInfo>(frame->function()->shared()); | 12017 Handle<SharedFunctionInfo>(fun->shared()); |
| 12018 |
| 12019 if (!isolate->debug()->EnsureDebugInfo(shared, fun)) { |
| 12020 return isolate->heap()->undefined_value(); |
| 12021 } |
| 12022 |
| 12016 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared); | 12023 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared); |
| 12017 | 12024 |
| 12018 int len = 0; | 12025 int len = 0; |
| 12019 Handle<JSArray> array(isolate->factory()->NewJSArray(10)); | 12026 Handle<JSArray> array(isolate->factory()->NewJSArray(10)); |
| 12020 // Find the break point where execution has stopped. | 12027 // Find the break point where execution has stopped. |
| 12021 BreakLocationIterator break_location_iterator(debug_info, | 12028 BreakLocationIterator break_location_iterator(debug_info, |
| 12022 ALL_BREAK_LOCATIONS); | 12029 ALL_BREAK_LOCATIONS); |
| 12023 | 12030 |
| 12024 break_location_iterator.FindBreakLocationFromAddress(frame->pc()); | 12031 break_location_iterator.FindBreakLocationFromAddress(frame->pc()); |
| 12025 int current_statement_pos = break_location_iterator.statement_position(); | 12032 int current_statement_pos = break_location_iterator.statement_position(); |
| 12026 | 12033 |
| 12027 while (!break_location_iterator.Done()) { | 12034 while (!break_location_iterator.Done()) { |
| 12028 if (break_location_iterator.IsStepInLocation(isolate)) { | 12035 if (break_location_iterator.pc() > frame->pc()) { |
| 12029 Smi* position_value = Smi::FromInt(break_location_iterator.position()); | 12036 if (break_location_iterator.IsStepInLocation(isolate)) { |
| 12030 JSObject::SetElement(array, len, | 12037 Smi* position_value = Smi::FromInt(break_location_iterator.position()); |
| 12031 Handle<Object>(position_value, isolate), | 12038 JSObject::SetElement(array, len, |
| 12032 NONE, kNonStrictMode); | 12039 Handle<Object>(position_value, isolate), |
| 12033 len++; | 12040 NONE, kNonStrictMode); |
| 12041 len++; |
| 12042 } |
| 12034 } | 12043 } |
| 12035 // Advance iterator. | 12044 // Advance iterator. |
| 12036 break_location_iterator.Next(); | 12045 break_location_iterator.Next(); |
| 12037 if (current_statement_pos != | 12046 if (current_statement_pos != |
| 12038 break_location_iterator.statement_position()) { | 12047 break_location_iterator.statement_position()) { |
| 12039 break; | 12048 break; |
| 12040 } | 12049 } |
| 12041 } | 12050 } |
| 12042 return *array; | 12051 return *array; |
| 12043 } | 12052 } |
| (...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14158 // Handle last resort GC and make sure to allow future allocations | 14167 // Handle last resort GC and make sure to allow future allocations |
| 14159 // to grow the heap without causing GCs (if possible). | 14168 // to grow the heap without causing GCs (if possible). |
| 14160 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14169 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14161 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14170 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14162 "Runtime::PerformGC"); | 14171 "Runtime::PerformGC"); |
| 14163 } | 14172 } |
| 14164 } | 14173 } |
| 14165 | 14174 |
| 14166 | 14175 |
| 14167 } } // namespace v8::internal | 14176 } } // namespace v8::internal |
| OLD | NEW |