| 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 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2317 // executing one (i == 0) are actually return addresses. Return addresses | 2317 // executing one (i == 0) are actually return addresses. Return addresses |
| 2318 // are one byte beyond the call instruction that is executing. The profiler | 2318 // are one byte beyond the call instruction that is executing. The profiler |
| 2319 // accounts for this and subtracts one from these addresses when querying | 2319 // accounts for this and subtracts one from these addresses when querying |
| 2320 // inline and token position ranges. To be consistent with real stack | 2320 // inline and token position ranges. To be consistent with real stack |
| 2321 // traces, we add one byte to all PCs except the executing one. | 2321 // traces, we add one byte to all PCs except the executing one. |
| 2322 // See OffsetForPC in profiler_service.cc for more context. | 2322 // See OffsetForPC in profiler_service.cc for more context. |
| 2323 const intptr_t return_address_offset = i > 0 ? 1 : 0; | 2323 const intptr_t return_address_offset = i > 0 ? 1 : 0; |
| 2324 sample->SetAt(i, pc_offsets[i] + return_address_offset); | 2324 sample->SetAt(i, pc_offsets[i] + return_address_offset); |
| 2325 i++; | 2325 i++; |
| 2326 } | 2326 } |
| 2327 sample->SetAt(i, NULL); | 2327 sample->SetAt(i, 0); |
| 2328 } | 2328 } |
| 2329 | 2329 |
| 2330 | 2330 |
| 2331 static uword FindPCForTokenPosition(const Code& code, | 2331 static uword FindPCForTokenPosition(const Code& code, |
| 2332 const CodeSourceMap& code_source_map, | 2332 const CodeSourceMap& code_source_map, |
| 2333 TokenPosition tp) { | 2333 TokenPosition tp) { |
| 2334 CodeSourceMap::Iterator it(code_source_map); | 2334 CodeSourceMap::Iterator it(code_source_map); |
| 2335 | 2335 |
| 2336 while (it.MoveNext()) { | 2336 while (it.MoveNext()) { |
| 2337 if (it.TokenPos() == tp) { | 2337 if (it.TokenPos() == tp) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2494 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); | 2494 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); |
| 2495 // Verify exclusive ticks in main. | 2495 // Verify exclusive ticks in main. |
| 2496 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); | 2496 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); |
| 2497 // Verify inclusive ticks in main. | 2497 // Verify inclusive ticks in main. |
| 2498 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); | 2498 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); |
| 2499 } | 2499 } |
| 2500 | 2500 |
| 2501 #endif // !PRODUCT | 2501 #endif // !PRODUCT |
| 2502 | 2502 |
| 2503 } // namespace dart | 2503 } // namespace dart |
| OLD | NEW |