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

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

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: address Srdjan comments 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) 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/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
8 #if defined(TARGET_ARCH_IA32) 8 #if defined(TARGET_ARCH_IA32)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 hex_index += 2; 1570 hex_index += 2;
1571 remaining_size -= 2; 1571 remaining_size -= 2;
1572 } 1572 }
1573 hex_buffer[hex_index] = '\0'; 1573 hex_buffer[hex_index] = '\0';
1574 return instruction_length; 1574 return instruction_length;
1575 } 1575 }
1576 1576
1577 1577
1578 void Disassembler::Disassemble(uword start, 1578 void Disassembler::Disassemble(uword start,
1579 uword end, 1579 uword end,
1580 DisassemblyFormatter* formatter) { 1580 DisassemblyFormatter* formatter,
1581 const Code::Comments& comments) {
1582 // TODO(vegorov) Decode and display comments.
srdjan 2012/05/17 21:30:37 Typically: "TODO(vegorov):" (add colon).
1581 ASSERT(formatter != NULL); 1583 ASSERT(formatter != NULL);
1582 char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form. 1584 char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form.
1583 char human_buffer[kUserReadableBufferSize]; // Human-readable instruction. 1585 char human_buffer[kUserReadableBufferSize]; // Human-readable instruction.
1584 uword pc = start; 1586 uword pc = start;
1585 while (pc < end) { 1587 while (pc < end) {
1586 int instruction_length = DecodeInstruction(hex_buffer, 1588 int instruction_length = DecodeInstruction(hex_buffer,
1587 sizeof(hex_buffer), 1589 sizeof(hex_buffer),
1588 human_buffer, 1590 human_buffer,
1589 sizeof(human_buffer), 1591 sizeof(human_buffer),
1590 pc); 1592 pc);
1591 formatter->ConsumeInstruction(hex_buffer, 1593 formatter->ConsumeInstruction(hex_buffer,
1592 sizeof(hex_buffer), 1594 sizeof(hex_buffer),
1593 human_buffer, 1595 human_buffer,
1594 sizeof(human_buffer), 1596 sizeof(human_buffer),
1595 pc); 1597 pc);
1596 pc += instruction_length; 1598 pc += instruction_length;
1597 } 1599 }
1598 } 1600 }
1599 1601
1600 } // namespace dart 1602 } // namespace dart
1601 1603
1602 #endif // defined TARGET_ARCH_IA32 1604 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/disassembler.h ('k') | runtime/vm/disassembler_x64.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698