Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@
['_type!="static_library"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-Wl,-no_pie',
'-Wl,-search_paths_first',
],
},
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/base/platform/platform-macos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
if (code_ptr == NULL) continue;
const uintptr_t slide = _dyld_get_image_vmaddr_slide(i);
const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide;
result.push_back(
SharedLibraryAddress(_dyld_get_image_name(i), start, start + size));
result.push_back(SharedLibraryAddress(
_dyld_get_image_name(i), start, start + size, slide));
}
return result;
}
Expand Down
7 changes: 6 additions & 1 deletion deps/v8/src/base/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,16 @@ class OS {
struct SharedLibraryAddress {
SharedLibraryAddress(
const std::string& library_path, uintptr_t start, uintptr_t end)
: library_path(library_path), start(start), end(end) {}
: library_path(library_path), start(start), end(end), slide(0) {}
SharedLibraryAddress(
const std::string& library_path, uintptr_t start, uintptr_t end,
uintptr_t slide)
: library_path(library_path), start(start), end(end), slide(slide) {}

std::string library_path;
uintptr_t start;
uintptr_t end;
uintptr_t slide;
};

static std::vector<SharedLibraryAddress> GetSharedLibraryAddresses();
Expand Down
11 changes: 7 additions & 4 deletions deps/v8/src/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ void Profiler::Engage() {
base::OS::GetSharedLibraryAddresses();
for (size_t i = 0; i < addresses.size(); ++i) {
LOG(isolate_, SharedLibraryEvent(
addresses[i].library_path, addresses[i].start, addresses[i].end));
addresses[i].library_path, addresses[i].start, addresses[i].end,
addresses[i].slide));
}

// Start thread processing the profiler buffer.
Expand Down Expand Up @@ -891,11 +892,13 @@ void Logger::ApiSecurityCheck() {

void Logger::SharedLibraryEvent(const std::string& library_path,
uintptr_t start,
uintptr_t end) {
uintptr_t end,
uintptr_t slide) {
if (!log_->IsEnabled() || !FLAG_prof_cpp) return;
Log::MessageBuilder msg(log_);
msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR,
library_path.c_str(), start, end);
msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR
",0x%08" V8PRIxPTR,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably print the slide as a signed base 10 number because it can be < 0. For that matter, the code should really be updated to use intptr_t because that's what _dyld_get_image_vmaddr_slide() returns.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any pros of using unsigned int and base 10 here? I like how things may work both ways here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, may I ask you to raise this concern on CL page?

library_path.c_str(), start, end, slide);
msg.WriteToLogFile();
}

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ class Logger {

void SharedLibraryEvent(const std::string& library_path,
uintptr_t start,
uintptr_t end);
uintptr_t end,
uintptr_t slide);

void CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta);
void CurrentTimeEvent();
Expand Down
11 changes: 6 additions & 5 deletions deps/v8/tools/tickprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function TickProcessor(
pairwiseTimedRange,
onlySummary) {
LogReader.call(this, {
'shared-library': { parsers: [null, parseInt, parseInt],
'shared-library': { parsers: [null, parseInt, parseInt, parseInt],
processor: this.processSharedLibrary },
'code-creation': {
parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'],
Expand Down Expand Up @@ -321,13 +321,13 @@ TickProcessor.prototype.processLogFileInTest = function(fileName) {


TickProcessor.prototype.processSharedLibrary = function(
name, startAddr, endAddr) {
var entry = this.profile_.addLibrary(name, startAddr, endAddr);
name, startAddr, endAddr, slide) {
var entry = this.profile_.addLibrary(name, startAddr, endAddr, slide);
this.setCodeType(entry.getName(), 'SHARED_LIB');

var self = this;
var libFuncs = this.cppEntriesProvider_.parseVmSymbols(
name, startAddr, endAddr, function(fName, fStart, fEnd) {
name, startAddr, endAddr, slide, function(fName, fStart, fEnd) {
self.profile_.addStaticCode(fName, fStart, fEnd);
self.setCodeType(fName, 'CPP');
});
Expand Down Expand Up @@ -646,7 +646,7 @@ function CppEntriesProvider() {


CppEntriesProvider.prototype.parseVmSymbols = function(
libName, libStart, libEnd, processorFunc) {
libName, libStart, libEnd, libSlide, processorFunc) {
this.loadSymbols(libName);

var prevEntry;
Expand Down Expand Up @@ -675,6 +675,7 @@ CppEntriesProvider.prototype.parseVmSymbols = function(
} else if (funcInfo === false) {
break;
}
funcInfo.start += libSlide;
if (funcInfo.start < libStart && funcInfo.start < libEnd - libStart) {
funcInfo.start += libStart;
}
Expand Down