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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 ->ToCString(DISALLOW_NULLS, FAST_STRING_TRAVERSAL, &name_length); | 265 ->ToCString(DISALLOW_NULLS, FAST_STRING_TRAVERSAL, &name_length); |
266 DCHECK_EQ(0, name_string.get()[name_length]); | 266 DCHECK_EQ(0, name_string.get()[name_length]); |
267 } else { | 267 } else { |
268 const char unknown[] = "<unknown>"; | 268 const char unknown[] = "<unknown>"; |
269 name_length = static_cast<int>(strlen(unknown)); | 269 name_length = static_cast<int>(strlen(unknown)); |
270 char* buffer = NewArray<char>(name_length); | 270 char* buffer = NewArray<char>(name_length); |
271 base::OS::StrNCpy(buffer, name_length + 1, unknown, | 271 base::OS::StrNCpy(buffer, name_length + 1, unknown, |
272 static_cast<size_t>(name_length)); | 272 static_cast<size_t>(name_length)); |
273 name_string = std::unique_ptr<char[]>(buffer); | 273 name_string = std::unique_ptr<char[]>(buffer); |
274 } | 274 } |
275 DCHECK_EQ(name_length, strlen(name_string.get())); | 275 DCHECK_EQ(name_length, static_cast<int>(strlen(name_string.get()))); |
276 | 276 |
277 PerfJitCodeDebugInfo debug_info; | 277 PerfJitCodeDebugInfo debug_info; |
278 | 278 |
279 debug_info.event_ = PerfJitCodeLoad::kDebugInfo; | 279 debug_info.event_ = PerfJitCodeLoad::kDebugInfo; |
280 debug_info.time_stamp_ = GetTimestamp(); | 280 debug_info.time_stamp_ = GetTimestamp(); |
281 debug_info.address_ = reinterpret_cast<uint64_t>(code->instruction_start()); | 281 debug_info.address_ = reinterpret_cast<uint64_t>(code->instruction_start()); |
282 debug_info.entry_count_ = entry_count; | 282 debug_info.entry_count_ = entry_count; |
283 | 283 |
284 uint32_t size = sizeof(debug_info); | 284 uint32_t size = sizeof(debug_info); |
285 // Add the sizes of fixed parts of entries. | 285 // Add the sizes of fixed parts of entries. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 if (code->has_unwinding_info()) { | 350 if (code->has_unwinding_info()) { |
351 LogWriteBytes(reinterpret_cast<const char*>(code->unwinding_info_start()), | 351 LogWriteBytes(reinterpret_cast<const char*>(code->unwinding_info_start()), |
352 code->unwinding_info_size()); | 352 code->unwinding_info_size()); |
353 } else { | 353 } else { |
354 OFStream perf_output_stream(perf_output_handle_); | 354 OFStream perf_output_stream(perf_output_handle_); |
355 EhFrameWriter::WriteEmptyEhFrame(perf_output_stream); | 355 EhFrameWriter::WriteEmptyEhFrame(perf_output_stream); |
356 } | 356 } |
357 | 357 |
358 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; | 358 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; |
359 DCHECK_LT(padding_size, sizeof(padding_bytes)); | 359 DCHECK_LT(padding_size, static_cast<int>(sizeof(padding_bytes))); |
360 LogWriteBytes(padding_bytes, padding_size); | 360 LogWriteBytes(padding_bytes, static_cast<int>(padding_size)); |
361 } | 361 } |
362 | 362 |
363 void PerfJitLogger::CodeMoveEvent(AbstractCode* from, Address to) { | 363 void PerfJitLogger::CodeMoveEvent(AbstractCode* from, Address to) { |
364 // Code relocation not supported. | 364 // Code relocation not supported. |
365 UNREACHABLE(); | 365 UNREACHABLE(); |
366 } | 366 } |
367 | 367 |
368 void PerfJitLogger::LogWriteBytes(const char* bytes, int size) { | 368 void PerfJitLogger::LogWriteBytes(const char* bytes, int size) { |
369 size_t rv = fwrite(bytes, 1, size, perf_output_handle_); | 369 size_t rv = fwrite(bytes, 1, size, perf_output_handle_); |
370 DCHECK(static_cast<size_t>(size) == rv); | 370 DCHECK(static_cast<size_t>(size) == rv); |
(...skipping 13 matching lines...) Expand all Loading... |
384 header.time_stamp_ = | 384 header.time_stamp_ = |
385 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); | 385 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); |
386 header.flags_ = 0; | 386 header.flags_ = 0; |
387 | 387 |
388 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); | 388 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); |
389 } | 389 } |
390 | 390 |
391 #endif // V8_OS_LINUX | 391 #endif // V8_OS_LINUX |
392 } // namespace internal | 392 } // namespace internal |
393 } // namespace v8 | 393 } // namespace v8 |
OLD | NEW |