OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/profiler_service.h" | 5 #include "vm/profiler_service.h" |
6 | 6 |
7 #include "vm/growable_array.h" | 7 #include "vm/growable_array.h" |
8 #include "vm/log.h" | 8 #include "vm/log.h" |
9 #include "vm/native_symbol.h" | 9 #include "vm/native_symbol.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 if (!code.IsNull()) { | 1446 if (!code.IsNull()) { |
1447 intptr_t offset = pc - code.EntryPoint(); | 1447 intptr_t offset = pc - code.EntryPoint(); |
1448 if (frame_index != 0) { | 1448 if (frame_index != 0) { |
1449 // The PC of frames below the top frame is a call's return address, | 1449 // The PC of frames below the top frame is a call's return address, |
1450 // which can belong to a different inlining interval than the call. | 1450 // which can belong to a different inlining interval than the call. |
1451 offset--; | 1451 offset--; |
1452 } else if (sample->IsAllocationSample()) { | 1452 } else if (sample->IsAllocationSample()) { |
1453 // Allocation samples skip the top frame, so the top frame's pc is | 1453 // Allocation samples skip the top frame, so the top frame's pc is |
1454 // also a call's return address. | 1454 // also a call's return address. |
1455 offset--; | 1455 offset--; |
| 1456 } else if (!sample->first_frame_executing()) { |
| 1457 // If the first frame wasn't executing code (i.e. we started to collect |
| 1458 // the stack trace at an exit frame), the top frame's pc is also a |
| 1459 // call's return address. |
| 1460 offset--; |
1456 } | 1461 } |
1457 code.GetInlinedFunctionsAt(offset, | 1462 code.GetInlinedFunctionsAt(offset, |
1458 &inlined_functions, | 1463 &inlined_functions, |
1459 &inlined_token_positions); | 1464 &inlined_token_positions); |
1460 token_position = code.GetTokenPositionAt(offset); | 1465 token_position = code.GetTokenPositionAt(offset); |
1461 if (inlined_functions.length() > 0) { | 1466 if (inlined_functions.length() > 0) { |
1462 // The inlined token position table does not include the token position | 1467 // The inlined token position table does not include the token position |
1463 // of the final call. Insert it at the beginning because the table. | 1468 // of the final call. Insert it at the beginning because the table. |
1464 // is reversed. | 1469 // is reversed. |
1465 inlined_token_positions.InsertAt(0, token_position); | 1470 inlined_token_positions.InsertAt(0, token_position); |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 // Disable thread interrupts while processing the buffer. | 2547 // Disable thread interrupts while processing the buffer. |
2543 DisableThreadInterruptsScope dtis(thread); | 2548 DisableThreadInterruptsScope dtis(thread); |
2544 | 2549 |
2545 ClearProfileVisitor clear_profile(isolate); | 2550 ClearProfileVisitor clear_profile(isolate); |
2546 sample_buffer->VisitSamples(&clear_profile); | 2551 sample_buffer->VisitSamples(&clear_profile); |
2547 } | 2552 } |
2548 | 2553 |
2549 #endif // !PRODUCT | 2554 #endif // !PRODUCT |
2550 | 2555 |
2551 } // namespace dart | 2556 } // namespace dart |
OLD | NEW |