Skip to content

Instantly share code, notes, and snippets.

@jperkin
Created September 25, 2023 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jperkin/ba644fddf52a4a740ba9e9c70d975209 to your computer and use it in GitHub Desktop.
Save jperkin/ba644fddf52a4a740ba9e9c70d975209 to your computer and use it in GitHub Desktop.
diff --git a/tools/codemap.mjs b/tools/codemap.mjs
index 985e721c34..1e1d2c55f8 100644
--- a/tools/codemap.mjs
+++ b/tools/codemap.mjs
@@ -67,7 +67,8 @@ export class CodeMap {
constructor(useBigInt=false) {
this.useBigInt = useBigInt;
- this.kPageSize = useBigInt ? BigInt(kPageSize) : kPageSize;
+ this.parseAddr = useBigInt ? BigInt : parseInt;
+ this.kPageSize = this.parseAddr(kPageSize);
this.kOne = useBigInt ? 1n : 1;
this.kZero = useBigInt ? 0n : 0;
}
diff --git a/tools/logreader.mjs b/tools/logreader.mjs
index 339017c488..9597090d1e 100644
--- a/tools/logreader.mjs
+++ b/tools/logreader.mjs
@@ -233,7 +233,7 @@ export class LogReader {
}
if (!this.useBigInt) {
if (!this.hasSeenUnsafeIntegers && containsUnsafeInts(parsedFields)) {
- console.warn(`Log line containts unsafe integers: ${fields}`);
+ console.warn(`Log line contains unsafe integers: ${fields}`);
this.hasSeenUnsafeIntegers = true;
}
}
diff --git a/tools/tickprocessor.mjs b/tools/tickprocessor.mjs
index af9eb8c36e..31feb5f78a 100644
--- a/tools/tickprocessor.mjs
+++ b/tools/tickprocessor.mjs
@@ -41,8 +41,8 @@ class V8Profile extends Profile {
static STUBS_RE = /^(Stub: )/;
constructor(separateIc, separateBytecodes, separateBuiltins, separateStubs,
- separateSparkplugHandlers) {
- super();
+ separateSparkplugHandlers, useBigInt) {
+ super(useBigInt);
const regexps = [];
if (!separateIc) regexps.push(V8Profile.IC_RE);
if (!separateBytecodes) regexps.push(V8Profile.BYTECODES_RE);
@@ -454,6 +454,7 @@ export class ArgumentsProcessor extends BaseArgumentsProcessor {
onlySummary: false,
runtimeTimerFilter: null,
serializeVMSymbols: false,
+ useBigInt: true,
};
}
}
@@ -488,6 +489,7 @@ export class TickProcessor extends LogReader {
params.timedRange,
params.pairwiseTimedRange,
params.onlySummary,
+ params.useBigInt,
params.runtimeTimerFilter,
params.preprocessJson);
}
@@ -508,17 +510,18 @@ export class TickProcessor extends LogReader {
timedRange,
pairwiseTimedRange,
onlySummary,
+ useBigInt,
runtimeTimerFilter,
preprocessJson) {
- super(timedRange, pairwiseTimedRange);
+ super(timedRange, pairwiseTimedRange, useBigInt);
this.setDispatchTable({
__proto__: null,
'shared-library': {
- parsers: [parseString, parseInt, parseInt, parseInt],
+ parsers: [parseString, BigInt, BigInt, parseInt],
processor: this.processSharedLibrary
},
'code-creation': {
- parsers: [parseString, parseInt, parseInt, parseInt, parseInt,
+ parsers: [parseString, parseInt, parseInt, BigInt, BigInt,
parseString, parseVarArgs],
processor: this.processCodeCreation
},
@@ -549,12 +552,12 @@ export class TickProcessor extends LogReader {
processor: this.processRuntimeTimerEvent
},
'tick': {
- parsers: [parseInt, parseInt, parseInt,
- parseInt, parseInt, parseVarArgs],
+ parsers: [BigInt, parseInt, parseInt,
+ BigInt, parseInt, parseVarArgs],
processor: this.processTick
},
'heap-sample-begin': {
- parsers: [parseString, parseString, parseInt],
+ parsers: [parseString, parseString, BigInt],
processor: this.processHeapSampleBegin
},
'heap-sample-end': {
@@ -628,7 +631,7 @@ export class TickProcessor extends LogReader {
this.profile_ = new JsonProfile();
} else {
this.profile_ = new V8Profile(separateIc, separateBytecodes,
- separateBuiltins, separateStubs, separateSparkplugHandlers);
+ separateBuiltins, separateStubs, separateSparkplugHandlers, useBigInt);
}
this.codeTypes_ = {};
// Count each tick as a time unit.
@@ -723,7 +726,7 @@ export class TickProcessor extends LogReader {
processCodeCreation(type, kind, timestamp, start, size, name, maybe_func) {
if (type != 'RegExp' && maybe_func.length) {
- const sfiAddr = parseInt(maybe_func[0]);
+ const sfiAddr = BigInt(maybe_func[0]);
const state = Profile.parseState(maybe_func[1]);
this.profile_.addFuncCode(type, name, timestamp, start, size, sfiAddr, state);
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment