| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 | 72 |
| 73 uint64_t PerfJitLogger::GetTimestamp() { | 73 uint64_t PerfJitLogger::GetTimestamp() { |
| 74 return static_cast<int64_t>( | 74 return static_cast<int64_t>( |
| 75 base::TimeTicks::KernelTimestampNow().ToInternalValue()); | 75 base::TimeTicks::KernelTimestampNow().ToInternalValue()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| 79 void PerfJitLogger::LogRecordedBuffer(Code* code, SharedFunctionInfo*, | 79 void PerfJitLogger::LogRecordedBuffer(Code* code, SharedFunctionInfo*, |
| 80 const char* name, int length) { | 80 const char* name, int length) { |
| 81 ASSERT(code->instruction_start() == code->address() + Code::kHeaderSize); | 81 DCHECK(code->instruction_start() == code->address() + Code::kHeaderSize); |
| 82 ASSERT(perf_output_handle_ != NULL); | 82 DCHECK(perf_output_handle_ != NULL); |
| 83 | 83 |
| 84 const char* code_name = name; | 84 const char* code_name = name; |
| 85 uint8_t* code_pointer = reinterpret_cast<uint8_t*>(code->instruction_start()); | 85 uint8_t* code_pointer = reinterpret_cast<uint8_t*>(code->instruction_start()); |
| 86 uint32_t code_size = code->instruction_size(); | 86 uint32_t code_size = code->instruction_size(); |
| 87 | 87 |
| 88 static const char string_terminator[] = "\0"; | 88 static const char string_terminator[] = "\0"; |
| 89 | 89 |
| 90 jr_code_load code_load; | 90 jr_code_load code_load; |
| 91 code_load.p.id = JIT_CODE_LOAD; | 91 code_load.p.id = JIT_CODE_LOAD; |
| 92 code_load.p.total_size = sizeof(code_load) + length + 1 + code_size; | 92 code_load.p.total_size = sizeof(code_load) + length + 1 + code_size; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 116 void PerfJitLogger::CodeDeleteEvent(Address from) { | 116 void PerfJitLogger::CodeDeleteEvent(Address from) { |
| 117 // V8 does not send notification on code unload | 117 // V8 does not send notification on code unload |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 void PerfJitLogger::SnapshotPositionEvent(Address addr, int pos) {} | 121 void PerfJitLogger::SnapshotPositionEvent(Address addr, int pos) {} |
| 122 | 122 |
| 123 | 123 |
| 124 void PerfJitLogger::LogWriteBytes(const char* bytes, int size) { | 124 void PerfJitLogger::LogWriteBytes(const char* bytes, int size) { |
| 125 size_t rv = fwrite(bytes, 1, size, perf_output_handle_); | 125 size_t rv = fwrite(bytes, 1, size, perf_output_handle_); |
| 126 ASSERT(static_cast<size_t>(size) == rv); | 126 DCHECK(static_cast<size_t>(size) == rv); |
| 127 USE(rv); | 127 USE(rv); |
| 128 } | 128 } |
| 129 | 129 |
| 130 | 130 |
| 131 void PerfJitLogger::LogWriteHeader() { | 131 void PerfJitLogger::LogWriteHeader() { |
| 132 ASSERT(perf_output_handle_ != NULL); | 132 DCHECK(perf_output_handle_ != NULL); |
| 133 jitheader header; | 133 jitheader header; |
| 134 header.magic = JITHEADER_MAGIC; | 134 header.magic = JITHEADER_MAGIC; |
| 135 header.version = JITHEADER_VERSION; | 135 header.version = JITHEADER_VERSION; |
| 136 header.total_size = sizeof(jitheader); | 136 header.total_size = sizeof(jitheader); |
| 137 header.pad1 = 0xdeadbeef; | 137 header.pad1 = 0xdeadbeef; |
| 138 header.elf_mach = GetElfMach(); | 138 header.elf_mach = GetElfMach(); |
| 139 header.pid = base::OS::GetCurrentProcessId(); | 139 header.pid = base::OS::GetCurrentProcessId(); |
| 140 header.timestamp = | 140 header.timestamp = |
| 141 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); | 141 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); |
| 142 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); | 142 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); |
| 143 } | 143 } |
| 144 | 144 |
| 145 #endif // V8_OS_LINUX | 145 #endif // V8_OS_LINUX |
| 146 } | 146 } |
| 147 } // namespace v8::internal | 147 } // namespace v8::internal |
| OLD | NEW |