Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps,profiler: parse Windows' "%p" in processor #14510

Closed
Closed
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
28 changes: 21 additions & 7 deletions deps/v8/tools/tickprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,25 @@ function TickProcessor(
'shared-library': { parsers: [null, parseInt, parseInt, parseInt],
processor: this.processSharedLibrary },
'code-creation': {
parsers: [null, parseInt, parseInt, parseInt, parseInt,
parsers: [null, parseInt, parseInt, this.parseIntAddressFormat, parseInt,
null, 'var-args'],
processor: this.processCodeCreation },
'code-deopt': {
parsers: [parseInt, parseInt, parseInt, parseInt, parseInt,
parsers: [parseInt, parseInt, this.parseIntAddressFormat, parseInt, parseInt,
null, null, null],
processor: this.processCodeDeopt },
'code-move': { parsers: [parseInt, parseInt, ],
'code-move': { parsers: [this.parseIntAddressFormat, this.parseIntAddressFormat, ],
processor: this.processCodeMove },
'code-delete': { parsers: [parseInt],
processor: this.processCodeDelete },
'sfi-move': { parsers: [parseInt, parseInt],
'sfi-move': { parsers: [this.parseIntAddressFormat, this.parseIntAddressFormat],
processor: this.processFunctionMove },
'active-runtime-timer': {
parsers: [null],
processor: this.processRuntimeTimerEvent },
'tick': {
parsers: [parseInt, parseInt, parseInt,
parseInt, parseInt, 'var-args'],
parsers: [this.parseIntAddressFormat, parseInt, parseInt,
this.parseIntAddressFormat, parseInt, 'var-args'],
processor: this.processTick },
'heap-sample-begin': { parsers: [null, null, parseInt],
processor: this.processHeapSampleBegin },
Expand Down Expand Up @@ -236,6 +236,20 @@ TickProcessor.prototype.printError = function(str) {
printErr(str);
};

/**
* A thin wrapper around parseInt to accept the Windows %p pointer format,
* which is 8 hexadecimal characters on 32 bits, or 16 hexadecimal characters
* on 64 bits.
*/
TickProcessor.prototype.parseIntAddressFormat = function(s, radix) {
var re = /^([0-9A-Fa-f]{8}|[0-9A-Fa-f]{16})$/g
if (s.match(re)) {
return parseInt(s, 16)
} else {
return parseInt(s, radix)
}
}


TickProcessor.prototype.setCodeType = function(name, type) {
this.codeTypes_[name] = TickProcessor.CodeTypes[type];
Expand Down Expand Up @@ -292,7 +306,7 @@ TickProcessor.prototype.processCodeCreation = function(
type, kind, timestamp, start, size, name, maybe_func) {
name = this.deserializedEntriesNames_[start] || name;
if (maybe_func.length) {
var funcAddr = parseInt(maybe_func[0]);
var funcAddr = this.parseIntAddressFormat(maybe_func[0]);
var state = parseState(maybe_func[1]);
this.profile_.addFuncCode(type, name, timestamp, start, size, funcAddr, state);
} else {
Expand Down