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

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

Issue 2856543002: Use off-heap data for class check instructions (Closed)
Patch Set: Feedback from Slava: rejig inheritance of CallTargets Created 3 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/il_printer.h" 5 #include "vm/il_printer.h"
6 6
7 #include "vm/flow_graph_range_analysis.h" 7 #include "vm/flow_graph_range_analysis.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/parser.h" 10 #include "vm/parser.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 const CallTargets& targets, 199 const CallTargets& targets,
200 intptr_t num_checks_to_print) { 200 intptr_t num_checks_to_print) {
201 f->Print(" IC["); 201 f->Print(" IC[");
202 f->Print("%" Pd ": ", targets.length()); 202 f->Print("%" Pd ": ", targets.length());
203 Function& target = Function::Handle(); 203 Function& target = Function::Handle();
204 if ((num_checks_to_print == FlowGraphPrinter::kPrintAll) || 204 if ((num_checks_to_print == FlowGraphPrinter::kPrintAll) ||
205 (num_checks_to_print > targets.length())) { 205 (num_checks_to_print > targets.length())) {
206 num_checks_to_print = targets.length(); 206 num_checks_to_print = targets.length();
207 } 207 }
208 for (intptr_t i = 0; i < num_checks_to_print; i++) { 208 for (intptr_t i = 0; i < num_checks_to_print; i++) {
209 const CidRangeTarget& range = targets[i]; 209 const CidRange& range = targets[i];
210 const intptr_t count = range.count; 210 const intptr_t count = targets.TargetAt(i)->count;
211 target ^= range.target->raw(); 211 target ^= targets.TargetAt(i)->target->raw();
212 if (i > 0) { 212 if (i > 0) {
213 f->Print(" | "); 213 f->Print(" | ");
214 } 214 }
215 if (range.cid_start == range.cid_end) { 215 if (range.cid_start == range.cid_end) {
216 const Class& cls = 216 const Class& cls =
217 Class::Handle(Isolate::Current()->class_table()->At(range.cid_start)); 217 Class::Handle(Isolate::Current()->class_table()->At(range.cid_start));
218 f->Print("%s", String::Handle(cls.Name()).ToCString()); 218 f->Print("%s", String::Handle(cls.Name()).ToCString());
219 f->Print(" cnt:%" Pd " trgt:'%s'", count, target.ToQualifiedCString()); 219 f->Print(" cid %" Pd " cnt:%" Pd " trgt:'%s'", range.cid_start, count,
220 target.ToQualifiedCString());
220 } else { 221 } else {
221 const Class& cls = Class::Handle(range.target->Owner()); 222 const Class& cls = Class::Handle(target.Owner());
222 f->Print("cid %" Pd "-%" Pd " %s", range.cid_start, range.cid_end, 223 f->Print("cid %" Pd "-%" Pd " %s", range.cid_start, range.cid_end,
223 String::Handle(cls.Name()).ToCString()); 224 String::Handle(cls.Name()).ToCString());
224 f->Print(" cnt:%" Pd " trgt:'%s'", count, target.ToQualifiedCString()); 225 f->Print(" cnt:%" Pd " trgt:'%s'", count, target.ToQualifiedCString());
225 } 226 }
226 } 227 }
227 if (num_checks_to_print < targets.length()) { 228 if (num_checks_to_print < targets.length()) {
228 f->Print("..."); 229 f->Print("...");
229 } 230 }
230 f->Print("]"); 231 f->Print("]");
231 } 232 }
232 233
233 234
235 static void PrintCidsHelper(BufferFormatter* f,
236 const Cids& targets,
237 intptr_t num_checks_to_print) {
238 f->Print(" Cids[");
239 f->Print("%" Pd ": ", targets.length());
240 if ((num_checks_to_print == FlowGraphPrinter::kPrintAll) ||
241 (num_checks_to_print > targets.length())) {
242 num_checks_to_print = targets.length();
243 }
244 for (intptr_t i = 0; i < num_checks_to_print; i++) {
245 const CidRange& range = targets[i];
246 if (i > 0) {
247 f->Print(" | ");
248 }
249 const Class& cls =
250 Class::Handle(Isolate::Current()->class_table()->At(range.cid_start));
251 f->Print("%s etc. ", String::Handle(cls.Name()).ToCString());
252 if (range.cid_start == range.cid_end) {
253 f->Print(" cid %" Pd, range.cid_start);
254 } else {
255 f->Print(" cid %" Pd "-%" Pd, range.cid_start, range.cid_end);
256 }
257 }
258 if (num_checks_to_print < targets.length()) {
259 f->Print("...");
260 }
261 f->Print("]");
262 }
263
264
234 static void PrintICDataHelper(BufferFormatter* f, 265 static void PrintICDataHelper(BufferFormatter* f,
235 const ICData& ic_data, 266 const ICData& ic_data,
236 intptr_t num_checks_to_print) { 267 intptr_t num_checks_to_print) {
237 f->Print(" IC["); 268 f->Print(" IC[");
238 f->Print("%" Pd ": ", ic_data.NumberOfChecks()); 269 f->Print("%" Pd ": ", ic_data.NumberOfChecks());
239 Function& target = Function::Handle(); 270 Function& target = Function::Handle();
240 if ((num_checks_to_print == FlowGraphPrinter::kPrintAll) || 271 if ((num_checks_to_print == FlowGraphPrinter::kPrintAll) ||
241 (num_checks_to_print > ic_data.NumberOfChecks())) { 272 (num_checks_to_print > ic_data.NumberOfChecks())) {
242 num_checks_to_print = ic_data.NumberOfChecks(); 273 num_checks_to_print = ic_data.NumberOfChecks();
243 } 274 }
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 value()->PrintTo(f); 1055 value()->PrintTo(f);
1025 1056
1026 const Class& cls = 1057 const Class& cls =
1027 Class::Handle(Isolate::Current()->class_table()->At(cid())); 1058 Class::Handle(Isolate::Current()->class_table()->At(cid()));
1028 f->Print(", %s", String::Handle(cls.ScrubbedName()).ToCString()); 1059 f->Print(", %s", String::Handle(cls.ScrubbedName()).ToCString());
1029 } 1060 }
1030 1061
1031 1062
1032 void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const { 1063 void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const {
1033 value()->PrintTo(f); 1064 value()->PrintTo(f);
1034 if (FLAG_display_sorted_ic_data) { 1065 PrintCidsHelper(f, cids_, FlowGraphPrinter::kPrintAll);
1035 PrintICDataSortedHelper(f, unary_checks());
1036 } else {
1037 PrintICDataHelper(f, unary_checks(), FlowGraphPrinter::kPrintAll);
1038 }
1039 if (IsNullCheck()) { 1066 if (IsNullCheck()) {
1040 f->Print(" nullcheck"); 1067 f->Print(" nullcheck");
1041 } 1068 }
1042 } 1069 }
1043 1070
1044 1071
1045 void InvokeMathCFunctionInstr::PrintOperandsTo(BufferFormatter* f) const { 1072 void InvokeMathCFunctionInstr::PrintOperandsTo(BufferFormatter* f) const {
1046 f->Print("%s, ", MethodRecognizer::KindToCString(recognized_kind_)); 1073 f->Print("%s, ", MethodRecognizer::KindToCString(recognized_kind_));
1047 Definition::PrintOperandsTo(f); 1074 Definition::PrintOperandsTo(f);
1048 } 1075 }
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 } 1385 }
1359 1386
1360 1387
1361 bool FlowGraphPrinter::ShouldPrint(const Function& function) { 1388 bool FlowGraphPrinter::ShouldPrint(const Function& function) {
1362 return false; 1389 return false;
1363 } 1390 }
1364 1391
1365 #endif // !PRODUCT 1392 #endif // !PRODUCT
1366 1393
1367 } // namespace dart 1394 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698