OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); | 1545 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
1546 RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); | 1546 RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); |
1547 | 1547 |
1548 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 1548 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
1549 | 1549 |
1550 // Get the frame where the debugging is performed. | 1550 // Get the frame where the debugging is performed. |
1551 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 1551 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
1552 JavaScriptFrameIterator frame_it(isolate, id); | 1552 JavaScriptFrameIterator frame_it(isolate, id); |
1553 RUNTIME_ASSERT(!frame_it.done()); | 1553 RUNTIME_ASSERT(!frame_it.done()); |
1554 | 1554 |
1555 JavaScriptFrame* frame = frame_it.frame(); | 1555 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
| 1556 frame_it.frame()->Summarize(&frames); |
| 1557 FrameSummary summary = frames.first(); |
1556 | 1558 |
1557 Handle<JSFunction> fun = Handle<JSFunction>(frame->function()); | 1559 Handle<JSFunction> fun = Handle<JSFunction>(summary.function()); |
1558 Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>(fun->shared()); | 1560 Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>(fun->shared()); |
1559 | 1561 |
1560 if (!isolate->debug()->EnsureDebugInfo(shared, fun)) { | 1562 if (!isolate->debug()->EnsureDebugInfo(shared, fun)) { |
1561 return isolate->heap()->undefined_value(); | 1563 return isolate->heap()->undefined_value(); |
1562 } | 1564 } |
1563 | 1565 |
1564 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared); | 1566 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared); |
1565 | 1567 |
1566 // Find range of break points starting from the break point where execution | 1568 // Find range of break points starting from the break point where execution |
1567 // has stopped. | 1569 // has stopped. |
1568 Address call_pc = frame->pc() - 1; | 1570 Address call_pc = summary.pc() - 1; |
1569 List<BreakLocation> locations; | 1571 List<BreakLocation> locations; |
1570 BreakLocation::FromAddressSameStatement(debug_info, ALL_BREAK_LOCATIONS, | 1572 BreakLocation::FromAddressSameStatement(debug_info, ALL_BREAK_LOCATIONS, |
1571 call_pc, &locations); | 1573 call_pc, &locations); |
1572 | 1574 |
1573 Handle<JSArray> array = isolate->factory()->NewJSArray(locations.length()); | 1575 Handle<JSArray> array = isolate->factory()->NewJSArray(locations.length()); |
1574 | 1576 |
1575 int index = 0; | 1577 int index = 0; |
1576 for (BreakLocation location : locations) { | 1578 for (BreakLocation location : locations) { |
1577 bool accept; | 1579 bool accept; |
1578 if (location.pc() > frame->pc()) { | 1580 if (location.pc() > summary.pc()) { |
1579 accept = true; | 1581 accept = true; |
1580 } else { | 1582 } else { |
1581 StackFrame::Id break_frame_id = isolate->debug()->break_frame_id(); | 1583 StackFrame::Id break_frame_id = isolate->debug()->break_frame_id(); |
1582 // The break point is near our pc. Could be a step-in possibility, | 1584 // The break point is near our pc. Could be a step-in possibility, |
1583 // that is currently taken by active debugger call. | 1585 // that is currently taken by active debugger call. |
1584 if (break_frame_id == StackFrame::NO_ID) { | 1586 if (break_frame_id == StackFrame::NO_ID) { |
1585 // We are not stepping. | 1587 // We are not stepping. |
1586 accept = false; | 1588 accept = false; |
1587 } else { | 1589 } else { |
1588 JavaScriptFrameIterator additional_frame_it(isolate, break_frame_id); | 1590 JavaScriptFrameIterator additional_frame_it(isolate, break_frame_id); |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 return Smi::FromInt(isolate->debug()->is_active()); | 2825 return Smi::FromInt(isolate->debug()->is_active()); |
2824 } | 2826 } |
2825 | 2827 |
2826 | 2828 |
2827 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 2829 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
2828 UNIMPLEMENTED(); | 2830 UNIMPLEMENTED(); |
2829 return NULL; | 2831 return NULL; |
2830 } | 2832 } |
2831 } | 2833 } |
2832 } // namespace v8::internal | 2834 } // namespace v8::internal |
OLD | NEW |