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

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

Issue 2788413004: [inspector] cache stack frame for call sites (Closed)
Patch Set: reverted v8-debugger change Created 3 years, 8 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-inl.h ('k') | src/wasm/wasm-code-specialization.cc » ('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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } else { 277 } else {
278 return SourcePositionInfo(pos, function); 278 return SourcePositionInfo(pos, function);
279 } 279 }
280 } 280 }
281 281
282 } // namespace 282 } // namespace
283 283
284 void PerfJitLogger::LogWriteDebugInfo(Code* code, SharedFunctionInfo* shared) { 284 void PerfJitLogger::LogWriteDebugInfo(Code* code, SharedFunctionInfo* shared) {
285 // Compute the entry count and get the name of the script. 285 // Compute the entry count and get the name of the script.
286 uint32_t entry_count = 0; 286 uint32_t entry_count = 0;
287 for (SourcePositionTableIterator iterator(code->source_position_table()); 287 for (SourcePositionTableIterator iterator(code->SourcePositionTable());
288 !iterator.done(); iterator.Advance()) { 288 !iterator.done(); iterator.Advance()) {
289 entry_count++; 289 entry_count++;
290 } 290 }
291 if (entry_count == 0) return; 291 if (entry_count == 0) return;
292 Handle<Script> script(Script::cast(shared->script())); 292 Handle<Script> script(Script::cast(shared->script()));
293 293
294 PerfJitCodeDebugInfo debug_info; 294 PerfJitCodeDebugInfo debug_info;
295 295
296 debug_info.event_ = PerfJitCodeLoad::kDebugInfo; 296 debug_info.event_ = PerfJitCodeLoad::kDebugInfo;
297 debug_info.time_stamp_ = GetTimestamp(); 297 debug_info.time_stamp_ = GetTimestamp();
298 debug_info.address_ = reinterpret_cast<uint64_t>(code->instruction_start()); 298 debug_info.address_ = reinterpret_cast<uint64_t>(code->instruction_start());
299 debug_info.entry_count_ = entry_count; 299 debug_info.entry_count_ = entry_count;
300 300
301 uint32_t size = sizeof(debug_info); 301 uint32_t size = sizeof(debug_info);
302 // Add the sizes of fixed parts of entries. 302 // Add the sizes of fixed parts of entries.
303 size += entry_count * sizeof(PerfJitDebugEntry); 303 size += entry_count * sizeof(PerfJitDebugEntry);
304 // Add the size of the name after each entry. 304 // Add the size of the name after each entry.
305 305
306 Handle<Code> code_handle(code); 306 Handle<Code> code_handle(code);
307 Handle<SharedFunctionInfo> function_handle(shared); 307 Handle<SharedFunctionInfo> function_handle(shared);
308 for (SourcePositionTableIterator iterator(code->source_position_table()); 308 for (SourcePositionTableIterator iterator(code->SourcePositionTable());
309 !iterator.done(); iterator.Advance()) { 309 !iterator.done(); iterator.Advance()) {
310 SourcePositionInfo info(GetSourcePositionInfo(code_handle, function_handle, 310 SourcePositionInfo info(GetSourcePositionInfo(code_handle, function_handle,
311 iterator.source_position())); 311 iterator.source_position()));
312 Handle<Script> script(Script::cast(info.function->script())); 312 Handle<Script> script(Script::cast(info.function->script()));
313 std::unique_ptr<char[]> name_string = GetScriptName(script); 313 std::unique_ptr<char[]> name_string = GetScriptName(script);
314 size += (static_cast<uint32_t>(strlen(name_string.get())) + 1); 314 size += (static_cast<uint32_t>(strlen(name_string.get())) + 1);
315 } 315 }
316 316
317 int padding = ((size + 7) & (~7)) - size; 317 int padding = ((size + 7) & (~7)) - size;
318 debug_info.size_ = size + padding; 318 debug_info.size_ = size + padding;
319 LogWriteBytes(reinterpret_cast<const char*>(&debug_info), sizeof(debug_info)); 319 LogWriteBytes(reinterpret_cast<const char*>(&debug_info), sizeof(debug_info));
320 320
321 Address code_start = code->instruction_start(); 321 Address code_start = code->instruction_start();
322 322
323 for (SourcePositionTableIterator iterator(code->source_position_table()); 323 for (SourcePositionTableIterator iterator(code->SourcePositionTable());
324 !iterator.done(); iterator.Advance()) { 324 !iterator.done(); iterator.Advance()) {
325 SourcePositionInfo info(GetSourcePositionInfo(code_handle, function_handle, 325 SourcePositionInfo info(GetSourcePositionInfo(code_handle, function_handle,
326 iterator.source_position())); 326 iterator.source_position()));
327 PerfJitDebugEntry entry; 327 PerfJitDebugEntry entry;
328 // The entry point of the function will be placed straight after the ELF 328 // The entry point of the function will be placed straight after the ELF
329 // header when processed by "perf inject". Adjust the position addresses 329 // header when processed by "perf inject". Adjust the position addresses
330 // accordingly. 330 // accordingly.
331 entry.address_ = reinterpret_cast<intptr_t>( 331 entry.address_ = reinterpret_cast<intptr_t>(
332 code_start + iterator.code_offset() + kElfHeaderSize); 332 code_start + iterator.code_offset() + kElfHeaderSize);
333 entry.line_number_ = info.line + 1; 333 entry.line_number_ = info.line + 1;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 header.time_stamp_ = 401 header.time_stamp_ =
402 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0); 402 static_cast<uint64_t>(base::OS::TimeCurrentMillis() * 1000.0);
403 header.flags_ = 0; 403 header.flags_ = 0;
404 404
405 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header)); 405 LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header));
406 } 406 }
407 407
408 #endif // V8_OS_LINUX 408 #endif // V8_OS_LINUX
409 } // namespace internal 409 } // namespace internal
410 } // namespace v8 410 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/wasm/wasm-code-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698