Skip to content

Commit

Permalink
Fix the types of address properties in the frame and func tables (PR f…
Browse files Browse the repository at this point in the history
  • Loading branch information
julienw authored Jul 8, 2019
1 parent 0634407 commit 528ade8
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 206 deletions.
4 changes: 2 additions & 2 deletions src/profile-logic/import/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ async function processTracingEvents(
if (funcId === undefined) {
// The function did not exist.
funcId = funcTable.length++;
funcTable.address.push(0);
funcTable.address.push(-1);
funcTable.isJS.push(true);
funcTable.relevantForJS.push(false);
funcTable.name.push(stringTable.indexForString(functionName));
Expand All @@ -238,7 +238,7 @@ async function processTracingEvents(
'Unable to find the prefix stack index from a node index.'
);
}
frameTable.address[frameIndex] = stringTable.indexForString('');
frameTable.address[frameIndex] = -1;
frameTable.category[frameIndex] = javascriptCategoryIndex;
frameTable.subcategory[frameIndex] = 0;
frameTable.func[frameIndex] = funcId;
Expand Down
2 changes: 1 addition & 1 deletion src/test/fixtures/profiles/call-nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function getProfile(): Profile {
// Be explicit about table creation so flow errors are really readable.
const funcTable: FuncTable = {
name: funcNames,
address: Array(funcNames.length).fill(''),
address: Array(funcNames.length).fill(-1),
isJS: Array(funcNames.length).fill(false),
resource: Array(funcNames.length).fill(-1),
relevantForJS: Array(funcNames.length).fill(false),
Expand Down
4 changes: 2 additions & 2 deletions src/test/fixtures/profiles/processed-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ function _buildThreadFromTextOnlyStacks(
funcNames.forEach(funcName => {
funcTable.name.push(stringTable.indexForString(funcName));
funcTable.address.push(
funcName.startsWith('0x') ? parseInt(funcName.substr(2), 16) : 0
funcName.startsWith('0x') ? parseInt(funcName.substr(2), 16) : -1
);
funcTable.fileName.push(null);
funcTable.relevantForJS.push(funcName.endsWith('js-relevant'));
Expand Down Expand Up @@ -467,7 +467,7 @@ function _buildThreadFromTextOnlyStacks(

if (frameIndex === undefined) {
frameTable.func.push(funcIndex);
frameTable.address.push(0);
frameTable.address.push(funcTable.address[funcIndex]);
frameTable.category.push(category);
frameTable.subcategory.push(0);
frameTable.implementation.push(jitTypeIndex);
Expand Down
234 changes: 117 additions & 117 deletions src/test/store/__snapshots__/profile-view.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ Object {
Object {
"frameTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"category": Array [
null,
Expand Down Expand Up @@ -181,15 +181,15 @@ Object {
},
"funcTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"columnNumber": Array [
null,
Expand Down Expand Up @@ -570,15 +570,15 @@ Array [
Object {
"frameTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"category": Array [
null,
Expand Down Expand Up @@ -661,15 +661,15 @@ Array [
},
"funcTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"columnNumber": Array [
null,
Expand Down Expand Up @@ -1709,15 +1709,15 @@ CallTree {
"_displayDataByIndex": Map {},
"_funcTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"columnNumber": Array [
null,
Expand Down Expand Up @@ -1840,15 +1840,15 @@ exports[`snapshots of selectors/profile matches the last stored run of selectedT
Object {
"frameTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"category": Array [
null,
Expand Down Expand Up @@ -1931,15 +1931,15 @@ Object {
},
"funcTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"columnNumber": Array [
null,
Expand Down Expand Up @@ -2215,15 +2215,15 @@ exports[`snapshots of selectors/profile matches the last stored run of selectedT
Object {
"frameTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"category": Array [
null,
Expand Down Expand Up @@ -2306,15 +2306,15 @@ Object {
},
"funcTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"columnNumber": Array [
null,
Expand Down Expand Up @@ -2507,15 +2507,15 @@ exports[`snapshots of selectors/profile matches the last stored run of selectedT
Object {
"frameTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"category": Array [
null,
Expand Down Expand Up @@ -2598,15 +2598,15 @@ Object {
},
"funcTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"columnNumber": Array [
null,
Expand Down Expand Up @@ -2805,15 +2805,15 @@ exports[`snapshots of selectors/profile matches the last stored run of selectedT
Object {
"frameTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"category": Array [
null,
Expand Down Expand Up @@ -2896,15 +2896,15 @@ Object {
},
"funcTable": Object {
"address": Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
],
"columnNumber": Array [
null,
Expand Down
Loading

0 comments on commit 528ade8

Please sign in to comment.