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

Side by Side Diff: src/disassembler.cc

Issue 113199: X64: General fixes - added inline definitions and changed tome places to intptr_t. (Closed)
Patch Set: Created 11 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
« no previous file with comments | « no previous file | src/globals.h » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 25 matching lines...) Expand all
36 #include "serialize.h" 36 #include "serialize.h"
37 #include "string-stream.h" 37 #include "string-stream.h"
38 38
39 namespace v8 { namespace internal { 39 namespace v8 { namespace internal {
40 40
41 #ifdef ENABLE_DISASSEMBLER 41 #ifdef ENABLE_DISASSEMBLER
42 42
43 void Disassembler::Dump(FILE* f, byte* begin, byte* end) { 43 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {
44 for (byte* pc = begin; pc < end; pc++) { 44 for (byte* pc = begin; pc < end; pc++) {
45 if (f == NULL) { 45 if (f == NULL) {
46 PrintF("%p %4d %02x\n", pc, pc - begin, *pc); 46 PrintF("%"V8PRIp" %4"V8PRId" %02x\n", pc, pc - begin, *pc);
Dean McNamee 2009/05/12 08:22:40 should we put space around these? It looks weird,
Erik Corry 2009/05/12 09:24:50 I think the names are way too cryptic considering
Lasse Reichstein 2009/05/12 10:32:51 A quick look at what people do with PRId64 and lik
Lasse Reichstein 2009/05/12 10:32:51 It shouldn't say "print a pointer difference". It
47 } else { 47 } else {
48 fprintf(f, "%p %4d %02x\n", pc, pc - begin, *pc); 48 fprintf(f, "%"V8PRIp" %4"V8PRId" %02x\n",
49 reinterpret_cast<uintptr_t>(pc), pc - begin, *pc);
49 } 50 }
50 } 51 }
51 } 52 }
52 53
53 54
54 class V8NameConverter: public disasm::NameConverter { 55 class V8NameConverter: public disasm::NameConverter {
55 public: 56 public:
56 explicit V8NameConverter(Code* code) : code_(code) {} 57 explicit V8NameConverter(Code* code) : code_(code) {}
57 virtual const char* NameOfAddress(byte* pc) const; 58 virtual const char* NameOfAddress(byte* pc) const;
58 virtual const char* NameInCode(byte* addr) const; 59 virtual const char* NameInCode(byte* addr) const;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 OS::SNPrintF(decode_buffer, 138 OS::SNPrintF(decode_buffer,
138 "%08x constant pool begin", 139 "%08x constant pool begin",
139 *reinterpret_cast<int32_t*>(pc)); 140 *reinterpret_cast<int32_t*>(pc));
140 constants = num_const; 141 constants = num_const;
141 pc += 4; 142 pc += 4;
142 } else if (it != NULL && !it->done() && it->rinfo()->pc() == pc && 143 } else if (it != NULL && !it->done() && it->rinfo()->pc() == pc &&
143 it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE) { 144 it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE) {
144 // raw pointer embedded in code stream, e.g., jump table 145 // raw pointer embedded in code stream, e.g., jump table
145 byte* ptr = *reinterpret_cast<byte**>(pc); 146 byte* ptr = *reinterpret_cast<byte**>(pc);
146 OS::SNPrintF(decode_buffer, 147 OS::SNPrintF(decode_buffer,
147 "%08x jump table entry %4d", 148 "%08"V8PRIp" jump table entry %4"V8PRId,
148 reinterpret_cast<int32_t>(ptr), 149 ptr,
149 ptr - begin); 150 ptr - begin);
150 pc += 4; 151 pc += 4;
151 } else { 152 } else {
152 decode_buffer[0] = '\0'; 153 decode_buffer[0] = '\0';
153 pc += d.InstructionDecode(decode_buffer, pc); 154 pc += d.InstructionDecode(decode_buffer, pc);
154 } 155 }
155 } 156 }
156 157
157 // Collect RelocInfo for this instruction (prev_pc .. pc-1) 158 // Collect RelocInfo for this instruction (prev_pc .. pc-1)
158 List<const char*> comments(4); 159 List<const char*> comments(4);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 301
301 #else // ENABLE_DISASSEMBLER 302 #else // ENABLE_DISASSEMBLER
302 303
303 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} 304 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {}
304 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; } 305 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; }
305 void Disassembler::Decode(FILE* f, Code* code) {} 306 void Disassembler::Decode(FILE* f, Code* code) {}
306 307
307 #endif // ENABLE_DISASSEMBLER 308 #endif // ENABLE_DISASSEMBLER
308 309
309 } } // namespace v8::internal 310 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/globals.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698