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

Side by Side Diff: src/disassembler.cc

Issue 422063005: Contribution of PowerPC port. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: re-upload - catch up to 8/19 level Created 6 years, 3 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; 100 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer;
101 StringBuilder out(out_buffer.start(), out_buffer.length()); 101 StringBuilder out(out_buffer.start(), out_buffer.length());
102 byte* pc = begin; 102 byte* pc = begin;
103 disasm::Disassembler d(converter); 103 disasm::Disassembler d(converter);
104 RelocIterator* it = NULL; 104 RelocIterator* it = NULL;
105 if (converter.code() != NULL) { 105 if (converter.code() != NULL) {
106 it = new RelocIterator(converter.code()); 106 it = new RelocIterator(converter.code());
107 } else { 107 } else {
108 // No relocation information when printing code stubs. 108 // No relocation information when printing code stubs.
109 } 109 }
110 #if !V8_TARGET_ARCH_PPC
Sven Panne 2014/09/01 07:55:16 No architecture-dependent #ifdefs in this file, pl
110 int constants = -1; // no constants being decoded at the start 111 int constants = -1; // no constants being decoded at the start
112 #endif
111 113
112 while (pc < end) { 114 while (pc < end) {
113 // First decode instruction so that we know its length. 115 // First decode instruction so that we know its length.
114 byte* prev_pc = pc; 116 byte* prev_pc = pc;
117 #if !V8_TARGET_ARCH_PPC
115 if (constants > 0) { 118 if (constants > 0) {
116 SNPrintF(decode_buffer, 119 SNPrintF(decode_buffer,
117 "%08x constant", 120 "%08x constant",
118 *reinterpret_cast<int32_t*>(pc)); 121 *reinterpret_cast<int32_t*>(pc));
119 constants--; 122 constants--;
120 pc += 4; 123 pc += 4;
121 } else { 124 } else {
122 int num_const = d.ConstantPoolSizeAt(pc); 125 int num_const = d.ConstantPoolSizeAt(pc);
123 if (num_const >= 0) { 126 if (num_const >= 0) {
124 SNPrintF(decode_buffer, 127 SNPrintF(decode_buffer,
125 "%08x constant pool begin", 128 "%08x constant pool begin",
126 *reinterpret_cast<int32_t*>(pc)); 129 *reinterpret_cast<int32_t*>(pc));
127 constants = num_const; 130 constants = num_const;
128 pc += 4; 131 pc += 4;
129 } else if (it != NULL && !it->done() && it->rinfo()->pc() == pc && 132 } else if (it != NULL && !it->done() && it->rinfo()->pc() == pc &&
130 it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE) { 133 it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE) {
131 // raw pointer embedded in code stream, e.g., jump table 134 // raw pointer embedded in code stream, e.g., jump table
132 byte* ptr = *reinterpret_cast<byte**>(pc); 135 byte* ptr = *reinterpret_cast<byte**>(pc);
133 SNPrintF(decode_buffer, 136 SNPrintF(decode_buffer,
134 "%08" V8PRIxPTR " jump table entry %4" V8PRIdPTR, 137 "%08" V8PRIxPTR " jump table entry %4" V8PRIdPTR,
135 reinterpret_cast<intptr_t>(ptr), 138 reinterpret_cast<intptr_t>(ptr),
136 ptr - begin); 139 ptr - begin);
137 pc += 4; 140 pc += 4;
138 } else { 141 } else {
142 #elif ABI_USES_FUNCTION_DESCRIPTORS || V8_OOL_CONSTANT_POOL
143 // V8_TARGET_ARCH_PPC
144 {
145 // Function descriptors are specially decoded and skipped.
146 // Other internal references (load of ool constant pool pointer)
147 // are not since they are a encoded as a regular mov sequence.
148 int skip;
149 if (it != NULL && !it->done() && it->rinfo()->pc() == pc &&
150 it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE &&
151 (skip = Assembler::DecodeInternalReference(decode_buffer, pc))) {
152 pc += skip;
153 } else {
154 #else
155 {
156 {
157 #endif
139 decode_buffer[0] = '\0'; 158 decode_buffer[0] = '\0';
140 pc += d.InstructionDecode(decode_buffer, pc); 159 pc += d.InstructionDecode(decode_buffer, pc);
141 } 160 }
142 } 161 }
143 162
144 // Collect RelocInfo for this instruction (prev_pc .. pc-1) 163 // Collect RelocInfo for this instruction (prev_pc .. pc-1)
145 List<const char*> comments(4); 164 List<const char*> comments(4);
146 List<byte*> pcs(1); 165 List<byte*> pcs(1);
147 List<RelocInfo::Mode> rmodes(1); 166 List<RelocInfo::Mode> rmodes(1);
148 List<intptr_t> datas(1); 167 List<intptr_t> datas(1);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) { 345 int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) {
327 return 0; 346 return 0;
328 } 347 }
329 348
330 349
331 void Disassembler::Decode(FILE* f, Code* code) {} 350 void Disassembler::Decode(FILE* f, Code* code) {}
332 351
333 #endif // ENABLE_DISASSEMBLER 352 #endif // ENABLE_DISASSEMBLER
334 353
335 } } // namespace v8::internal 354 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698