| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "code-stubs.h" | 30 #include "code-stubs.h" |
| 31 #include "codegen-inl.h" | 31 #include "codegen-inl.h" |
| 32 #include "debug.h" | 32 #include "debug.h" |
| 33 #include "deoptimizer.h" |
| 33 #include "disasm.h" | 34 #include "disasm.h" |
| 34 #include "disassembler.h" | 35 #include "disassembler.h" |
| 35 #include "macro-assembler.h" | 36 #include "macro-assembler.h" |
| 36 #include "serialize.h" | 37 #include "serialize.h" |
| 37 #include "string-stream.h" | 38 #include "string-stream.h" |
| 38 | 39 |
| 39 namespace v8 { | 40 namespace v8 { |
| 40 namespace internal { | 41 namespace internal { |
| 41 | 42 |
| 42 #ifdef ENABLE_DISASSEMBLER | 43 #ifdef ENABLE_DISASSEMBLER |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 case CodeStub::CallFunction: | 272 case CodeStub::CallFunction: |
| 272 out.AddFormatted("argc = %d", minor_key); | 273 out.AddFormatted("argc = %d", minor_key); |
| 273 break; | 274 break; |
| 274 default: | 275 default: |
| 275 out.AddFormatted("minor: %d", minor_key); | 276 out.AddFormatted("minor: %d", minor_key); |
| 276 } | 277 } |
| 277 } | 278 } |
| 278 } else { | 279 } else { |
| 279 out.AddFormatted(" %s", Code::Kind2String(kind)); | 280 out.AddFormatted(" %s", Code::Kind2String(kind)); |
| 280 } | 281 } |
| 282 } else if (rmode == RelocInfo::RUNTIME_ENTRY) { |
| 283 // A runtime entry reloinfo might be a deoptimization bailout. |
| 284 Address addr = relocinfo.target_address(); |
| 285 int id = Deoptimizer::GetDeoptimizationId(addr, Deoptimizer::EAGER); |
| 286 if (id == Deoptimizer::kNotDeoptimizationEntry) { |
| 287 out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); |
| 288 } else { |
| 289 out.AddFormatted(" ;; deoptimization bailout %d", id); |
| 290 } |
| 281 } else { | 291 } else { |
| 282 out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); | 292 out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); |
| 283 } | 293 } |
| 284 } | 294 } |
| 285 out.AddString("\n"); | 295 out.AddString("\n"); |
| 286 DumpBuffer(f, out.Finalize()); | 296 DumpBuffer(f, out.Finalize()); |
| 287 out.Reset(); | 297 out.Reset(); |
| 288 } | 298 } |
| 289 | 299 |
| 290 delete it; | 300 delete it; |
| 291 return static_cast<int>(pc - begin); | 301 return static_cast<int>(pc - begin); |
| 292 } | 302 } |
| 293 | 303 |
| 294 | 304 |
| 295 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { | 305 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { |
| 296 V8NameConverter defaultConverter(NULL); | 306 V8NameConverter defaultConverter(NULL); |
| 297 return DecodeIt(f, defaultConverter, begin, end); | 307 return DecodeIt(f, defaultConverter, begin, end); |
| 298 } | 308 } |
| 299 | 309 |
| 300 | 310 |
| 301 // Called by Code::CodePrint. | 311 // Called by Code::CodePrint. |
| 302 void Disassembler::Decode(FILE* f, Code* code) { | 312 void Disassembler::Decode(FILE* f, Code* code) { |
| 303 byte* begin = Code::cast(code)->instruction_start(); | 313 int decode_size = (code->kind() == Code::OPTIMIZED_FUNCTION) |
| 304 byte* end = begin + Code::cast(code)->instruction_size(); | 314 ? static_cast<int>(code->safepoint_table_start()) |
| 315 : code->instruction_size(); |
| 316 // If there might be a stack check table, stop before reaching it. |
| 317 if (code->kind() == Code::FUNCTION) { |
| 318 decode_size = |
| 319 Min(decode_size, static_cast<int>(code->stack_check_table_start())); |
| 320 } |
| 321 |
| 322 byte* begin = code->instruction_start(); |
| 323 byte* end = begin + decode_size; |
| 305 V8NameConverter v8NameConverter(code); | 324 V8NameConverter v8NameConverter(code); |
| 306 DecodeIt(f, v8NameConverter, begin, end); | 325 DecodeIt(f, v8NameConverter, begin, end); |
| 307 } | 326 } |
| 308 | 327 |
| 309 #else // ENABLE_DISASSEMBLER | 328 #else // ENABLE_DISASSEMBLER |
| 310 | 329 |
| 311 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} | 330 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} |
| 312 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; } | 331 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; } |
| 313 void Disassembler::Decode(FILE* f, Code* code) {} | 332 void Disassembler::Decode(FILE* f, Code* code) {} |
| 314 | 333 |
| 315 #endif // ENABLE_DISASSEMBLER | 334 #endif // ENABLE_DISASSEMBLER |
| 316 | 335 |
| 317 } } // namespace v8::internal | 336 } } // namespace v8::internal |
| OLD | NEW |