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

Side by Side Diff: runtime/vm/disassembler.h

Issue 10407019: Extend assembler with ability to produce comments for the generated code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #ifndef VM_DISASSEMBLER_H_ 5 #ifndef VM_DISASSEMBLER_H_
6 #define VM_DISASSEMBLER_H_ 6 #define VM_DISASSEMBLER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 }; 55 };
56 56
57 57
58 // Disassemble instructions. 58 // Disassemble instructions.
59 class Disassembler : public AllStatic { 59 class Disassembler : public AllStatic {
60 public: 60 public:
61 // Disassemble instructions between start and end. 61 // Disassemble instructions between start and end.
62 // (The assumption is that start is at a valid instruction). 62 // (The assumption is that start is at a valid instruction).
63 static void Disassemble(uword start, 63 static void Disassemble(uword start,
64 uword end, 64 uword end,
65 DisassemblyFormatter* formatter); 65 DisassemblyFormatter* formatter,
66 CodeComments comments);
srdjan 2012/05/17 17:22:08 const CodeComments& comments
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
67
68 static void Disassemble(uword start,
69 uword end,
70 DisassemblyFormatter* formatter) {
71 Disassemble(start, end, formatter, CodeComments::New(0));
72 }
73
74 static void Disassemble(uword start, uword end, CodeComments comments) {
75 DisassembleToStdout stdout_formatter;
76 Disassemble(start, end, &stdout_formatter, comments);
77 }
78
66 static void Disassemble(uword start, uword end) { 79 static void Disassemble(uword start, uword end) {
67 DisassembleToStdout stdout_formatter; 80 DisassembleToStdout stdout_formatter;
68 Disassemble(start, end, &stdout_formatter); 81 Disassemble(start, end, &stdout_formatter);
69 } 82 }
70 83
71 // Disassemble instructions in a memory region. 84 // Disassemble instructions in a memory region.
72 static void DisassembleMemoryRegion(const MemoryRegion& instructions, 85 static void DisassembleMemoryRegion(const MemoryRegion& instructions,
73 DisassemblyFormatter* formatter) { 86 DisassemblyFormatter* formatter) {
74 uword start = instructions.start(); 87 uword start = instructions.start();
75 uword end = instructions.end(); 88 uword end = instructions.end();
76 Disassemble(start, end, formatter); 89 Disassemble(start, end, formatter);
77 } 90 }
91
78 static void DisassembleMemoryRegion(const MemoryRegion& instructions) { 92 static void DisassembleMemoryRegion(const MemoryRegion& instructions) {
79 uword start = instructions.start(); 93 uword start = instructions.start();
80 uword end = instructions.end(); 94 uword end = instructions.end();
81 Disassemble(start, end); 95 Disassemble(start, end);
82 } 96 }
83 97
84 // Decodes one instruction. 98 // Decodes one instruction.
85 // Writes a hexadecimal representation into the hex_buffer and a 99 // Writes a hexadecimal representation into the hex_buffer and a
86 // human-readable representation into the human_buffer. 100 // human-readable representation into the human_buffer.
87 // Returns the length of the decoded instruction in bytes. 101 // Returns the length of the decoded instruction in bytes.
88 static int DecodeInstruction(char* hex_buffer, intptr_t hex_size, 102 static int DecodeInstruction(char* hex_buffer, intptr_t hex_size,
89 char* human_buffer, intptr_t human_size, 103 char* human_buffer, intptr_t human_size,
90 uword pc); 104 uword pc);
91 105
92 private: 106 private:
93 static const int kHexadecimalBufferSize = 32; 107 static const int kHexadecimalBufferSize = 32;
94 static const int kUserReadableBufferSize = 256; 108 static const int kUserReadableBufferSize = 256;
95 }; 109 };
96 110
97 } // namespace dart 111 } // namespace dart
98 112
99 #endif // VM_DISASSEMBLER_H_ 113 #endif // VM_DISASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698