| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 debug_info.size_ = size + padding; | 315 debug_info.size_ = size + padding; |
| 316 LogWriteBytes(reinterpret_cast<const char*>(&debug_info), sizeof(debug_info)); | 316 LogWriteBytes(reinterpret_cast<const char*>(&debug_info), sizeof(debug_info)); |
| 317 | 317 |
| 318 Address code_start = code->instruction_start(); | 318 Address code_start = code->instruction_start(); |
| 319 | 319 |
| 320 for (SourcePositionTableIterator iterator(code->source_position_table()); | 320 for (SourcePositionTableIterator iterator(code->source_position_table()); |
| 321 !iterator.done(); iterator.Advance()) { | 321 !iterator.done(); iterator.Advance()) { |
| 322 SourcePositionInfo info(GetSourcePositionInfo(code_handle, function_handle, | 322 SourcePositionInfo info(GetSourcePositionInfo(code_handle, function_handle, |
| 323 iterator.source_position())); | 323 iterator.source_position())); |
| 324 PerfJitDebugEntry entry; | 324 PerfJitDebugEntry entry; |
| 325 // TODO(danno): There seems to be a bug in the dwarf handling of JIT code in | 325 // The entry point of the function will be placed straight after the ELF |
| 326 // the perf tool. It seems to erroneously believe that the first instruction | 326 // header when processed by "perf inject". Adjust the position addresses |
| 327 // of functions is at offset 0x40 when displayed in "perf report". To | 327 // accordingly. |
| 328 // compensate for this, add a magic constant to the position addresses when | 328 entry.address_ = reinterpret_cast<intptr_t>( |
| 329 // writing them out. | 329 code_start + iterator.code_offset() + kElfHeaderSize); |
| 330 entry.address_ = | |
| 331 reinterpret_cast<intptr_t>(code_start + iterator.code_offset() + 0x40); | |
| 332 entry.line_number_ = info.line + 1; | 330 entry.line_number_ = info.line + 1; |
| 333 entry.column_ = info.column + 1; | 331 entry.column_ = info.column + 1; |
| 334 LogWriteBytes(reinterpret_cast<const char*>(&entry), sizeof(entry)); | 332 LogWriteBytes(reinterpret_cast<const char*>(&entry), sizeof(entry)); |
| 335 Handle<Script> script(Script::cast(info.function->script())); | 333 Handle<Script> script(Script::cast(info.function->script())); |
| 336 std::unique_ptr<char[]> name_string = GetScriptName(script); | 334 std::unique_ptr<char[]> name_string = GetScriptName(script); |
| 337 LogWriteBytes(name_string.get(), | 335 LogWriteBytes(name_string.get(), |
| 338 static_cast<uint32_t>(strlen(name_string.get())) + 1); | 336 static_cast<uint32_t>(strlen(name_string.get())) + 1); |
| 339 } | 337 } |
| 340 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; | 338 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; |
| 341 LogWriteBytes(padding_bytes, padding); | 339 LogWriteBytes(padding_bytes, padding); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 header.time_stamp_ = | 398 header.time_stamp_ = |
| 401 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); | 399 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); |
| 402 header.flags_ = 0; | 400 header.flags_ = 0; |
| 403 | 401 |
| 404 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); | 402 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); |
| 405 } | 403 } |
| 406 | 404 |
| 407 #endif // V8_OS_LINUX | 405 #endif // V8_OS_LINUX |
| 408 } // namespace internal | 406 } // namespace internal |
| 409 } // namespace v8 | 407 } // namespace v8 |
| OLD | NEW |