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

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

Issue 11876019: When printing constants in the flow graph truncate them at the first new line character. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/intermediate_language.h" 7 #include "vm/intermediate_language.h"
8 #include "vm/os.h" 8 #include "vm/os.h"
9 #include "vm/parser.h" 9 #include "vm/parser.h"
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 } 197 }
198 198
199 199
200 void Value::PrintTo(BufferFormatter* f) const { 200 void Value::PrintTo(BufferFormatter* f) const {
201 PrintUse(f, *definition()); 201 PrintUse(f, *definition());
202 } 202 }
203 203
204 204
205 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { 205 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const {
206 f->Print("#%s", value().ToCString()); 206 const char* cstr = value().ToCString();
207 const char* new_line = strchr(cstr, '\n');
208 if (new_line == NULL) {
209 f->Print("#%s", cstr);
210 } else {
211 const intptr_t pos = new_line - cstr;
212 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(pos + 1);
213 strncpy(buffer, cstr, pos);
214 buffer[pos] = '\0';
215 f->Print("#%s\\n...", buffer);
216 }
207 } 217 }
208 218
209 219
210 void ConstraintInstr::PrintOperandsTo(BufferFormatter* f) const { 220 void ConstraintInstr::PrintOperandsTo(BufferFormatter* f) const {
211 value()->PrintTo(f); 221 value()->PrintTo(f);
212 f->Print(" ^ "); 222 f->Print(" ^ ");
213 constraint()->PrintTo(f); 223 constraint()->PrintTo(f);
214 } 224 }
215 225
216 226
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 f->Print(" ["); 675 f->Print(" [");
666 locations_[i].PrintTo(f); 676 locations_[i].PrintTo(f);
667 f->Print("]"); 677 f->Print("]");
668 } 678 }
669 } 679 }
670 f->Print(" }"); 680 f->Print(" }");
671 if (outer_ != NULL) outer_->PrintTo(f); 681 if (outer_ != NULL) outer_->PrintTo(f);
672 } 682 }
673 683
674 } // namespace dart 684 } // 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