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 "vm/coverage.h" | 5 #include "vm/coverage.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const PcDescriptors& descriptors = PcDescriptors::Handle( | 86 const PcDescriptors& descriptors = PcDescriptors::Handle( |
87 code.pc_descriptors()); | 87 code.pc_descriptors()); |
88 | 88 |
89 const intptr_t begin_pos = function.token_pos(); | 89 const intptr_t begin_pos = function.token_pos(); |
90 const intptr_t end_pos = function.end_token_pos(); | 90 const intptr_t end_pos = function.end_token_pos(); |
91 intptr_t last_line = -1; | 91 intptr_t last_line = -1; |
92 intptr_t last_count = 0; | 92 intptr_t last_count = 0; |
93 // Only IC based calls have counting. | 93 // Only IC based calls have counting. |
94 PcDescriptors::Iterator iter(descriptors, | 94 PcDescriptors::Iterator iter(descriptors, |
95 RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall); | 95 RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall); |
96 while (iter.HasNext()) { | 96 while (iter.MoveNext()) { |
97 HANDLESCOPE(isolate); | 97 HANDLESCOPE(isolate); |
98 RawPcDescriptors::PcDescriptorRec rec; | 98 const ICData* ic_data = (*ic_data_array)[iter.DeoptId()]; |
99 iter.NextRec(&rec); | |
100 const ICData* ic_data = (*ic_data_array)[rec.deopt_id()]; | |
101 if (!ic_data->IsNull()) { | 99 if (!ic_data->IsNull()) { |
102 const intptr_t token_pos = rec.token_pos(); | 100 const intptr_t token_pos = iter.TokenPos(); |
103 // Filter out descriptors that do not map to tokens in the source code. | 101 // Filter out descriptors that do not map to tokens in the source code. |
104 if ((token_pos < begin_pos) || (token_pos > end_pos)) { | 102 if ((token_pos < begin_pos) || (token_pos > end_pos)) { |
105 continue; | 103 continue; |
106 } | 104 } |
107 intptr_t line = pos_to_line[token_pos]; | 105 intptr_t line = pos_to_line[token_pos]; |
108 #if defined(DEBUG) | 106 #if defined(DEBUG) |
109 const Script& script = Script::Handle(function.script()); | 107 const Script& script = Script::Handle(function.script()); |
110 intptr_t test_line = -1; | 108 intptr_t test_line = -1; |
111 script.GetTokenLocation(token_pos, &test_line, NULL); | 109 script.GetTokenLocation(token_pos, &test_line, NULL); |
112 ASSERT(test_line == line); | 110 ASSERT(test_line == line); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 cls = it.GetNextClass(); | 281 cls = it.GetNextClass(); |
284 ASSERT(!cls.IsNull()); | 282 ASSERT(!cls.IsNull()); |
285 PrintClass(lib, cls, jsarr, filter); | 283 PrintClass(lib, cls, jsarr, filter); |
286 } | 284 } |
287 } | 285 } |
288 } | 286 } |
289 } | 287 } |
290 | 288 |
291 | 289 |
292 } // namespace dart | 290 } // namespace dart |
OLD | NEW |