| 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/hash_map.h" | 8 #include "vm/hash_map.h" |
| 9 #include "vm/log.h" | 9 #include "vm/log.h" |
| 10 #include "vm/native_symbol.h" | 10 #include "vm/native_symbol.h" |
| 11 #include "vm/object.h" | 11 #include "vm/object.h" |
| 12 #include "vm/os.h" | 12 #include "vm/os.h" |
| 13 #include "vm/profiler.h" | 13 #include "vm/profiler.h" |
| 14 #include "vm/reusable_handles.h" | 14 #include "vm/reusable_handles.h" |
| 15 #include "vm/scope_timer.h" | 15 #include "vm/scope_timer.h" |
| 16 | 16 |
| 17 namespace dart { | 17 namespace dart { |
| 18 | 18 |
| 19 DECLARE_FLAG(int, max_profile_depth); | 19 DECLARE_FLAG(int, max_profile_depth); |
| 20 DECLARE_FLAG(int, profile_period); | 20 DECLARE_FLAG(int, profile_period); |
| 21 DECLARE_FLAG(bool, show_invisible_frames); | 21 DECLARE_FLAG(bool, show_invisible_frames); |
| 22 DECLARE_FLAG(bool, profile_vm); |
| 22 | 23 |
| 23 #ifndef PRODUCT | 24 #ifndef PRODUCT |
| 24 | 25 |
| 25 class DeoptimizedCodeSet : public ZoneAllocated { | 26 class DeoptimizedCodeSet : public ZoneAllocated { |
| 26 public: | 27 public: |
| 27 explicit DeoptimizedCodeSet(Isolate* isolate) | 28 explicit DeoptimizedCodeSet(Isolate* isolate) |
| 28 : previous_( | 29 : previous_( |
| 29 GrowableObjectArray::ZoneHandle(isolate->deoptimized_code_array())), | 30 GrowableObjectArray::ZoneHandle(isolate->deoptimized_code_array())), |
| 30 current_(GrowableObjectArray::ZoneHandle( | 31 current_(GrowableObjectArray::ZoneHandle( |
| 31 previous_.IsNull() ? GrowableObjectArray::null() : | 32 previous_.IsNull() ? GrowableObjectArray::null() : |
| (...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 // and tick each one. | 1369 // and tick each one. |
| 1369 for (intptr_t frame_index = 0; | 1370 for (intptr_t frame_index = 0; |
| 1370 frame_index < sample->length(); | 1371 frame_index < sample->length(); |
| 1371 frame_index++) { | 1372 frame_index++) { |
| 1372 const uword pc = sample->At(frame_index); | 1373 const uword pc = sample->At(frame_index); |
| 1373 ASSERT(pc != 0); | 1374 ASSERT(pc != 0); |
| 1374 ProfileCode* code = FindOrRegisterProfileCode(pc, timestamp); | 1375 ProfileCode* code = FindOrRegisterProfileCode(pc, timestamp); |
| 1375 ASSERT(code != NULL); | 1376 ASSERT(code != NULL); |
| 1376 code->Tick(pc, IsExecutingFrame(sample, frame_index), sample_index); | 1377 code->Tick(pc, IsExecutingFrame(sample, frame_index), sample_index); |
| 1377 } | 1378 } |
| 1379 |
| 1380 TickExitFrame(sample->vm_tag(), sample_index); |
| 1378 } | 1381 } |
| 1379 SanitizeMinMaxTimes(); | 1382 SanitizeMinMaxTimes(); |
| 1380 } | 1383 } |
| 1381 | 1384 |
| 1382 void FinalizeCodeIndexes() { | 1385 void FinalizeCodeIndexes() { |
| 1383 ScopeTimer sw("ProfileBuilder::FinalizeCodeIndexes", FLAG_trace_profiler); | 1386 ScopeTimer sw("ProfileBuilder::FinalizeCodeIndexes", FLAG_trace_profiler); |
| 1384 ProfileCodeTable* live_table = profile_->live_code_; | 1387 ProfileCodeTable* live_table = profile_->live_code_; |
| 1385 ProfileCodeTable* dead_table = profile_->dead_code_; | 1388 ProfileCodeTable* dead_table = profile_->dead_code_; |
| 1386 ProfileCodeTable* tag_table = profile_->tag_code_; | 1389 ProfileCodeTable* tag_table = profile_->tag_code_; |
| 1387 const intptr_t dead_code_index_offset = live_table->length(); | 1390 const intptr_t dead_code_index_offset = live_table->length(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 GetProfileCodeIndex(sample->At(frame_index), sample->timestamp()); | 1486 GetProfileCodeIndex(sample->At(frame_index), sample->timestamp()); |
| 1484 ASSERT(index >= 0); | 1487 ASSERT(index >= 0); |
| 1485 ProfileCode* profile_code = | 1488 ProfileCode* profile_code = |
| 1486 GetProfileCode(sample->At(frame_index), sample->timestamp()); | 1489 GetProfileCode(sample->At(frame_index), sample->timestamp()); |
| 1487 ASSERT(profile_code->code_table_index() == index); | 1490 ASSERT(profile_code->code_table_index() == index); |
| 1488 code ^= profile_code->code(); | 1491 code ^= profile_code->code(); |
| 1489 current = AppendKind(code, current); | 1492 current = AppendKind(code, current); |
| 1490 current = current->GetChild(index); | 1493 current = current->GetChild(index); |
| 1491 current->Tick(); | 1494 current->Tick(); |
| 1492 } | 1495 } |
| 1496 |
| 1497 if (!sample->first_frame_executing()) { |
| 1498 current = AppendExitFrame(sample->vm_tag(), current); |
| 1499 } |
| 1493 } | 1500 } |
| 1494 } | 1501 } |
| 1495 | 1502 |
| 1496 void BuildExclusiveCodeTrie(ProfileCodeTrieNode* root) { | 1503 void BuildExclusiveCodeTrie(ProfileCodeTrieNode* root) { |
| 1497 ScopeTimer sw("ProfileBuilder::BuildExclusiveCodeTrie", | 1504 ScopeTimer sw("ProfileBuilder::BuildExclusiveCodeTrie", |
| 1498 FLAG_trace_profiler); | 1505 FLAG_trace_profiler); |
| 1499 for (intptr_t sample_index = 0; | 1506 for (intptr_t sample_index = 0; |
| 1500 sample_index < samples_->length(); | 1507 sample_index < samples_->length(); |
| 1501 sample_index++) { | 1508 sample_index++) { |
| 1502 ProcessedSample* sample = samples_->At(sample_index); | 1509 ProcessedSample* sample = samples_->At(sample_index); |
| 1503 | 1510 |
| 1504 // Tick the root. | 1511 // Tick the root. |
| 1505 ProfileCodeTrieNode* current = root; | 1512 ProfileCodeTrieNode* current = root; |
| 1506 current->Tick(); | 1513 current->Tick(); |
| 1507 | 1514 |
| 1508 // VM & User tags. | 1515 // VM & User tags. |
| 1509 current = AppendTags(sample->vm_tag(), sample->user_tag(), current); | 1516 current = AppendTags(sample->vm_tag(), sample->user_tag(), current); |
| 1510 | 1517 |
| 1511 ResetKind(); | 1518 ResetKind(); |
| 1512 | 1519 |
| 1520 if (!sample->first_frame_executing()) { |
| 1521 current = AppendExitFrame(sample->vm_tag(), current); |
| 1522 } |
| 1523 |
| 1513 // Walk the sampled PCs. | 1524 // Walk the sampled PCs. |
| 1514 Code& code = Code::Handle(); | 1525 Code& code = Code::Handle(); |
| 1515 for (intptr_t frame_index = 0; | 1526 for (intptr_t frame_index = 0; |
| 1516 frame_index < sample->length(); | 1527 frame_index < sample->length(); |
| 1517 frame_index++) { | 1528 frame_index++) { |
| 1518 ASSERT(sample->At(frame_index) != 0); | 1529 ASSERT(sample->At(frame_index) != 0); |
| 1519 intptr_t index = | 1530 intptr_t index = |
| 1520 GetProfileCodeIndex(sample->At(frame_index), sample->timestamp()); | 1531 GetProfileCodeIndex(sample->At(frame_index), sample->timestamp()); |
| 1521 ASSERT(index >= 0); | 1532 ASSERT(index >= 0); |
| 1522 ProfileCode* profile_code = | 1533 ProfileCode* profile_code = |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 } | 1586 } |
| 1576 | 1587 |
| 1577 // Walk the sampled PCs. | 1588 // Walk the sampled PCs. |
| 1578 for (intptr_t frame_index = sample->length() - 1; | 1589 for (intptr_t frame_index = sample->length() - 1; |
| 1579 frame_index >= 0; | 1590 frame_index >= 0; |
| 1580 frame_index--) { | 1591 frame_index--) { |
| 1581 ASSERT(sample->At(frame_index) != 0); | 1592 ASSERT(sample->At(frame_index) != 0); |
| 1582 current = ProcessFrame(current, sample_index, sample, frame_index); | 1593 current = ProcessFrame(current, sample_index, sample, frame_index); |
| 1583 } | 1594 } |
| 1584 | 1595 |
| 1596 if (!sample->first_frame_executing()) { |
| 1597 current = AppendExitFrame(sample->vm_tag(), current); |
| 1598 } |
| 1599 |
| 1585 sample->set_timeline_trie(current); | 1600 sample->set_timeline_trie(current); |
| 1586 } | 1601 } |
| 1587 } | 1602 } |
| 1588 | 1603 |
| 1589 void BuildExclusiveFunctionTrie(ProfileFunctionTrieNode* root) { | 1604 void BuildExclusiveFunctionTrie(ProfileFunctionTrieNode* root) { |
| 1590 ScopeTimer sw("ProfileBuilder::BuildExclusiveFunctionTrie", | 1605 ScopeTimer sw("ProfileBuilder::BuildExclusiveFunctionTrie", |
| 1591 FLAG_trace_profiler); | 1606 FLAG_trace_profiler); |
| 1592 ASSERT(tick_functions_); | 1607 ASSERT(tick_functions_); |
| 1593 for (intptr_t sample_index = 0; | 1608 for (intptr_t sample_index = 0; |
| 1594 sample_index < samples_->length(); | 1609 sample_index < samples_->length(); |
| 1595 sample_index++) { | 1610 sample_index++) { |
| 1596 ProcessedSample* sample = samples_->At(sample_index); | 1611 ProcessedSample* sample = samples_->At(sample_index); |
| 1597 | 1612 |
| 1598 // Tick the root. | 1613 // Tick the root. |
| 1599 ProfileFunctionTrieNode* current = root; | 1614 ProfileFunctionTrieNode* current = root; |
| 1600 current->Tick(); | 1615 current->Tick(); |
| 1601 | 1616 |
| 1602 // VM & User tags. | 1617 // VM & User tags. |
| 1603 current = AppendTags(sample->vm_tag(), sample->user_tag(), current); | 1618 current = AppendTags(sample->vm_tag(), sample->user_tag(), current); |
| 1604 | 1619 |
| 1605 ResetKind(); | 1620 ResetKind(); |
| 1606 | 1621 |
| 1622 if (!sample->first_frame_executing()) { |
| 1623 current = AppendExitFrame(sample->vm_tag(), current); |
| 1624 } |
| 1625 |
| 1607 // Walk the sampled PCs. | 1626 // Walk the sampled PCs. |
| 1608 for (intptr_t frame_index = 0; | 1627 for (intptr_t frame_index = 0; |
| 1609 frame_index < sample->length(); | 1628 frame_index < sample->length(); |
| 1610 frame_index++) { | 1629 frame_index++) { |
| 1611 ASSERT(sample->At(frame_index) != 0); | 1630 ASSERT(sample->At(frame_index) != 0); |
| 1612 current = ProcessFrame(current, sample_index, sample, frame_index); | 1631 current = ProcessFrame(current, sample_index, sample, frame_index); |
| 1613 } | 1632 } |
| 1614 | 1633 |
| 1634 TickExitFrameFunction(sample->vm_tag(), sample_index); |
| 1635 |
| 1615 // Truncated tag. | 1636 // Truncated tag. |
| 1616 if (sample->truncated()) { | 1637 if (sample->truncated()) { |
| 1617 current = AppendTruncatedTag(current); | 1638 current = AppendTruncatedTag(current); |
| 1618 InclusiveTickTruncatedTag(); | 1639 InclusiveTickTruncatedTag(); |
| 1619 } | 1640 } |
| 1620 } | 1641 } |
| 1621 } | 1642 } |
| 1622 | 1643 |
| 1623 ProfileFunctionTrieNode* ProcessFrame( | 1644 ProfileFunctionTrieNode* ProcessFrame( |
| 1624 ProfileFunctionTrieNode* current, | 1645 ProfileFunctionTrieNode* current, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 inlined_token_position, | 1764 inlined_token_position, |
| 1744 code_index); | 1765 code_index); |
| 1745 } | 1766 } |
| 1746 | 1767 |
| 1747 bool ShouldTickNode(ProcessedSample* sample, intptr_t frame_index) { | 1768 bool ShouldTickNode(ProcessedSample* sample, intptr_t frame_index) { |
| 1748 if (frame_index != 0) { | 1769 if (frame_index != 0) { |
| 1749 return true; | 1770 return true; |
| 1750 } | 1771 } |
| 1751 // Only tick the first frame's node, if we are executing OR | 1772 // Only tick the first frame's node, if we are executing OR |
| 1752 // vm tags have been emitted. | 1773 // vm tags have been emitted. |
| 1753 return IsExecutingFrame(sample, frame_index) || vm_tags_emitted(); | 1774 return IsExecutingFrame(sample, frame_index) || |
| 1775 !FLAG_profile_vm || vm_tags_emitted(); |
| 1754 } | 1776 } |
| 1755 | 1777 |
| 1756 ProfileFunctionTrieNode* ProcessFunction(ProfileFunctionTrieNode* current, | 1778 ProfileFunctionTrieNode* ProcessFunction(ProfileFunctionTrieNode* current, |
| 1757 intptr_t sample_index, | 1779 intptr_t sample_index, |
| 1758 ProcessedSample* sample, | 1780 ProcessedSample* sample, |
| 1759 intptr_t frame_index, | 1781 intptr_t frame_index, |
| 1760 ProfileFunction* function, | 1782 ProfileFunction* function, |
| 1761 TokenPosition token_position, | 1783 TokenPosition token_position, |
| 1762 intptr_t code_index) { | 1784 intptr_t code_index) { |
| 1763 if (!function->is_visible()) { | 1785 if (!function->is_visible()) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 } | 1927 } |
| 1906 } | 1928 } |
| 1907 | 1929 |
| 1908 ProfileCodeTrieNode* AppendVMTags(uword vm_tag, | 1930 ProfileCodeTrieNode* AppendVMTags(uword vm_tag, |
| 1909 ProfileCodeTrieNode* current) { | 1931 ProfileCodeTrieNode* current) { |
| 1910 current = AppendVMTag(vm_tag, current); | 1932 current = AppendVMTag(vm_tag, current); |
| 1911 current = AppendSpecificNativeRuntimeEntryVMTag(vm_tag, current); | 1933 current = AppendSpecificNativeRuntimeEntryVMTag(vm_tag, current); |
| 1912 return current; | 1934 return current; |
| 1913 } | 1935 } |
| 1914 | 1936 |
| 1937 void TickExitFrame(uword vm_tag, intptr_t serial) { |
| 1938 if (FLAG_profile_vm) { |
| 1939 return; |
| 1940 } |
| 1941 if (!VMTag::IsExitFrameTag(vm_tag)) { |
| 1942 return; |
| 1943 } |
| 1944 ProfileCodeTable* tag_table = profile_->tag_code_; |
| 1945 ProfileCode* code = tag_table->FindCodeForPC(vm_tag); |
| 1946 ASSERT(code != NULL); |
| 1947 code->Tick(vm_tag, true, serial); |
| 1948 } |
| 1949 |
| 1950 void TickExitFrameFunction(uword vm_tag, intptr_t serial) { |
| 1951 if (FLAG_profile_vm) { |
| 1952 return; |
| 1953 } |
| 1954 if (!VMTag::IsExitFrameTag(vm_tag)) { |
| 1955 return; |
| 1956 } |
| 1957 ProfileCodeTable* tag_table = profile_->tag_code_; |
| 1958 ProfileCode* code = tag_table->FindCodeForPC(vm_tag); |
| 1959 ASSERT(code != NULL); |
| 1960 ProfileFunction* function = code->function(); |
| 1961 ASSERT(function != NULL); |
| 1962 function->Tick(true, serial, TokenPosition::kNoSource); |
| 1963 } |
| 1964 |
| 1965 ProfileCodeTrieNode* AppendExitFrame(uword vm_tag, |
| 1966 ProfileCodeTrieNode* current) { |
| 1967 if (FLAG_profile_vm) { |
| 1968 return current; |
| 1969 } |
| 1970 |
| 1971 if (!VMTag::IsExitFrameTag(vm_tag)) { |
| 1972 return current; |
| 1973 } |
| 1974 |
| 1975 if (VMTag::IsNativeEntryTag(vm_tag) || |
| 1976 VMTag::IsRuntimeEntryTag(vm_tag)) { |
| 1977 current = AppendSpecificNativeRuntimeEntryVMTag(vm_tag, current); |
| 1978 } else { |
| 1979 intptr_t tag_index = GetProfileCodeTagIndex(vm_tag); |
| 1980 current = current->GetChild(tag_index); |
| 1981 // Give the tag a tick. |
| 1982 current->Tick(); |
| 1983 } |
| 1984 return current; |
| 1985 } |
| 1986 |
| 1915 ProfileCodeTrieNode* AppendTags(uword vm_tag, | 1987 ProfileCodeTrieNode* AppendTags(uword vm_tag, |
| 1916 uword user_tag, | 1988 uword user_tag, |
| 1917 ProfileCodeTrieNode* current) { | 1989 ProfileCodeTrieNode* current) { |
| 1918 // None. | 1990 if (FLAG_profile_vm) { |
| 1991 // None. |
| 1992 if (tag_order() == Profile::kNoTags) { |
| 1993 return current; |
| 1994 } |
| 1995 // User first. |
| 1996 if ((tag_order() == Profile::kUserVM) || |
| 1997 (tag_order() == Profile::kUser)) { |
| 1998 current = AppendUserTag(user_tag, current); |
| 1999 // Only user. |
| 2000 if (tag_order() == Profile::kUser) { |
| 2001 return current; |
| 2002 } |
| 2003 return AppendVMTags(vm_tag, current); |
| 2004 } |
| 2005 // VM first. |
| 2006 ASSERT((tag_order() == Profile::kVMUser) || |
| 2007 (tag_order() == Profile::kVM)); |
| 2008 current = AppendVMTags(vm_tag, current); |
| 2009 // Only VM. |
| 2010 if (tag_order() == Profile::kVM) { |
| 2011 return current; |
| 2012 } |
| 2013 return AppendUserTag(user_tag, current); |
| 2014 } |
| 2015 |
| 1919 if (tag_order() == Profile::kNoTags) { | 2016 if (tag_order() == Profile::kNoTags) { |
| 1920 return current; | 2017 return current; |
| 1921 } | 2018 } |
| 1922 // User first. | 2019 |
| 1923 if ((tag_order() == Profile::kUserVM) || | |
| 1924 (tag_order() == Profile::kUser)) { | |
| 1925 current = AppendUserTag(user_tag, current); | |
| 1926 // Only user. | |
| 1927 if (tag_order() == Profile::kUser) { | |
| 1928 return current; | |
| 1929 } | |
| 1930 return AppendVMTags(vm_tag, current); | |
| 1931 } | |
| 1932 // VM first. | |
| 1933 ASSERT((tag_order() == Profile::kVMUser) || | |
| 1934 (tag_order() == Profile::kVM)); | |
| 1935 current = AppendVMTags(vm_tag, current); | |
| 1936 // Only VM. | |
| 1937 if (tag_order() == Profile::kVM) { | |
| 1938 return current; | |
| 1939 } | |
| 1940 return AppendUserTag(user_tag, current); | 2020 return AppendUserTag(user_tag, current); |
| 1941 } | 2021 } |
| 1942 | 2022 |
| 1943 // ProfileFunctionTrieNode | 2023 // ProfileFunctionTrieNode |
| 1944 void ResetKind() { | 2024 void ResetKind() { |
| 1945 info_kind_ = kNone; | 2025 info_kind_ = kNone; |
| 1946 } | 2026 } |
| 1947 | 2027 |
| 1948 ProfileFunctionTrieNode* AppendKind(ProfileInfoKind kind, | 2028 ProfileFunctionTrieNode* AppendKind(ProfileInfoKind kind, |
| 1949 ProfileFunctionTrieNode* current) { | 2029 ProfileFunctionTrieNode* current) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 return current; | 2104 return current; |
| 2025 } | 2105 } |
| 2026 intptr_t tag_index = GetProfileFunctionTagIndex(vm_tag); | 2106 intptr_t tag_index = GetProfileFunctionTagIndex(vm_tag); |
| 2027 current = current->GetChild(tag_index); | 2107 current = current->GetChild(tag_index); |
| 2028 // Give the tag a tick. | 2108 // Give the tag a tick. |
| 2029 current->Tick(); | 2109 current->Tick(); |
| 2030 return current; | 2110 return current; |
| 2031 } | 2111 } |
| 2032 | 2112 |
| 2033 ProfileFunctionTrieNode* AppendVMTags(uword vm_tag, | 2113 ProfileFunctionTrieNode* AppendVMTags(uword vm_tag, |
| 2034 ProfileFunctionTrieNode* current) { | 2114 ProfileFunctionTrieNode* current) { |
| 2035 current = AppendVMTag(vm_tag, current); | 2115 current = AppendVMTag(vm_tag, current); |
| 2036 current = AppendSpecificNativeRuntimeEntryVMTag(vm_tag, current); | 2116 current = AppendSpecificNativeRuntimeEntryVMTag(vm_tag, current); |
| 2037 return current; | 2117 return current; |
| 2038 } | 2118 } |
| 2039 | 2119 |
| 2120 ProfileFunctionTrieNode* AppendExitFrame(uword vm_tag, |
| 2121 ProfileFunctionTrieNode* current) { |
| 2122 if (FLAG_profile_vm) { |
| 2123 return current; |
| 2124 } |
| 2125 |
| 2126 if (!VMTag::IsExitFrameTag(vm_tag)) { |
| 2127 return current; |
| 2128 } |
| 2129 if (VMTag::IsNativeEntryTag(vm_tag) || |
| 2130 VMTag::IsRuntimeEntryTag(vm_tag)) { |
| 2131 current = AppendSpecificNativeRuntimeEntryVMTag(vm_tag, current); |
| 2132 } else { |
| 2133 intptr_t tag_index = GetProfileFunctionTagIndex(vm_tag); |
| 2134 current = current->GetChild(tag_index); |
| 2135 // Give the tag a tick. |
| 2136 current->Tick(); |
| 2137 } |
| 2138 return current; |
| 2139 } |
| 2140 |
| 2040 ProfileFunctionTrieNode* AppendTags(uword vm_tag, | 2141 ProfileFunctionTrieNode* AppendTags(uword vm_tag, |
| 2041 uword user_tag, | 2142 uword user_tag, |
| 2042 ProfileFunctionTrieNode* current) { | 2143 ProfileFunctionTrieNode* current) { |
| 2043 // None. | 2144 if (FLAG_profile_vm) { |
| 2145 // None. |
| 2146 if (tag_order() == Profile::kNoTags) { |
| 2147 return current; |
| 2148 } |
| 2149 // User first. |
| 2150 if ((tag_order() == Profile::kUserVM) || |
| 2151 (tag_order() == Profile::kUser)) { |
| 2152 current = AppendUserTag(user_tag, current); |
| 2153 // Only user. |
| 2154 if (tag_order() == Profile::kUser) { |
| 2155 return current; |
| 2156 } |
| 2157 return AppendVMTags(vm_tag, current); |
| 2158 } |
| 2159 // VM first. |
| 2160 ASSERT((tag_order() == Profile::kVMUser) || |
| 2161 (tag_order() == Profile::kVM)); |
| 2162 current = AppendVMTags(vm_tag, current); |
| 2163 // Only VM. |
| 2164 if (tag_order() == Profile::kVM) { |
| 2165 return current; |
| 2166 } |
| 2167 return AppendUserTag(user_tag, current); |
| 2168 } |
| 2169 |
| 2044 if (tag_order() == Profile::kNoTags) { | 2170 if (tag_order() == Profile::kNoTags) { |
| 2045 return current; | 2171 return current; |
| 2046 } | 2172 } |
| 2047 // User first. | 2173 |
| 2048 if ((tag_order() == Profile::kUserVM) || | |
| 2049 (tag_order() == Profile::kUser)) { | |
| 2050 current = AppendUserTag(user_tag, current); | |
| 2051 // Only user. | |
| 2052 if (tag_order() == Profile::kUser) { | |
| 2053 return current; | |
| 2054 } | |
| 2055 return AppendVMTags(vm_tag, current); | |
| 2056 } | |
| 2057 // VM first. | |
| 2058 ASSERT((tag_order() == Profile::kVMUser) || | |
| 2059 (tag_order() == Profile::kVM)); | |
| 2060 current = AppendVMTags(vm_tag, current); | |
| 2061 // Only VM. | |
| 2062 if (tag_order() == Profile::kVM) { | |
| 2063 return current; | |
| 2064 } | |
| 2065 return AppendUserTag(user_tag, current); | 2174 return AppendUserTag(user_tag, current); |
| 2066 } | 2175 } |
| 2067 | 2176 |
| 2068 intptr_t GetProfileCodeTagIndex(uword tag) { | 2177 intptr_t GetProfileCodeTagIndex(uword tag) { |
| 2069 ProfileCodeTable* tag_table = profile_->tag_code_; | 2178 ProfileCodeTable* tag_table = profile_->tag_code_; |
| 2070 intptr_t index = tag_table->FindCodeIndexForPC(tag); | 2179 intptr_t index = tag_table->FindCodeIndexForPC(tag); |
| 2071 ASSERT(index >= 0); | 2180 ASSERT(index >= 0); |
| 2072 ProfileCode* code = tag_table->At(index); | 2181 ProfileCode* code = tag_table->At(index); |
| 2073 ASSERT(code != NULL); | 2182 ASSERT(code != NULL); |
| 2074 return code->code_table_index(); | 2183 return code->code_table_index(); |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2748 // Disable thread interrupts while processing the buffer. | 2857 // Disable thread interrupts while processing the buffer. |
| 2749 DisableThreadInterruptsScope dtis(thread); | 2858 DisableThreadInterruptsScope dtis(thread); |
| 2750 | 2859 |
| 2751 ClearProfileVisitor clear_profile(isolate); | 2860 ClearProfileVisitor clear_profile(isolate); |
| 2752 sample_buffer->VisitSamples(&clear_profile); | 2861 sample_buffer->VisitSamples(&clear_profile); |
| 2753 } | 2862 } |
| 2754 | 2863 |
| 2755 #endif // !PRODUCT | 2864 #endif // !PRODUCT |
| 2756 | 2865 |
| 2757 } // namespace dart | 2866 } // namespace dart |
| OLD | NEW |