| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |