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

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

Issue 1971543002: Fix Observatory crash for DBC (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/source_report.h" 5 #include "vm/source_report.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const PcDescriptors& descriptors = PcDescriptors::Handle( 138 const PcDescriptors& descriptors = PcDescriptors::Handle(
139 zone(), code.pc_descriptors()); 139 zone(), code.pc_descriptors());
140 140
141 JSONArray sites(jsobj, "callSites"); 141 JSONArray sites(jsobj, "callSites");
142 142
143 PcDescriptors::Iterator iter( 143 PcDescriptors::Iterator iter(
144 descriptors, 144 descriptors,
145 RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall); 145 RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall);
146 while (iter.MoveNext()) { 146 while (iter.MoveNext()) {
147 HANDLESCOPE(thread()); 147 HANDLESCOPE(thread());
148 // TODO(zra): Remove this bailout once DBC has reliable ICData.
149 #if defined(TARGET_ARCH_DBC)
150 if (iter.DeoptId() >= ic_data_array->length()) {
151 continue;
152 }
153 #else
154 ASSERT(iter.DeoptId() < ic_data_array->length());
155 #endif
148 const ICData* ic_data = (*ic_data_array)[iter.DeoptId()]; 156 const ICData* ic_data = (*ic_data_array)[iter.DeoptId()];
149 if (ic_data != NULL) { 157 if (ic_data != NULL) {
150 const TokenPosition token_pos = iter.TokenPos(); 158 const TokenPosition token_pos = iter.TokenPos();
151 if ((token_pos < begin_pos) || (token_pos > end_pos)) { 159 if ((token_pos < begin_pos) || (token_pos > end_pos)) {
152 // Does not correspond to a valid source position. 160 // Does not correspond to a valid source position.
153 continue; 161 continue;
154 } 162 }
155 bool is_static_call = iter.Kind() == RawPcDescriptors::kUnoptStaticCall; 163 bool is_static_call = iter.Kind() == RawPcDescriptors::kUnoptStaticCall;
156 ic_data->PrintToJSONArrayNew(sites, token_pos, is_static_call); 164 ic_data->PrintToJSONArrayNew(sites, token_pos, is_static_call);
157 } 165 }
158 } 166 }
159 } 167 }
160 168
169
161 void SourceReport::PrintCoverageData(JSONObject* jsobj, 170 void SourceReport::PrintCoverageData(JSONObject* jsobj,
162 const Function& function, 171 const Function& function,
163 const Code& code) { 172 const Code& code) {
164 const TokenPosition begin_pos = function.token_pos(); 173 const TokenPosition begin_pos = function.token_pos();
165 const TokenPosition end_pos = function.end_token_pos(); 174 const TokenPosition end_pos = function.end_token_pos();
166 175
167 ZoneGrowableArray<const ICData*>* ic_data_array = 176 ZoneGrowableArray<const ICData*>* ic_data_array =
168 new(zone()) ZoneGrowableArray<const ICData*>(); 177 new(zone()) ZoneGrowableArray<const ICData*>();
169 function.RestoreICDataMap(ic_data_array, false /* clone ic-data */); 178 function.RestoreICDataMap(ic_data_array, false /* clone ic-data */);
170 const PcDescriptors& descriptors = PcDescriptors::Handle( 179 const PcDescriptors& descriptors = PcDescriptors::Handle(
171 zone(), code.pc_descriptors()); 180 zone(), code.pc_descriptors());
172 181
173 const int kCoverageNone = 0; 182 const int kCoverageNone = 0;
174 const int kCoverageMiss = 1; 183 const int kCoverageMiss = 1;
175 const int kCoverageHit = 2; 184 const int kCoverageHit = 2;
176 185
177 intptr_t func_length = (end_pos.Pos() - begin_pos.Pos()) + 1; 186 intptr_t func_length = (end_pos.Pos() - begin_pos.Pos()) + 1;
178 GrowableArray<char> coverage(func_length); 187 GrowableArray<char> coverage(func_length);
179 coverage.SetLength(func_length); 188 coverage.SetLength(func_length);
180 for (int i = 0; i < func_length; i++) { 189 for (int i = 0; i < func_length; i++) {
181 coverage[i] = kCoverageNone; 190 coverage[i] = kCoverageNone;
182 } 191 }
183 192
184 PcDescriptors::Iterator iter( 193 PcDescriptors::Iterator iter(
185 descriptors, 194 descriptors,
186 RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall); 195 RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall);
187 while (iter.MoveNext()) { 196 while (iter.MoveNext()) {
188 HANDLESCOPE(thread()); 197 HANDLESCOPE(thread());
198 // TODO(zra): Remove this bailout once DBC has reliable ICData.
199 #if defined(TARGET_ARCH_DBC)
200 if (iter.DeoptId() >= ic_data_array->length()) {
201 continue;
202 }
203 #else
204 ASSERT(iter.DeoptId() < ic_data_array->length());
205 #endif
189 const ICData* ic_data = (*ic_data_array)[iter.DeoptId()]; 206 const ICData* ic_data = (*ic_data_array)[iter.DeoptId()];
190 if (ic_data != NULL) { 207 if (ic_data != NULL) {
191 const TokenPosition token_pos = iter.TokenPos(); 208 const TokenPosition token_pos = iter.TokenPos();
192 if ((token_pos < begin_pos) || (token_pos > end_pos)) { 209 if ((token_pos < begin_pos) || (token_pos > end_pos)) {
193 // Does not correspond to a valid source position. 210 // Does not correspond to a valid source position.
194 continue; 211 continue;
195 } 212 }
196 intptr_t count = ic_data->AggregateCount(); 213 intptr_t count = ic_data->AggregateCount();
197 intptr_t token_offset = token_pos.Pos() - begin_pos.Pos(); 214 intptr_t token_offset = token_pos.Pos() - begin_pos.Pos();
198 if (count > 0) { 215 if (count > 0) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 VisitClosures(&ranges); 498 VisitClosures(&ranges);
482 } 499 }
483 500
484 // Print the script table. 501 // Print the script table.
485 JSONArray scripts(&report, "scripts"); 502 JSONArray scripts(&report, "scripts");
486 PrintScriptTable(&scripts); 503 PrintScriptTable(&scripts);
487 } 504 }
488 505
489 506
490 } // namespace dart 507 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698