Ben Murdoch | 086aeea | 2011-05-13 15:57:08 +0100 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 4 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 5 | #include "src/v8.h" |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 6 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 7 | #include "src/code-stubs.h" |
| 8 | #include "src/codegen.h" |
| 9 | #include "src/debug.h" |
| 10 | #include "src/deoptimizer.h" |
| 11 | #include "src/disasm.h" |
| 12 | #include "src/disassembler.h" |
| 13 | #include "src/macro-assembler.h" |
| 14 | #include "src/serialize.h" |
| 15 | #include "src/string-stream.h" |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 16 | |
| 17 | namespace v8 { |
| 18 | namespace internal { |
| 19 | |
| 20 | #ifdef ENABLE_DISASSEMBLER |
| 21 | |
| 22 | void Disassembler::Dump(FILE* f, byte* begin, byte* end) { |
| 23 | for (byte* pc = begin; pc < end; pc++) { |
| 24 | if (f == NULL) { |
Ben Murdoch | f87a203 | 2010-10-22 12:50:53 +0100 | [diff] [blame] | 25 | PrintF("%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n", |
| 26 | reinterpret_cast<intptr_t>(pc), |
| 27 | pc - begin, |
| 28 | *pc); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 29 | } else { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 30 | PrintF(f, "%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n", |
| 31 | reinterpret_cast<uintptr_t>(pc), pc - begin, *pc); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | |
| 37 | class V8NameConverter: public disasm::NameConverter { |
| 38 | public: |
| 39 | explicit V8NameConverter(Code* code) : code_(code) {} |
| 40 | virtual const char* NameOfAddress(byte* pc) const; |
| 41 | virtual const char* NameInCode(byte* addr) const; |
| 42 | Code* code() const { return code_; } |
| 43 | private: |
| 44 | Code* code_; |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 45 | |
| 46 | EmbeddedVector<char, 128> v8_buffer_; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | |
| 50 | const char* V8NameConverter::NameOfAddress(byte* pc) const { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 51 | const char* name = code_->GetIsolate()->builtins()->Lookup(pc); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 52 | if (name != NULL) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 53 | SNPrintF(v8_buffer_, "%s (%p)", name, pc); |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 54 | return v8_buffer_.start(); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | if (code_ != NULL) { |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 58 | int offs = static_cast<int>(pc - code_->instruction_start()); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 59 | // print as code offset, if it seems reasonable |
| 60 | if (0 <= offs && offs < code_->instruction_size()) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 61 | SNPrintF(v8_buffer_, "%d (%p)", offs, pc); |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 62 | return v8_buffer_.start(); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 63 | } |
| 64 | } |
| 65 | |
| 66 | return disasm::NameConverter::NameOfAddress(pc); |
| 67 | } |
| 68 | |
| 69 | |
| 70 | const char* V8NameConverter::NameInCode(byte* addr) const { |
| 71 | // The V8NameConverter is used for well known code, so we can "safely" |
| 72 | // dereference pointers in generated code. |
| 73 | return (code_ != NULL) ? reinterpret_cast<const char*>(addr) : ""; |
| 74 | } |
| 75 | |
| 76 | |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame] | 77 | static void DumpBuffer(FILE* f, StringBuilder* out) { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 78 | if (f == NULL) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame] | 79 | PrintF("%s\n", out->Finalize()); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 80 | } else { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 81 | PrintF(f, "%s\n", out->Finalize()); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 82 | } |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame] | 83 | out->Reset(); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 84 | } |
| 85 | |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame] | 86 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 87 | static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength; |
| 88 | static const int kRelocInfoPosition = 57; |
| 89 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 90 | static int DecodeIt(Isolate* isolate, |
| 91 | FILE* f, |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 92 | const V8NameConverter& converter, |
| 93 | byte* begin, |
| 94 | byte* end) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 95 | SealHandleScope shs(isolate); |
| 96 | DisallowHeapAllocation no_alloc; |
| 97 | ExternalReferenceEncoder ref_encoder(isolate); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 98 | |
| 99 | v8::internal::EmbeddedVector<char, 128> decode_buffer; |
| 100 | v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame] | 101 | StringBuilder out(out_buffer.start(), out_buffer.length()); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 102 | byte* pc = begin; |
| 103 | disasm::Disassembler d(converter); |
| 104 | RelocIterator* it = NULL; |
| 105 | if (converter.code() != NULL) { |
| 106 | it = new RelocIterator(converter.code()); |
| 107 | } else { |
| 108 | // No relocation information when printing code stubs. |
| 109 | } |
| 110 | int constants = -1; // no constants being decoded at the start |
| 111 | |
| 112 | while (pc < end) { |
| 113 | // First decode instruction so that we know its length. |
| 114 | byte* prev_pc = pc; |
| 115 | if (constants > 0) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 116 | SNPrintF(decode_buffer, |
| 117 | "%08x constant", |
| 118 | *reinterpret_cast<int32_t*>(pc)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 119 | constants--; |
| 120 | pc += 4; |
| 121 | } else { |
| 122 | int num_const = d.ConstantPoolSizeAt(pc); |
| 123 | if (num_const >= 0) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 124 | SNPrintF(decode_buffer, |
| 125 | "%08x constant pool begin", |
| 126 | *reinterpret_cast<int32_t*>(pc)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 127 | constants = num_const; |
| 128 | pc += 4; |
| 129 | } else if (it != NULL && !it->done() && it->rinfo()->pc() == pc && |
| 130 | it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE) { |
| 131 | // raw pointer embedded in code stream, e.g., jump table |
| 132 | byte* ptr = *reinterpret_cast<byte**>(pc); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 133 | SNPrintF(decode_buffer, |
| 134 | "%08" V8PRIxPTR " jump table entry %4" V8PRIdPTR, |
| 135 | reinterpret_cast<intptr_t>(ptr), |
| 136 | ptr - begin); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 137 | pc += 4; |
| 138 | } else { |
| 139 | decode_buffer[0] = '\0'; |
| 140 | pc += d.InstructionDecode(decode_buffer, pc); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | // Collect RelocInfo for this instruction (prev_pc .. pc-1) |
| 145 | List<const char*> comments(4); |
| 146 | List<byte*> pcs(1); |
| 147 | List<RelocInfo::Mode> rmodes(1); |
| 148 | List<intptr_t> datas(1); |
| 149 | if (it != NULL) { |
| 150 | while (!it->done() && it->rinfo()->pc() < pc) { |
| 151 | if (RelocInfo::IsComment(it->rinfo()->rmode())) { |
| 152 | // For comments just collect the text. |
| 153 | comments.Add(reinterpret_cast<const char*>(it->rinfo()->data())); |
| 154 | } else { |
| 155 | // For other reloc info collect all data. |
| 156 | pcs.Add(it->rinfo()->pc()); |
| 157 | rmodes.Add(it->rinfo()->rmode()); |
| 158 | datas.Add(it->rinfo()->data()); |
| 159 | } |
| 160 | it->next(); |
| 161 | } |
| 162 | } |
| 163 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 164 | // Comments. |
| 165 | for (int i = 0; i < comments.length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame] | 166 | out.AddFormatted(" %s", comments[i]); |
| 167 | DumpBuffer(f, &out); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 168 | } |
| 169 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 170 | // Instruction address and instruction offset. |
| 171 | out.AddFormatted("%p %4d ", prev_pc, prev_pc - begin); |
| 172 | |
| 173 | // Instruction. |
| 174 | out.AddFormatted("%s", decode_buffer.start()); |
| 175 | |
| 176 | // Print all the reloc info for this instruction which are not comments. |
| 177 | for (int i = 0; i < pcs.length(); i++) { |
| 178 | // Put together the reloc info |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 179 | RelocInfo relocinfo(pcs[i], rmodes[i], datas[i], converter.code()); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 180 | |
| 181 | // Indent the printing of the reloc info. |
| 182 | if (i == 0) { |
| 183 | // The first reloc info is printed after the disassembled instruction. |
| 184 | out.AddPadding(' ', kRelocInfoPosition - out.position()); |
| 185 | } else { |
| 186 | // Additional reloc infos are printed on separate lines. |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame] | 187 | DumpBuffer(f, &out); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 188 | out.AddPadding(' ', kRelocInfoPosition); |
| 189 | } |
| 190 | |
| 191 | RelocInfo::Mode rmode = relocinfo.rmode(); |
| 192 | if (RelocInfo::IsPosition(rmode)) { |
| 193 | if (RelocInfo::IsStatementPosition(rmode)) { |
| 194 | out.AddFormatted(" ;; debug: statement %d", relocinfo.data()); |
| 195 | } else { |
| 196 | out.AddFormatted(" ;; debug: position %d", relocinfo.data()); |
| 197 | } |
| 198 | } else if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
| 199 | HeapStringAllocator allocator; |
| 200 | StringStream accumulator(&allocator); |
| 201 | relocinfo.target_object()->ShortPrint(&accumulator); |
Ben Murdoch | 589d697 | 2011-11-30 16:04:58 +0000 | [diff] [blame] | 202 | SmartArrayPointer<const char> obj_name = accumulator.ToCString(); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 203 | out.AddFormatted(" ;; object: %s", obj_name.get()); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 204 | } else if (rmode == RelocInfo::EXTERNAL_REFERENCE) { |
| 205 | const char* reference_name = |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 206 | ref_encoder.NameOfAddress(relocinfo.target_reference()); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 207 | out.AddFormatted(" ;; external reference (%s)", reference_name); |
| 208 | } else if (RelocInfo::IsCodeTarget(rmode)) { |
| 209 | out.AddFormatted(" ;; code:"); |
| 210 | if (rmode == RelocInfo::CONSTRUCT_CALL) { |
| 211 | out.AddFormatted(" constructor,"); |
| 212 | } |
| 213 | Code* code = Code::GetCodeFromTargetAddress(relocinfo.target_address()); |
| 214 | Code::Kind kind = code->kind(); |
| 215 | if (code->is_inline_cache_stub()) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 216 | if (kind == Code::LOAD_IC && |
| 217 | LoadICState::GetContextualMode(code->extra_ic_state()) == |
| 218 | CONTEXTUAL) { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 219 | out.AddFormatted(" contextual,"); |
| 220 | } |
| 221 | InlineCacheState ic_state = code->ic_state(); |
| 222 | out.AddFormatted(" %s, %s", Code::Kind2String(kind), |
| 223 | Code::ICState2String(ic_state)); |
| 224 | if (ic_state == MONOMORPHIC) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 225 | Code::StubType type = code->type(); |
| 226 | out.AddFormatted(", %s", Code::StubType2String(type)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 227 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 228 | } else if (kind == Code::STUB || kind == Code::HANDLER) { |
| 229 | // Get the STUB key and extract major and minor key. |
| 230 | uint32_t key = code->stub_key(); |
| 231 | uint32_t minor_key = CodeStub::MinorKeyFromKey(key); |
| 232 | CodeStub::Major major_key = CodeStub::GetMajorKey(code); |
| 233 | DCHECK(major_key == CodeStub::MajorKeyFromKey(key)); |
| 234 | out.AddFormatted(" %s, %s, ", Code::Kind2String(kind), |
| 235 | CodeStub::MajorName(major_key, false)); |
| 236 | switch (major_key) { |
| 237 | case CodeStub::CallFunction: { |
| 238 | int argc = CallFunctionStub::ExtractArgcFromMinorKey(minor_key); |
| 239 | out.AddFormatted("argc = %d", argc); |
| 240 | break; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 241 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 242 | default: |
| 243 | out.AddFormatted("minor: %d", minor_key); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 244 | } |
| 245 | } else { |
| 246 | out.AddFormatted(" %s", Code::Kind2String(kind)); |
| 247 | } |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 248 | if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { |
| 249 | out.AddFormatted(" (id = %d)", static_cast<int>(relocinfo.data())); |
| 250 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 251 | } else if (RelocInfo::IsRuntimeEntry(rmode) && |
| 252 | isolate->deoptimizer_data() != NULL) { |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 253 | // A runtime entry reloinfo might be a deoptimization bailout. |
| 254 | Address addr = relocinfo.target_address(); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 255 | int id = Deoptimizer::GetDeoptimizationId(isolate, |
| 256 | addr, |
| 257 | Deoptimizer::EAGER); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 258 | if (id == Deoptimizer::kNotDeoptimizationEntry) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 259 | id = Deoptimizer::GetDeoptimizationId(isolate, |
| 260 | addr, |
| 261 | Deoptimizer::LAZY); |
| 262 | if (id == Deoptimizer::kNotDeoptimizationEntry) { |
| 263 | id = Deoptimizer::GetDeoptimizationId(isolate, |
| 264 | addr, |
| 265 | Deoptimizer::SOFT); |
| 266 | if (id == Deoptimizer::kNotDeoptimizationEntry) { |
| 267 | out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); |
| 268 | } else { |
| 269 | out.AddFormatted(" ;; soft deoptimization bailout %d", id); |
| 270 | } |
| 271 | } else { |
| 272 | out.AddFormatted(" ;; lazy deoptimization bailout %d", id); |
| 273 | } |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 274 | } else { |
| 275 | out.AddFormatted(" ;; deoptimization bailout %d", id); |
| 276 | } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 277 | } else { |
| 278 | out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); |
| 279 | } |
| 280 | } |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame] | 281 | DumpBuffer(f, &out); |
| 282 | } |
| 283 | |
| 284 | // Emit comments following the last instruction (if any). |
| 285 | if (it != NULL) { |
| 286 | for ( ; !it->done(); it->next()) { |
| 287 | if (RelocInfo::IsComment(it->rinfo()->rmode())) { |
| 288 | out.AddFormatted(" %s", |
| 289 | reinterpret_cast<const char*>(it->rinfo()->data())); |
| 290 | DumpBuffer(f, &out); |
| 291 | } |
| 292 | } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | delete it; |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 296 | return static_cast<int>(pc - begin); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 300 | int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 301 | V8NameConverter defaultConverter(NULL); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 302 | return DecodeIt(isolate, f, defaultConverter, begin, end); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | |
| 306 | // Called by Code::CodePrint. |
| 307 | void Disassembler::Decode(FILE* f, Code* code) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 308 | Isolate* isolate = code->GetIsolate(); |
| 309 | int decode_size = code->is_crankshafted() |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 310 | ? static_cast<int>(code->safepoint_table_offset()) |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 311 | : code->instruction_size(); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 312 | // If there might be a back edge table, stop before reaching it. |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 313 | if (code->kind() == Code::FUNCTION) { |
| 314 | decode_size = |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 315 | Min(decode_size, static_cast<int>(code->back_edge_table_offset())); |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | byte* begin = code->instruction_start(); |
| 319 | byte* end = begin + decode_size; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 320 | V8NameConverter v8NameConverter(code); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 321 | DecodeIt(isolate, f, v8NameConverter, begin, end); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | #else // ENABLE_DISASSEMBLER |
| 325 | |
| 326 | void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 327 | int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) { |
| 328 | return 0; |
| 329 | } |
| 330 | |
| 331 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 332 | void Disassembler::Decode(FILE* f, Code* code) {} |
| 333 | |
| 334 | #endif // ENABLE_DISASSEMBLER |
| 335 | |
| 336 | } } // namespace v8::internal |