| OLD | NEW |
| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength; | 104 static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength; |
| 105 static const int kRelocInfoPosition = 57; | 105 static const int kRelocInfoPosition = 57; |
| 106 | 106 |
| 107 static int DecodeIt(FILE* f, | 107 static int DecodeIt(FILE* f, |
| 108 const V8NameConverter& converter, | 108 const V8NameConverter& converter, |
| 109 byte* begin, | 109 byte* begin, |
| 110 byte* end) { | 110 byte* end) { |
| 111 NoHandleAllocation ha; | 111 NoHandleAllocation ha; |
| 112 AssertNoAllocation no_alloc; | 112 AssertNoAllocation no_alloc; |
| 113 ExternalReferenceEncoder ref_encoder; | 113 ExternalReferenceEncoder ref_encoder; |
| 114 Heap* heap = HEAP; |
| 114 | 115 |
| 115 v8::internal::EmbeddedVector<char, 128> decode_buffer; | 116 v8::internal::EmbeddedVector<char, 128> decode_buffer; |
| 116 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; | 117 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; |
| 117 byte* pc = begin; | 118 byte* pc = begin; |
| 118 disasm::Disassembler d(converter); | 119 disasm::Disassembler d(converter); |
| 119 RelocIterator* it = NULL; | 120 RelocIterator* it = NULL; |
| 120 if (converter.code() != NULL) { | 121 if (converter.code() != NULL) { |
| 121 it = new RelocIterator(converter.code()); | 122 it = new RelocIterator(converter.code()); |
| 122 } else { | 123 } else { |
| 123 // No relocation information when printing code stubs. | 124 // No relocation information when printing code stubs. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 246 } |
| 246 if (code->ic_in_loop() == IN_LOOP) { | 247 if (code->ic_in_loop() == IN_LOOP) { |
| 247 out.AddFormatted(", in_loop"); | 248 out.AddFormatted(", in_loop"); |
| 248 } | 249 } |
| 249 if (kind == Code::CALL_IC || kind == Code::KEYED_CALL_IC) { | 250 if (kind == Code::CALL_IC || kind == Code::KEYED_CALL_IC) { |
| 250 out.AddFormatted(", argc = %d", code->arguments_count()); | 251 out.AddFormatted(", argc = %d", code->arguments_count()); |
| 251 } | 252 } |
| 252 } else if (kind == Code::STUB) { | 253 } else if (kind == Code::STUB) { |
| 253 // Reverse lookup required as the minor key cannot be retrieved | 254 // Reverse lookup required as the minor key cannot be retrieved |
| 254 // from the code object. | 255 // from the code object. |
| 255 Object* obj = HEAP->code_stubs()->SlowReverseLookup(code); | 256 Object* obj = heap->code_stubs()->SlowReverseLookup(code); |
| 256 if (obj != HEAP->undefined_value()) { | 257 if (obj != heap->undefined_value()) { |
| 257 ASSERT(obj->IsSmi()); | 258 ASSERT(obj->IsSmi()); |
| 258 // Get the STUB key and extract major and minor key. | 259 // Get the STUB key and extract major and minor key. |
| 259 uint32_t key = Smi::cast(obj)->value(); | 260 uint32_t key = Smi::cast(obj)->value(); |
| 260 uint32_t minor_key = CodeStub::MinorKeyFromKey(key); | 261 uint32_t minor_key = CodeStub::MinorKeyFromKey(key); |
| 261 ASSERT(code->major_key() == CodeStub::MajorKeyFromKey(key)); | 262 ASSERT(code->major_key() == CodeStub::MajorKeyFromKey(key)); |
| 262 out.AddFormatted(" %s, %s, ", | 263 out.AddFormatted(" %s, %s, ", |
| 263 Code::Kind2String(kind), | 264 Code::Kind2String(kind), |
| 264 CodeStub::MajorName(code->major_key(), false)); | 265 CodeStub::MajorName(code->major_key(), false)); |
| 265 switch (code->major_key()) { | 266 switch (code->major_key()) { |
| 266 case CodeStub::CallFunction: | 267 case CodeStub::CallFunction: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 304 |
| 304 #else // ENABLE_DISASSEMBLER | 305 #else // ENABLE_DISASSEMBLER |
| 305 | 306 |
| 306 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} | 307 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} |
| 307 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; } | 308 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; } |
| 308 void Disassembler::Decode(FILE* f, Code* code) {} | 309 void Disassembler::Decode(FILE* f, Code* code) {} |
| 309 | 310 |
| 310 #endif // ENABLE_DISASSEMBLER | 311 #endif // ENABLE_DISASSEMBLER |
| 311 | 312 |
| 312 } } // namespace v8::internal | 313 } } // namespace v8::internal |
| OLD | NEW |