OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 | 6 |
7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/profiler.h" | 10 #include "vm/profiler.h" |
(...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2446 } | 2446 } |
2447 sample->SetAt(i, 0); | 2447 sample->SetAt(i, 0); |
2448 } | 2448 } |
2449 | 2449 |
2450 | 2450 |
2451 static uword FindPCForTokenPosition(const Code& code, | 2451 static uword FindPCForTokenPosition(const Code& code, |
2452 TokenPosition tp) { | 2452 TokenPosition tp) { |
2453 GrowableArray<const Function*> functions; | 2453 GrowableArray<const Function*> functions; |
2454 GrowableArray<TokenPosition> token_positions; | 2454 GrowableArray<TokenPosition> token_positions; |
2455 for (intptr_t pc_offset = 0; pc_offset < code.Size(); pc_offset++) { | 2455 for (intptr_t pc_offset = 0; pc_offset < code.Size(); pc_offset++) { |
2456 code.GetInlinedFunctionsAt(pc_offset, &functions, &token_positions); | 2456 code.GetInlinedFunctionsAtInstruction(pc_offset, &functions, |
| 2457 &token_positions); |
2457 if (token_positions[0] == tp) { | 2458 if (token_positions[0] == tp) { |
2458 return code.PayloadStart() + pc_offset; | 2459 return code.PayloadStart() + pc_offset; |
2459 } | 2460 } |
2460 } | 2461 } |
2461 | 2462 |
2462 return 0; | 2463 return 0; |
2463 } | 2464 } |
2464 | 2465 |
2465 | 2466 |
2466 TEST_CASE(Profiler_GetSourceReport) { | 2467 TEST_CASE(Profiler_GetSourceReport) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); | 2593 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); |
2593 // Verify exclusive ticks in main. | 2594 // Verify exclusive ticks in main. |
2594 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); | 2595 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); |
2595 // Verify inclusive ticks in main. | 2596 // Verify inclusive ticks in main. |
2596 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); | 2597 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); |
2597 } | 2598 } |
2598 | 2599 |
2599 #endif // !PRODUCT | 2600 #endif // !PRODUCT |
2600 | 2601 |
2601 } // namespace dart | 2602 } // namespace dart |
OLD | NEW |