| OLD | NEW |
| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 static const int kRelocInfoPosition = 57; | 88 static const int kRelocInfoPosition = 57; |
| 89 | 89 |
| 90 static int DecodeIt(Isolate* isolate, | 90 static int DecodeIt(Isolate* isolate, |
| 91 FILE* f, | 91 FILE* f, |
| 92 const V8NameConverter& converter, | 92 const V8NameConverter& converter, |
| 93 byte* begin, | 93 byte* begin, |
| 94 byte* end) { | 94 byte* end) { |
| 95 SealHandleScope shs(isolate); | 95 SealHandleScope shs(isolate); |
| 96 DisallowHeapAllocation no_alloc; | 96 DisallowHeapAllocation no_alloc; |
| 97 ExternalReferenceEncoder ref_encoder(isolate); | 97 ExternalReferenceEncoder ref_encoder(isolate); |
| 98 Heap* heap = isolate->heap(); | |
| 99 | 98 |
| 100 v8::internal::EmbeddedVector<char, 128> decode_buffer; | 99 v8::internal::EmbeddedVector<char, 128> decode_buffer; |
| 101 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; | 100 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; |
| 102 StringBuilder out(out_buffer.start(), out_buffer.length()); | 101 StringBuilder out(out_buffer.start(), out_buffer.length()); |
| 103 byte* pc = begin; | 102 byte* pc = begin; |
| 104 disasm::Disassembler d(converter); | 103 disasm::Disassembler d(converter); |
| 105 RelocIterator* it = NULL; | 104 RelocIterator* it = NULL; |
| 106 if (converter.code() != NULL) { | 105 if (converter.code() != NULL) { |
| 107 it = new RelocIterator(converter.code()); | 106 it = new RelocIterator(converter.code()); |
| 108 } else { | 107 } else { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 out.AddFormatted(" contextual,"); | 218 out.AddFormatted(" contextual,"); |
| 220 } | 219 } |
| 221 InlineCacheState ic_state = code->ic_state(); | 220 InlineCacheState ic_state = code->ic_state(); |
| 222 out.AddFormatted(" %s, %s", Code::Kind2String(kind), | 221 out.AddFormatted(" %s, %s", Code::Kind2String(kind), |
| 223 Code::ICState2String(ic_state)); | 222 Code::ICState2String(ic_state)); |
| 224 if (ic_state == MONOMORPHIC) { | 223 if (ic_state == MONOMORPHIC) { |
| 225 Code::StubType type = code->type(); | 224 Code::StubType type = code->type(); |
| 226 out.AddFormatted(", %s", Code::StubType2String(type)); | 225 out.AddFormatted(", %s", Code::StubType2String(type)); |
| 227 } | 226 } |
| 228 } else if (kind == Code::STUB || kind == Code::HANDLER) { | 227 } else if (kind == Code::STUB || kind == Code::HANDLER) { |
| 229 // Reverse lookup required as the minor key cannot be retrieved | 228 // Get the STUB key and extract major and minor key. |
| 230 // from the code object. | 229 uint32_t key = code->stub_key(); |
| 231 Object* obj = heap->code_stubs()->SlowReverseLookup(code); | 230 uint32_t minor_key = CodeStub::MinorKeyFromKey(key); |
| 232 if (obj != heap->undefined_value()) { | 231 CodeStub::Major major_key = CodeStub::GetMajorKey(code); |
| 233 ASSERT(obj->IsSmi()); | 232 ASSERT(major_key == CodeStub::MajorKeyFromKey(key)); |
| 234 // Get the STUB key and extract major and minor key. | 233 out.AddFormatted(" %s, %s, ", Code::Kind2String(kind), |
| 235 uint32_t key = Smi::cast(obj)->value(); | 234 CodeStub::MajorName(major_key, false)); |
| 236 uint32_t minor_key = CodeStub::MinorKeyFromKey(key); | 235 switch (major_key) { |
| 237 CodeStub::Major major_key = CodeStub::GetMajorKey(code); | 236 case CodeStub::CallFunction: { |
| 238 ASSERT(major_key == CodeStub::MajorKeyFromKey(key)); | 237 int argc = CallFunctionStub::ExtractArgcFromMinorKey(minor_key); |
| 239 out.AddFormatted(" %s, %s, ", | 238 out.AddFormatted("argc = %d", argc); |
| 240 Code::Kind2String(kind), | 239 break; |
| 241 CodeStub::MajorName(major_key, false)); | |
| 242 switch (major_key) { | |
| 243 case CodeStub::CallFunction: { | |
| 244 int argc = | |
| 245 CallFunctionStub::ExtractArgcFromMinorKey(minor_key); | |
| 246 out.AddFormatted("argc = %d", argc); | |
| 247 break; | |
| 248 } | |
| 249 default: | |
| 250 out.AddFormatted("minor: %d", minor_key); | |
| 251 } | 240 } |
| 241 default: |
| 242 out.AddFormatted("minor: %d", minor_key); |
| 252 } | 243 } |
| 253 } else { | 244 } else { |
| 254 out.AddFormatted(" %s", Code::Kind2String(kind)); | 245 out.AddFormatted(" %s", Code::Kind2String(kind)); |
| 255 } | 246 } |
| 256 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { | 247 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { |
| 257 out.AddFormatted(" (id = %d)", static_cast<int>(relocinfo.data())); | 248 out.AddFormatted(" (id = %d)", static_cast<int>(relocinfo.data())); |
| 258 } | 249 } |
| 259 } else if (RelocInfo::IsRuntimeEntry(rmode) && | 250 } else if (RelocInfo::IsRuntimeEntry(rmode) && |
| 260 isolate->deoptimizer_data() != NULL) { | 251 isolate->deoptimizer_data() != NULL) { |
| 261 // A runtime entry reloinfo might be a deoptimization bailout. | 252 // A runtime entry reloinfo might be a deoptimization bailout. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) { | 326 int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) { |
| 336 return 0; | 327 return 0; |
| 337 } | 328 } |
| 338 | 329 |
| 339 | 330 |
| 340 void Disassembler::Decode(FILE* f, Code* code) {} | 331 void Disassembler::Decode(FILE* f, Code* code) {} |
| 341 | 332 |
| 342 #endif // ENABLE_DISASSEMBLER | 333 #endif // ENABLE_DISASSEMBLER |
| 343 | 334 |
| 344 } } // namespace v8::internal | 335 } } // namespace v8::internal |
| OLD | NEW |