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

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

Issue 263093005: - When requested, always generate code comments. Disassembly (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_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"
11 #include "vm/os.h" 11 #include "vm/os.h"
12 #include "vm/zone.h" 12 #include "vm/zone.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 DEFINE_FLAG(bool, code_comments, true, 16 DEFINE_FLAG(bool, code_comments, false,
17 "Include comments into code and disassembly"); 17 "Include comments into code and disassembly");
18 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) 18 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS)
19 DEFINE_FLAG(bool, use_far_branches, false, 19 DEFINE_FLAG(bool, use_far_branches, false,
20 "Enable far branches for ARM and MIPS"); 20 "Enable far branches for ARM and MIPS");
21 #endif 21 #endif
22 22
23 DECLARE_FLAG(bool, disassemble); 23 DECLARE_FLAG(bool, disassemble);
24 DECLARE_FLAG(bool, disassemble_optimized); 24 DECLARE_FLAG(bool, disassemble_optimized);
25 25
26 static uword NewContents(intptr_t capacity) { 26 static uword NewContents(intptr_t capacity) {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 void Assembler::Unreachable(const char* message) { 203 void Assembler::Unreachable(const char* message) {
204 const char* format = "Unreachable: %s"; 204 const char* format = "Unreachable: %s";
205 const intptr_t len = OS::SNPrint(NULL, 0, format, message); 205 const intptr_t len = OS::SNPrint(NULL, 0, format, message);
206 char* buffer = reinterpret_cast<char*>(malloc(len + 1)); 206 char* buffer = reinterpret_cast<char*>(malloc(len + 1));
207 OS::SNPrint(buffer, len + 1, format, message); 207 OS::SNPrint(buffer, len + 1, format, message);
208 Stop(buffer); 208 Stop(buffer);
209 } 209 }
210 210
211 211
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::ZoneHandle(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/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698