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

Side by Side Diff: src/disasm-ia32.cc

Issue 8939: Backport the changes from the readability. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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 | « src/disasm-arm.cc ('k') | src/globals.h » ('j') | src/v8.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1088
1089 const char* NameConverter::NameInCode(byte* addr) const { 1089 const char* NameConverter::NameInCode(byte* addr) const {
1090 // IA32 does not embed debug strings at the moment. 1090 // IA32 does not embed debug strings at the moment.
1091 UNREACHABLE(); 1091 UNREACHABLE();
1092 return ""; 1092 return "";
1093 } 1093 }
1094 1094
1095 1095
1096 //------------------------------------------------------------------------------ 1096 //------------------------------------------------------------------------------
1097 1097
1098 static NameConverter defaultConverter;
1099
1100 Disassembler::Disassembler() : converter_(defaultConverter) {}
1101
1102
1103 Disassembler::Disassembler(const NameConverter& converter) 1098 Disassembler::Disassembler(const NameConverter& converter)
1104 : converter_(converter) {} 1099 : converter_(converter) {}
1105 1100
1106 1101
1107 Disassembler::~Disassembler() {} 1102 Disassembler::~Disassembler() {}
1108 1103
1109 1104
1110 int Disassembler::InstructionDecode(v8::internal::Vector<char> buffer, 1105 int Disassembler::InstructionDecode(v8::internal::Vector<char> buffer,
1111 byte* instruction) { 1106 byte* instruction) {
1112 DisassemblerIA32 d(converter_, false /*do not crash if unimplemented*/); 1107 DisassemblerIA32 d(converter_, false /*do not crash if unimplemented*/);
1113 return d.InstructionDecode(buffer, instruction); 1108 return d.InstructionDecode(buffer, instruction);
1114 } 1109 }
1115 1110
1116 1111
1117 // The IA-32 assembler does not currently use constant pools. 1112 // The IA-32 assembler does not currently use constant pools.
1118 int Disassembler::ConstantPoolSizeAt(byte* instruction) { return -1; } 1113 int Disassembler::ConstantPoolSizeAt(byte* instruction) { return -1; }
1119 1114
1120 1115
1121 /*static*/ void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { 1116 /*static*/ void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) {
1122 Disassembler d; 1117 NameConverter converter;
1118 Disassembler d(converter);
1123 for (byte* pc = begin; pc < end;) { 1119 for (byte* pc = begin; pc < end;) {
1124 v8::internal::EmbeddedVector<char, 128> buffer; 1120 v8::internal::EmbeddedVector<char, 128> buffer;
1125 buffer[0] = '\0'; 1121 buffer[0] = '\0';
1126 byte* prev_pc = pc; 1122 byte* prev_pc = pc;
1127 pc += d.InstructionDecode(buffer, pc); 1123 pc += d.InstructionDecode(buffer, pc);
1128 fprintf(f, "%p", prev_pc); 1124 fprintf(f, "%p", prev_pc);
1129 fprintf(f, " "); 1125 fprintf(f, " ");
1130 1126
1131 for (byte* bp = prev_pc; bp < pc; bp++) { 1127 for (byte* bp = prev_pc; bp < pc; bp++) {
1132 fprintf(f, "%02x", *bp); 1128 fprintf(f, "%02x", *bp);
1133 } 1129 }
1134 for (int i = 6 - (pc - prev_pc); i >= 0; i--) { 1130 for (int i = 6 - (pc - prev_pc); i >= 0; i--) {
1135 fprintf(f, " "); 1131 fprintf(f, " ");
1136 } 1132 }
1137 fprintf(f, " %s\n", buffer.start()); 1133 fprintf(f, " %s\n", buffer.start());
1138 } 1134 }
1139 } 1135 }
1140 1136
1141 1137
1142 } // namespace disasm 1138 } // namespace disasm
OLDNEW
« no previous file with comments | « src/disasm-arm.cc ('k') | src/globals.h » ('j') | src/v8.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698