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

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

Issue 254483005: - Rationalize the way we use comments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 | runtime/vm/compiler.cc » ('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/assembler.h" 5 #include "vm/assembler.h"
6 6
7 #include "platform/utils.h" 7 #include "platform/utils.h"
8 #include "vm/cpu.h" 8 #include "vm/cpu.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/memory_region.h" 10 #include "vm/memory_region.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void Assembler::Comment(const char* format, ...) { 212 void Assembler::Comment(const char* format, ...) {
213 if (FLAG_code_comments && (FLAG_disassemble || FLAG_disassemble_optimized)) { 213 if (FLAG_code_comments && (FLAG_disassemble || FLAG_disassemble_optimized)) {
214 char buffer[1024]; 214 char buffer[1024];
215 215
216 va_list args; 216 va_list args;
217 va_start(args, format); 217 va_start(args, format);
218 OS::VSNPrint(buffer, sizeof(buffer), format, args); 218 OS::VSNPrint(buffer, sizeof(buffer), format, args);
219 va_end(args); 219 va_end(args);
220 220
221 comments_.Add(new CodeComment(buffer_.GetPosition(), 221 comments_.Add(new CodeComment(buffer_.GetPosition(),
222 String::Handle(String::New(buffer, 222 String::ZoneHandle(String::New(buffer,
223 Heap::kOld)))); 223 Heap::kOld))));
224 } 224 }
225 } 225 }
226 226
227 227
228 const Code::Comments& Assembler::GetCodeComments() const { 228 const Code::Comments& Assembler::GetCodeComments() const {
229 Code::Comments& comments = Code::Comments::New(comments_.length()); 229 Code::Comments& comments = Code::Comments::New(comments_.length());
230 230
231 for (intptr_t i = 0; i < comments_.length(); i++) { 231 for (intptr_t i = 0; i < comments_.length(); i++) {
232 comments.SetPCOffsetAt(i, comments_[i]->pc_offset()); 232 comments.SetPCOffsetAt(i, comments_[i]->pc_offset());
233 comments.SetCommentAt(i, comments_[i]->comment()); 233 comments.SetCommentAt(i, comments_[i]->comment());
234 } 234 }
235 235
236 return comments; 236 return comments;
237 } 237 }
238 238
239 } // namespace dart 239 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698