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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 entry.line_number_ = line_number; | 317 entry.line_number_ = line_number; |
318 entry.column_ = column_offset; | 318 entry.column_ = column_offset; |
319 LogWriteBytes(reinterpret_cast<const char*>(&entry), sizeof(entry)); | 319 LogWriteBytes(reinterpret_cast<const char*>(&entry), sizeof(entry)); |
320 LogWriteBytes(name_string.get(), name_length + 1); | 320 LogWriteBytes(name_string.get(), name_length + 1); |
321 } | 321 } |
322 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; | 322 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; |
323 LogWriteBytes(padding_bytes, padding); | 323 LogWriteBytes(padding_bytes, padding); |
324 } | 324 } |
325 | 325 |
326 void PerfJitLogger::LogWriteUnwindingInfo(Code* code) { | 326 void PerfJitLogger::LogWriteUnwindingInfo(Code* code) { |
| 327 EhFrameHdr eh_frame_hdr(code); |
| 328 |
327 PerfJitCodeUnwindingInfo unwinding_info_header; | 329 PerfJitCodeUnwindingInfo unwinding_info_header; |
328 unwinding_info_header.event_ = PerfJitCodeLoad::kUnwindingInfo; | 330 unwinding_info_header.event_ = PerfJitCodeLoad::kUnwindingInfo; |
329 unwinding_info_header.time_stamp_ = GetTimestamp(); | 331 unwinding_info_header.time_stamp_ = GetTimestamp(); |
330 unwinding_info_header.eh_frame_hdr_size_ = EhFrameConstants::kEhFrameHdrSize; | 332 unwinding_info_header.eh_frame_hdr_size_ = EhFrameHdr::kRecordSize; |
331 | 333 |
332 if (code->has_unwinding_info()) { | 334 if (code->has_unwinding_info()) { |
333 unwinding_info_header.unwinding_size_ = code->unwinding_info_size(); | 335 unwinding_info_header.unwinding_size_ = code->unwinding_info_size(); |
334 unwinding_info_header.mapped_size_ = unwinding_info_header.unwinding_size_; | 336 unwinding_info_header.mapped_size_ = unwinding_info_header.unwinding_size_; |
335 } else { | 337 } else { |
336 unwinding_info_header.unwinding_size_ = EhFrameConstants::kEhFrameHdrSize; | 338 unwinding_info_header.unwinding_size_ = EhFrameHdr::kRecordSize; |
337 unwinding_info_header.mapped_size_ = 0; | 339 unwinding_info_header.mapped_size_ = 0; |
338 } | 340 } |
339 | 341 |
340 int content_size = static_cast<int>(sizeof(unwinding_info_header) + | 342 int content_size = static_cast<int>(sizeof(unwinding_info_header) + |
341 unwinding_info_header.unwinding_size_); | 343 unwinding_info_header.unwinding_size_); |
342 int padding_size = RoundUp(content_size, 8) - content_size; | 344 int padding_size = RoundUp(content_size, 8) - content_size; |
343 unwinding_info_header.size_ = content_size + padding_size; | 345 unwinding_info_header.size_ = content_size + padding_size; |
344 | 346 |
345 LogWriteBytes(reinterpret_cast<const char*>(&unwinding_info_header), | 347 LogWriteBytes(reinterpret_cast<const char*>(&unwinding_info_header), |
346 sizeof(unwinding_info_header)); | 348 sizeof(unwinding_info_header)); |
347 | 349 |
348 if (code->has_unwinding_info()) { | 350 if (code->has_unwinding_info()) { |
| 351 // The last EhFrameHdr::kRecordSize bytes were a placeholder for the header. |
| 352 // Discard them and write the actual eh_frame_hdr (below). |
| 353 DCHECK_GE(code->unwinding_info_size(), EhFrameHdr::kRecordSize); |
349 LogWriteBytes(reinterpret_cast<const char*>(code->unwinding_info_start()), | 354 LogWriteBytes(reinterpret_cast<const char*>(code->unwinding_info_start()), |
350 code->unwinding_info_size()); | 355 code->unwinding_info_size() - EhFrameHdr::kRecordSize); |
351 } else { | |
352 OFStream perf_output_stream(perf_output_handle_); | |
353 EhFrameWriter::WriteEmptyEhFrame(perf_output_stream); | |
354 } | 356 } |
355 | 357 |
| 358 LogWriteBytes(reinterpret_cast<const char*>(&eh_frame_hdr), |
| 359 EhFrameHdr::kRecordSize); |
| 360 |
356 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; | 361 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; |
357 DCHECK_LT(padding_size, sizeof(padding_bytes)); | 362 DCHECK_LT(padding_size, sizeof(padding_bytes)); |
358 LogWriteBytes(padding_bytes, padding_size); | 363 LogWriteBytes(padding_bytes, padding_size); |
359 } | 364 } |
360 | 365 |
361 void PerfJitLogger::CodeMoveEvent(AbstractCode* from, Address to) { | 366 void PerfJitLogger::CodeMoveEvent(AbstractCode* from, Address to) { |
362 // Code relocation not supported. | 367 // Code relocation not supported. |
363 UNREACHABLE(); | 368 UNREACHABLE(); |
364 } | 369 } |
365 | 370 |
(...skipping 16 matching lines...) Expand all Loading... |
382 header.time_stamp_ = | 387 header.time_stamp_ = |
383 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); | 388 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); |
384 header.flags_ = 0; | 389 header.flags_ = 0; |
385 | 390 |
386 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); | 391 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); |
387 } | 392 } |
388 | 393 |
389 #endif // V8_OS_LINUX | 394 #endif // V8_OS_LINUX |
390 } // namespace internal | 395 } // namespace internal |
391 } // namespace v8 | 396 } // namespace v8 |
OLD | NEW |