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

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

Issue 2891713002: Cleanup: Make CheckClassId instruction more general so it (Closed)
Patch Set: Feedback from Martin 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
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.h » ('j') | 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) 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 CidRange& range = targets[i]; 209 const CidRange& range = targets[i];
210 const intptr_t count = targets.TargetAt(i)->count; 210 const intptr_t count = targets.TargetAt(i)->count;
211 target ^= targets.TargetAt(i)->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.IsSingleCid()) {
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(" cid %" Pd " cnt:%" Pd " trgt:'%s'", range.cid_start, count, 219 f->Print(" cid %" Pd " cnt:%" Pd " trgt:'%s'", range.cid_start, count,
220 target.ToQualifiedCString()); 220 target.ToQualifiedCString());
221 } else { 221 } else {
222 const Class& cls = Class::Handle(target.Owner()); 222 const Class& cls = Class::Handle(target.Owner());
223 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,
224 String::Handle(cls.Name()).ToCString()); 224 String::Handle(cls.Name()).ToCString());
225 f->Print(" cnt:%" Pd " trgt:'%s'", count, target.ToQualifiedCString()); 225 f->Print(" cnt:%" Pd " trgt:'%s'", count, target.ToQualifiedCString());
(...skipping 16 matching lines...) Expand all
242 num_checks_to_print = targets.length(); 242 num_checks_to_print = targets.length();
243 } 243 }
244 for (intptr_t i = 0; i < num_checks_to_print; i++) { 244 for (intptr_t i = 0; i < num_checks_to_print; i++) {
245 const CidRange& range = targets[i]; 245 const CidRange& range = targets[i];
246 if (i > 0) { 246 if (i > 0) {
247 f->Print(" | "); 247 f->Print(" | ");
248 } 248 }
249 const Class& cls = 249 const Class& cls =
250 Class::Handle(Isolate::Current()->class_table()->At(range.cid_start)); 250 Class::Handle(Isolate::Current()->class_table()->At(range.cid_start));
251 f->Print("%s etc. ", String::Handle(cls.Name()).ToCString()); 251 f->Print("%s etc. ", String::Handle(cls.Name()).ToCString());
252 if (range.cid_start == range.cid_end) { 252 if (range.IsSingleCid()) {
253 f->Print(" cid %" Pd, range.cid_start); 253 f->Print(" cid %" Pd, range.cid_start);
254 } else { 254 } else {
255 f->Print(" cid %" Pd "-%" Pd, range.cid_start, range.cid_end); 255 f->Print(" cid %" Pd "-%" Pd, range.cid_start, range.cid_end);
256 } 256 }
257 } 257 }
258 if (num_checks_to_print < targets.length()) { 258 if (num_checks_to_print < targets.length()) {
259 f->Print("..."); 259 f->Print("...");
260 } 260 }
261 f->Print("]"); 261 f->Print("]");
262 } 262 }
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 void UnaryDoubleOpInstr::PrintOperandsTo(BufferFormatter* f) const { 1048 void UnaryDoubleOpInstr::PrintOperandsTo(BufferFormatter* f) const {
1049 f->Print("%s, ", Token::Str(op_kind())); 1049 f->Print("%s, ", Token::Str(op_kind()));
1050 value()->PrintTo(f); 1050 value()->PrintTo(f);
1051 } 1051 }
1052 1052
1053 1053
1054 void CheckClassIdInstr::PrintOperandsTo(BufferFormatter* f) const { 1054 void CheckClassIdInstr::PrintOperandsTo(BufferFormatter* f) const {
1055 value()->PrintTo(f); 1055 value()->PrintTo(f);
1056 1056
1057 const Class& cls = 1057 const Class& cls =
1058 Class::Handle(Isolate::Current()->class_table()->At(cid())); 1058 Class::Handle(Isolate::Current()->class_table()->At(cids().cid_start));
1059 f->Print(", %s", String::Handle(cls.ScrubbedName()).ToCString()); 1059 const String& name = String::Handle(cls.ScrubbedName());
1060 if (cids().IsSingleCid()) {
1061 f->Print(", %s", name.ToCString());
1062 } else {
1063 const Class& cls2 =
1064 Class::Handle(Isolate::Current()->class_table()->At(cids().cid_end));
1065 const String& name2 = String::Handle(cls2.ScrubbedName());
1066 f->Print(", cid %" Pd "-%" Pd " %s-%s", cids().cid_start, cids().cid_end,
1067 name.ToCString(), name2.ToCString());
1068 }
1060 } 1069 }
1061 1070
1062 1071
1063 void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const { 1072 void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const {
1064 value()->PrintTo(f); 1073 value()->PrintTo(f);
1065 PrintCidsHelper(f, cids_, FlowGraphPrinter::kPrintAll); 1074 PrintCidsHelper(f, cids_, FlowGraphPrinter::kPrintAll);
1066 if (IsNullCheck()) { 1075 if (IsNullCheck()) {
1067 f->Print(" nullcheck"); 1076 f->Print(" nullcheck");
1068 } 1077 }
1069 } 1078 }
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 } 1394 }
1386 1395
1387 1396
1388 bool FlowGraphPrinter::ShouldPrint(const Function& function) { 1397 bool FlowGraphPrinter::ShouldPrint(const Function& function) {
1389 return false; 1398 return false;
1390 } 1399 }
1391 1400
1392 #endif // !PRODUCT 1401 #endif // !PRODUCT
1393 1402
1394 } // namespace dart 1403 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698