Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: src/perf-jit.cc

Issue 2023503002: Reland Implement .eh_frame writer and disassembler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@eh-frame-base
Patch Set: Rebase on master. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | src/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
329 PerfJitCodeUnwindingInfo unwinding_info_header; 327 PerfJitCodeUnwindingInfo unwinding_info_header;
330 unwinding_info_header.event_ = PerfJitCodeLoad::kUnwindingInfo; 328 unwinding_info_header.event_ = PerfJitCodeLoad::kUnwindingInfo;
331 unwinding_info_header.time_stamp_ = GetTimestamp(); 329 unwinding_info_header.time_stamp_ = GetTimestamp();
332 unwinding_info_header.eh_frame_hdr_size_ = EhFrameHdr::kRecordSize; 330 unwinding_info_header.eh_frame_hdr_size_ = EhFrameConstants::kEhFrameHdrSize;
333 331
334 if (code->has_unwinding_info()) { 332 if (code->has_unwinding_info()) {
335 unwinding_info_header.unwinding_size_ = code->unwinding_info_size(); 333 unwinding_info_header.unwinding_size_ = code->unwinding_info_size();
336 unwinding_info_header.mapped_size_ = unwinding_info_header.unwinding_size_; 334 unwinding_info_header.mapped_size_ = unwinding_info_header.unwinding_size_;
337 } else { 335 } else {
338 unwinding_info_header.unwinding_size_ = EhFrameHdr::kRecordSize; 336 unwinding_info_header.unwinding_size_ = EhFrameConstants::kEhFrameHdrSize;
339 unwinding_info_header.mapped_size_ = 0; 337 unwinding_info_header.mapped_size_ = 0;
340 } 338 }
341 339
342 int content_size = static_cast<int>(sizeof(unwinding_info_header) + 340 int content_size = static_cast<int>(sizeof(unwinding_info_header) +
343 unwinding_info_header.unwinding_size_); 341 unwinding_info_header.unwinding_size_);
344 int padding_size = RoundUp(content_size, 8) - content_size; 342 int padding_size = RoundUp(content_size, 8) - content_size;
345 unwinding_info_header.size_ = content_size + padding_size; 343 unwinding_info_header.size_ = content_size + padding_size;
346 344
347 LogWriteBytes(reinterpret_cast<const char*>(&unwinding_info_header), 345 LogWriteBytes(reinterpret_cast<const char*>(&unwinding_info_header),
348 sizeof(unwinding_info_header)); 346 sizeof(unwinding_info_header));
349 347
350 if (code->has_unwinding_info()) { 348 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);
354 LogWriteBytes(reinterpret_cast<const char*>(code->unwinding_info_start()), 349 LogWriteBytes(reinterpret_cast<const char*>(code->unwinding_info_start()),
355 code->unwinding_info_size() - EhFrameHdr::kRecordSize); 350 code->unwinding_info_size());
351 } else {
352 OFStream perf_output_stream(perf_output_handle_);
353 EhFrameWriter::WriteEmptyEhFrame(perf_output_stream);
356 } 354 }
357 355
358 LogWriteBytes(reinterpret_cast<const char*>(&eh_frame_hdr),
359 EhFrameHdr::kRecordSize);
360
361 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; 356 char padding_bytes[] = "\0\0\0\0\0\0\0\0";
362 DCHECK_LT(padding_size, sizeof(padding_bytes)); 357 DCHECK_LT(padding_size, sizeof(padding_bytes));
363 LogWriteBytes(padding_bytes, padding_size); 358 LogWriteBytes(padding_bytes, padding_size);
364 } 359 }
365 360
366 void PerfJitLogger::CodeMoveEvent(AbstractCode* from, Address to) { 361 void PerfJitLogger::CodeMoveEvent(AbstractCode* from, Address to) {
367 // Code relocation not supported. 362 // Code relocation not supported.
368 UNREACHABLE(); 363 UNREACHABLE();
369 } 364 }
370 365
(...skipping 16 matching lines...) Expand all
387 header.time_stamp_ = 382 header.time_stamp_ =
388 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); 383 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0);
389 header.flags_ = 0; 384 header.flags_ = 0;
390 385
391 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); 386 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header));
392 } 387 }
393 388
394 #endif // V8_OS_LINUX 389 #endif // V8_OS_LINUX
395 } // namespace internal 390 } // namespace internal
396 } // namespace v8 391 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698