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

Side by Side Diff: src/disassembler.cc

Issue 866843003: Contribution of PowerPC port (continuation of 422063005) - AIX Common1 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; 78 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer;
79 StringBuilder out(out_buffer.start(), out_buffer.length()); 79 StringBuilder out(out_buffer.start(), out_buffer.length());
80 byte* pc = begin; 80 byte* pc = begin;
81 disasm::Disassembler d(converter); 81 disasm::Disassembler d(converter);
82 RelocIterator* it = NULL; 82 RelocIterator* it = NULL;
83 if (converter.code() != NULL) { 83 if (converter.code() != NULL) {
84 it = new RelocIterator(converter.code()); 84 it = new RelocIterator(converter.code());
85 } else { 85 } else {
86 // No relocation information when printing code stubs. 86 // No relocation information when printing code stubs.
87 } 87 }
88 #if !V8_TARGET_ARCH_PPC
88 int constants = -1; // no constants being decoded at the start 89 int constants = -1; // no constants being decoded at the start
90 #endif
89 91
90 while (pc < end) { 92 while (pc < end) {
91 // First decode instruction so that we know its length. 93 // First decode instruction so that we know its length.
92 byte* prev_pc = pc; 94 byte* prev_pc = pc;
95 #if !V8_TARGET_ARCH_PPC
93 if (constants > 0) { 96 if (constants > 0) {
94 SNPrintF(decode_buffer, 97 SNPrintF(decode_buffer,
95 "%08x constant", 98 "%08x constant",
96 *reinterpret_cast<int32_t*>(pc)); 99 *reinterpret_cast<int32_t*>(pc));
97 constants--; 100 constants--;
98 pc += 4; 101 pc += 4;
99 } else { 102 } else {
100 int num_const = d.ConstantPoolSizeAt(pc); 103 int num_const = d.ConstantPoolSizeAt(pc);
101 if (num_const >= 0) { 104 if (num_const >= 0) {
102 SNPrintF(decode_buffer, 105 SNPrintF(decode_buffer,
103 "%08x constant pool begin", 106 "%08x constant pool begin",
104 *reinterpret_cast<int32_t*>(pc)); 107 *reinterpret_cast<int32_t*>(pc));
105 constants = num_const; 108 constants = num_const;
106 pc += 4; 109 pc += 4;
107 } else if (it != NULL && !it->done() && it->rinfo()->pc() == pc && 110 } else if (it != NULL && !it->done() && it->rinfo()->pc() == pc &&
108 it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE) { 111 it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE) {
109 // raw pointer embedded in code stream, e.g., jump table 112 // raw pointer embedded in code stream, e.g., jump table
110 byte* ptr = *reinterpret_cast<byte**>(pc); 113 byte* ptr = *reinterpret_cast<byte**>(pc);
111 SNPrintF(decode_buffer, 114 SNPrintF(decode_buffer,
112 "%08" V8PRIxPTR " jump table entry %4" V8PRIdPTR, 115 "%08" V8PRIxPTR " jump table entry %4" V8PRIdPTR,
113 reinterpret_cast<intptr_t>(ptr), 116 reinterpret_cast<intptr_t>(ptr),
114 ptr - begin); 117 ptr - begin);
115 pc += 4; 118 pc += 4;
116 } else { 119 } else {
120 #elif ABI_USES_FUNCTION_DESCRIPTORS || V8_OOL_CONSTANT_POOL
121 // V8_TARGET_ARCH_PPC
122 {
123 // Function descriptors are specially decoded and skipped.
124 // Other internal references (load of ool constant pool pointer)
125 // are not since they are a encoded as a regular mov sequence.
126 int skip;
127 if (it != NULL && !it->done() && it->rinfo()->pc() == pc &&
128 it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE &&
129 (skip = Assembler::DecodeInternalReference(decode_buffer, pc))) {
130 pc += skip;
131 } else {
132 #else
Sven Panne 2015/01/27 11:47:06 Could you restructure these #if/#elif/#else/#endif
michael_dawson 2015/01/29 00:08:29 Will do
133 {
134 {
135 #endif
117 decode_buffer[0] = '\0'; 136 decode_buffer[0] = '\0';
118 pc += d.InstructionDecode(decode_buffer, pc); 137 pc += d.InstructionDecode(decode_buffer, pc);
119 } 138 }
120 } 139 }
121 140
122 // Collect RelocInfo for this instruction (prev_pc .. pc-1) 141 // Collect RelocInfo for this instruction (prev_pc .. pc-1)
123 List<const char*> comments(4); 142 List<const char*> comments(4);
124 List<byte*> pcs(1); 143 List<byte*> pcs(1);
125 List<RelocInfo::Mode> rmodes(1); 144 List<RelocInfo::Mode> rmodes(1);
126 List<intptr_t> datas(1); 145 List<intptr_t> datas(1);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 #else // ENABLE_DISASSEMBLER 303 #else // ENABLE_DISASSEMBLER
285 304
286 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin, 305 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin,
287 byte* end, Code* code) { 306 byte* end, Code* code) {
288 return 0; 307 return 0;
289 } 308 }
290 309
291 #endif // ENABLE_DISASSEMBLER 310 #endif // ENABLE_DISASSEMBLER
292 311
293 } } // namespace v8::internal 312 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698