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

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

Issue 2109613004: Remove position info from relocation info. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@turbosourcepos
Patch Set: fix 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/mips64/assembler-mips64.cc ('k') | src/ppc/assembler-ppc.h » ('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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "src/perf-jit.h" 28 #include "src/perf-jit.h"
29 29
30 #include "src/assembler.h" 30 #include "src/assembler.h"
31 #include "src/eh-frame.h" 31 #include "src/eh-frame.h"
32 #include "src/objects-inl.h" 32 #include "src/objects-inl.h"
33 #include "src/source-position-table.h"
33 34
34 #if V8_OS_LINUX 35 #if V8_OS_LINUX
35 #include <fcntl.h> 36 #include <fcntl.h>
36 #include <sys/mman.h> 37 #include <sys/mman.h>
37 #include <unistd.h> 38 #include <unistd.h>
38 #endif // V8_OS_LINUX 39 #endif // V8_OS_LINUX
39 40
40 namespace v8 { 41 namespace v8 {
41 namespace internal { 42 namespace internal {
42 43
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 240
240 LogWriteBytes(reinterpret_cast<const char*>(&code_load), sizeof(code_load)); 241 LogWriteBytes(reinterpret_cast<const char*>(&code_load), sizeof(code_load));
241 LogWriteBytes(code_name, length); 242 LogWriteBytes(code_name, length);
242 LogWriteBytes(string_terminator, 1); 243 LogWriteBytes(string_terminator, 1);
243 LogWriteBytes(reinterpret_cast<const char*>(code_pointer), code_size); 244 LogWriteBytes(reinterpret_cast<const char*>(code_pointer), code_size);
244 } 245 }
245 246
246 void PerfJitLogger::LogWriteDebugInfo(Code* code, SharedFunctionInfo* shared) { 247 void PerfJitLogger::LogWriteDebugInfo(Code* code, SharedFunctionInfo* shared) {
247 // Compute the entry count and get the name of the script. 248 // Compute the entry count and get the name of the script.
248 uint32_t entry_count = 0; 249 uint32_t entry_count = 0;
249 for (RelocIterator it(code, RelocInfo::kPositionMask); !it.done(); 250 for (SourcePositionTableIterator iterator(code->source_position_table());
250 it.next()) { 251 !iterator.done(); iterator.Advance()) {
251 entry_count++; 252 entry_count++;
252 } 253 }
253 if (entry_count == 0) return; 254 if (entry_count == 0) return;
254 Handle<Script> script(Script::cast(shared->script())); 255 Handle<Script> script(Script::cast(shared->script()));
255 Handle<Object> name_or_url(Script::GetNameOrSourceURL(script)); 256 Handle<Object> name_or_url(Script::GetNameOrSourceURL(script));
256 257
257 int name_length = 0; 258 int name_length = 0;
258 base::SmartArrayPointer<char> name_string; 259 base::SmartArrayPointer<char> name_string;
259 if (name_or_url->IsString()) { 260 if (name_or_url->IsString()) {
260 name_string = 261 name_string =
(...skipping 24 matching lines...) Expand all
285 size += (static_cast<uint32_t>(name_length) + 1) * entry_count; 286 size += (static_cast<uint32_t>(name_length) + 1) * entry_count;
286 287
287 int padding = ((size + 7) & (~7)) - size; 288 int padding = ((size + 7) & (~7)) - size;
288 289
289 debug_info.size_ = size + padding; 290 debug_info.size_ = size + padding;
290 291
291 LogWriteBytes(reinterpret_cast<const char*>(&debug_info), sizeof(debug_info)); 292 LogWriteBytes(reinterpret_cast<const char*>(&debug_info), sizeof(debug_info));
292 293
293 int script_line_offset = script->line_offset(); 294 int script_line_offset = script->line_offset();
294 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); 295 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
296 Address code_start = code->instruction_start();
295 297
296 for (RelocIterator it(code, RelocInfo::kPositionMask); !it.done(); 298 for (SourcePositionTableIterator iterator(code->source_position_table());
297 it.next()) { 299 !iterator.done(); iterator.Advance()) {
298 int position = static_cast<int>(it.rinfo()->data()); 300 int position = iterator.source_position();
299 int line_number = Script::GetLineNumber(script, position); 301 int line_number = Script::GetLineNumber(script, position);
300 // Compute column. 302 // Compute column.
301 int relative_line_number = line_number - script_line_offset; 303 int relative_line_number = line_number - script_line_offset;
302 int start = 304 int start =
303 (relative_line_number == 0) 305 (relative_line_number == 0)
304 ? 0 306 ? 0
305 : Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; 307 : Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1;
306 int column_offset = position - start; 308 int column_offset = position - start;
307 if (relative_line_number == 0) { 309 if (relative_line_number == 0) {
308 // For the case where the code is on the same line as the script tag. 310 // For the case where the code is on the same line as the script tag.
309 column_offset += script->column_offset(); 311 column_offset += script->column_offset();
310 } 312 }
311 313
312 PerfJitDebugEntry entry; 314 PerfJitDebugEntry entry;
313 entry.address_ = reinterpret_cast<uint64_t>(it.rinfo()->pc()); 315 entry.address_ =
316 reinterpret_cast<uint64_t>(code_start + iterator.code_offset());
314 entry.line_number_ = line_number; 317 entry.line_number_ = line_number;
315 entry.column_ = column_offset; 318 entry.column_ = column_offset;
316 LogWriteBytes(reinterpret_cast<const char*>(&entry), sizeof(entry)); 319 LogWriteBytes(reinterpret_cast<const char*>(&entry), sizeof(entry));
317 LogWriteBytes(name_string.get(), name_length + 1); 320 LogWriteBytes(name_string.get(), name_length + 1);
318 } 321 }
319 char padding_bytes[] = "\0\0\0\0\0\0\0\0"; 322 char padding_bytes[] = "\0\0\0\0\0\0\0\0";
320 LogWriteBytes(padding_bytes, padding); 323 LogWriteBytes(padding_bytes, padding);
321 } 324 }
322 325
323 void PerfJitLogger::LogWriteUnwindingInfo(Code* code) { 326 void PerfJitLogger::LogWriteUnwindingInfo(Code* code) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 header.time_stamp_ = 387 header.time_stamp_ =
385 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); 388 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0);
386 header.flags_ = 0; 389 header.flags_ = 0;
387 390
388 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); 391 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header));
389 } 392 }
390 393
391 #endif // V8_OS_LINUX 394 #endif // V8_OS_LINUX
392 } // namespace internal 395 } // namespace internal
393 } // namespace v8 396 } // namespace v8
OLDNEW
« no previous file with comments | « src/mips64/assembler-mips64.cc ('k') | src/ppc/assembler-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698