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

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

Powered by Google App Engine
This is Rietveld 408576698