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

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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 new(isolate) ZoneGrowableArray<const ICData*>(); 78 new(isolate) ZoneGrowableArray<const ICData*>();
79 function.RestoreICDataMap(ic_data_array); 79 function.RestoreICDataMap(ic_data_array);
80 const Code& code = Code::Handle(function.unoptimized_code()); 80 const Code& code = Code::Handle(function.unoptimized_code());
81 const PcDescriptors& descriptors = PcDescriptors::Handle( 81 const PcDescriptors& descriptors = PcDescriptors::Handle(
82 code.pc_descriptors()); 82 code.pc_descriptors());
83 83
84 const intptr_t begin_pos = function.token_pos(); 84 const intptr_t begin_pos = function.token_pos();
85 const intptr_t end_pos = function.end_token_pos(); 85 const intptr_t end_pos = function.end_token_pos();
86 intptr_t last_line = -1; 86 intptr_t last_line = -1;
87 intptr_t last_count = 0; 87 intptr_t last_count = 0;
88 for (int j = 0; j < descriptors.Length(); j++) { 88 PcDescriptors::Iterator iter(descriptors);
89 while (iter.HasNext()) {
89 HANDLESCOPE(isolate); 90 HANDLESCOPE(isolate);
90 PcDescriptors::Kind kind = descriptors.DescriptorKind(j); 91 const RawPcDescriptors::PcDescriptorRec& rec = iter.Next();
92 RawPcDescriptors::Kind kind = rec.kind();
91 // Only IC based calls have counting. 93 // Only IC based calls have counting.
92 if ((kind == PcDescriptors::kIcCall) || 94 if ((kind == RawPcDescriptors::kIcCall) ||
93 (kind == PcDescriptors::kUnoptStaticCall)) { 95 (kind == RawPcDescriptors::kUnoptStaticCall)) {
94 intptr_t deopt_id = descriptors.DeoptId(j); 96 intptr_t deopt_id = rec.deopt_id;
95 const ICData* ic_data= (*ic_data_array)[deopt_id]; 97 const ICData* ic_data= (*ic_data_array)[deopt_id];
96 if (!ic_data->IsNull()) { 98 if (!ic_data->IsNull()) {
97 intptr_t token_pos = descriptors.TokenPos(j); 99 intptr_t token_pos = rec.token_pos;
98 // Filter out descriptors that do not map to tokens in the source code. 100 // Filter out descriptors that do not map to tokens in the source code.
99 if (token_pos < begin_pos || 101 if (token_pos < begin_pos ||
100 token_pos > end_pos) { 102 token_pos > end_pos) {
101 continue; 103 continue;
102 } 104 }
103 intptr_t line = pos_to_line[token_pos]; 105 intptr_t line = pos_to_line[token_pos];
104 #if defined(DEBUG) 106 #if defined(DEBUG)
105 const Script& script = Script::Handle(function.script()); 107 const Script& script = Script::Handle(function.script());
106 intptr_t test_line = -1; 108 intptr_t test_line = -1;
107 script.GetTokenLocation(token_pos, &test_line, NULL); 109 script.GetTokenLocation(token_pos, &test_line, NULL);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 cls = it.GetNextClass(); 309 cls = it.GetNextClass();
308 ASSERT(!cls.IsNull()); 310 ASSERT(!cls.IsNull());
309 PrintClass(cls, jsarr, Script::Handle()); 311 PrintClass(cls, jsarr, Script::Handle());
310 } 312 }
311 } 313 }
312 } 314 }
313 } 315 }
314 316
315 317
316 } // namespace dart 318 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698