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

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

Issue 563763003: Cleanup printing of propagated types to make it easier to read. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
« 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) 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 "type '%s' of '%s'.\n", 105 "type '%s' of '%s'.\n",
106 eliminated ? "Eliminated" : "Generated", 106 eliminated ? "Eliminated" : "Generated",
107 compile_type_name, 107 compile_type_name,
108 eliminated ? "more" : "not more", 108 eliminated ? "more" : "not more",
109 String::Handle(dst_type.Name()).ToCString(), 109 String::Handle(dst_type.Name()).ToCString(),
110 dst_name.ToCString()); 110 dst_name.ToCString());
111 } 111 }
112 112
113 113
114 void CompileType::PrintTo(BufferFormatter* f) const { 114 void CompileType::PrintTo(BufferFormatter* f) const {
115 f->Print("T{"); 115 const char* type_name = "?";
116 f->Print("%s, ", is_nullable_ ? "null" : "not-null"); 116 if ((cid_ != kIllegalCid) &&
Florian Schneider 2014/09/11 13:30:24 Fits one line?
Vyacheslav Egorov (Google) 2014/09/11 13:36:42 Done.
117 if (cid_ != kIllegalCid) { 117 (cid_ != kDynamicCid)) {
118 const Class& cls = 118 const Class& cls =
119 Class::Handle(Isolate::Current()->class_table()->At(cid_)); 119 Class::Handle(Isolate::Current()->class_table()->At(cid_));
120 f->Print("%s, ", String::Handle(cls.Name()).ToCString()); 120 type_name = String::Handle(cls.PrettyName()).ToCString();
121 } else { 121 } else if (type_ != NULL &&
Florian Schneider 2014/09/11 13:30:24 Maybe move indentation until (
Vyacheslav Egorov (Google) 2014/09/11 13:36:42 Done.
122 f->Print("?, "); 122 !type_->Equals(Type::Handle(Type::DynamicType()))) {
123 type_name = type_->ToCString();
124 } else if (!is_nullable()) {
125 type_name = "!null";
123 } 126 }
124 f->Print("%s}", (type_ != NULL) ? type_->ToCString() : "?"); 127
128 f->Print("T{%s%s}", type_name, is_nullable_ ? "?" : "");
125 } 129 }
126 130
127 131
128 const char* CompileType::ToCString() const { 132 const char* CompileType::ToCString() const {
129 char buffer[1024]; 133 char buffer[1024];
130 BufferFormatter f(buffer, sizeof(buffer)); 134 BufferFormatter f(buffer, sizeof(buffer));
131 PrintTo(&f); 135 PrintTo(&f);
132 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); 136 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer);
133 } 137 }
134 138
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } else { 220 } else {
217 f->Print("%s(", DebugName()); 221 f->Print("%s(", DebugName());
218 } 222 }
219 PrintOperandsTo(f); 223 PrintOperandsTo(f);
220 f->Print(")"); 224 f->Print(")");
221 if (range_ != NULL) { 225 if (range_ != NULL) {
222 f->Print(" "); 226 f->Print(" ");
223 range_->PrintTo(f); 227 range_->PrintTo(f);
224 } 228 }
225 229
226 if (type_ != NULL) { 230 if (type_ != NULL &&
231 ((type_->ToNullableCid() != kDynamicCid) ||
Florian Schneider 2014/09/11 13:30:24 Fits one line?
Vyacheslav Egorov (Google) 2014/09/11 13:36:42 Done.
232 !type_->is_nullable())) {
227 f->Print(" "); 233 f->Print(" ");
228 type_->PrintTo(f); 234 type_->PrintTo(f);
229 } 235 }
230 } 236 }
231 237
232 238
233 void Definition::PrintOperandsTo(BufferFormatter* f) const { 239 void Definition::PrintOperandsTo(BufferFormatter* f) const {
234 for (int i = 0; i < InputCount(); ++i) { 240 for (int i = 0; i < InputCount(); ++i) {
235 if (i > 0) f->Print(", "); 241 if (i > 0) f->Print(", ");
236 if (InputAt(i) != NULL) { 242 if (InputAt(i) != NULL) {
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 } 1172 }
1167 1173
1168 const char* Environment::ToCString() const { 1174 const char* Environment::ToCString() const {
1169 char buffer[1024]; 1175 char buffer[1024];
1170 BufferFormatter bf(buffer, 1024); 1176 BufferFormatter bf(buffer, 1024);
1171 PrintTo(&bf); 1177 PrintTo(&bf);
1172 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); 1178 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer);
1173 } 1179 }
1174 1180
1175 } // namespace dart 1181 } // 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