Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: runtime/vm/coverage.cc

Issue 356923006: Iterate over PcDescriptors only via iterators, not via an index. (preparation for more compression … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 new(isolate) ZoneGrowableArray<const ICData*>(); 83 new(isolate) ZoneGrowableArray<const ICData*>();
84 function.RestoreICDataMap(ic_data_array); 84 function.RestoreICDataMap(ic_data_array);
85 const Code& code = Code::Handle(function.unoptimized_code()); 85 const Code& code = Code::Handle(function.unoptimized_code());
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 for (int j = 0; j < descriptors.Length(); j++) { 93 PcDescriptors::Iterator iter(descriptors);
94 while (iter.HasNext()) {
94 HANDLESCOPE(isolate); 95 HANDLESCOPE(isolate);
95 PcDescriptors::Kind kind = descriptors.DescriptorKind(j); 96 const RawPcDescriptors::PcDescriptorRec& rec = iter.Next();
97 RawPcDescriptors::Kind kind = rec.kind();
96 // Only IC based calls have counting. 98 // Only IC based calls have counting.
97 if ((kind == PcDescriptors::kIcCall) || 99 if ((kind == RawPcDescriptors::kIcCall) ||
98 (kind == PcDescriptors::kUnoptStaticCall)) { 100 (kind == RawPcDescriptors::kUnoptStaticCall)) {
99 intptr_t deopt_id = descriptors.DeoptId(j); 101 intptr_t deopt_id = rec.deopt_id;
100 const ICData* ic_data= (*ic_data_array)[deopt_id]; 102 const ICData* ic_data= (*ic_data_array)[deopt_id];
101 if (!ic_data->IsNull()) { 103 if (!ic_data->IsNull()) {
102 intptr_t token_pos = descriptors.TokenPos(j); 104 intptr_t token_pos = rec.token_pos;
103 // Filter out descriptors that do not map to tokens in the source code. 105 // Filter out descriptors that do not map to tokens in the source code.
104 if (token_pos < begin_pos || 106 if (token_pos < begin_pos ||
105 token_pos > end_pos) { 107 token_pos > end_pos) {
106 continue; 108 continue;
107 } 109 }
108 intptr_t line = pos_to_line[token_pos]; 110 intptr_t line = pos_to_line[token_pos];
109 #if defined(DEBUG) 111 #if defined(DEBUG)
110 const Script& script = Script::Handle(function.script()); 112 const Script& script = Script::Handle(function.script());
111 intptr_t test_line = -1; 113 intptr_t test_line = -1;
112 script.GetTokenLocation(token_pos, &test_line, NULL); 114 script.GetTokenLocation(token_pos, &test_line, NULL);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 cls = it.GetNextClass(); 283 cls = it.GetNextClass();
282 ASSERT(!cls.IsNull()); 284 ASSERT(!cls.IsNull());
283 PrintClass(lib, cls, jsarr, filter); 285 PrintClass(lib, cls, jsarr, filter);
284 } 286 }
285 } 287 }
286 } 288 }
287 } 289 }
288 290
289 291
290 } // namespace dart 292 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698