Skip to content

Commit 98b7f57

Browse files
committed
Split table marking and index translation into two separate steps.
1 parent d03a0cf commit 98b7f57

1 file changed

Lines changed: 16 additions & 31 deletions

File tree

src/profile-logic/profile-compacting.ts

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -190,39 +190,26 @@ export function computeCompactedProfile(
190190
_gatherReferencesInThread(thread, tcs, stringIndexMarkerFieldsByDataType);
191191
}
192192

193-
// The order of the _markTableAndComputeTranslation calls is important!
193+
// The order of the _markTable calls is important!
194194
// We only want to mark data that is (transitively) used by thread data.
195195
// So, for example, we have to mark the funcTable before we mark the
196196
// sources, so that, by the time we look at the sources, we already know
197197
// which sources are (transitively) referenced.
198-
_markTableAndComputeTranslation(
199-
shared.stackTable,
200-
tcs.stackTable,
201-
stackTableDesc
202-
);
203-
_markTableAndComputeTranslation(
204-
shared.frameTable,
205-
tcs.frameTable,
206-
frameTableDesc
207-
);
208-
_markTableAndComputeTranslation(
209-
shared.funcTable,
210-
tcs.funcTable,
211-
funcTableDesc
212-
);
213-
_markTableAndComputeTranslation(
214-
shared.resourceTable,
215-
tcs.resourceTable,
216-
resourceTableDesc
217-
);
218-
_markTableAndComputeTranslation(
219-
shared.nativeSymbols,
220-
tcs.nativeSymbols,
221-
nativeSymbolsDesc
222-
);
223-
_markTableAndComputeTranslation(shared.sources, tcs.sources, sourcesDesc);
224-
tcs.stringArray.computeIndexTranslation();
198+
_markTable(shared.stackTable, tcs.stackTable, stackTableDesc);
199+
_markTable(shared.frameTable, tcs.frameTable, frameTableDesc);
200+
_markTable(shared.funcTable, tcs.funcTable, funcTableDesc);
201+
_markTable(shared.resourceTable, tcs.resourceTable, resourceTableDesc);
202+
_markTable(shared.nativeSymbols, tcs.nativeSymbols, nativeSymbolsDesc);
203+
_markTable(shared.sources, tcs.sources, sourcesDesc);
204+
225205
tcs.libs.computeIndexTranslation();
206+
tcs.stringArray.computeIndexTranslation();
207+
tcs.sources.computeIndexTranslation();
208+
tcs.nativeSymbols.computeIndexTranslation();
209+
tcs.resourceTable.computeIndexTranslation();
210+
tcs.funcTable.computeIndexTranslation();
211+
tcs.frameTable.computeIndexTranslation();
212+
tcs.stackTable.computeIndexTranslation();
226213

227214
// Step 2: Create new tables for everything, skipping unreferenced entries.
228215
// The order of calls to _compactTable doesn't matter - we've already computed
@@ -279,7 +266,7 @@ export function computeCompactedProfile(
279266

280267
// --- Step 1: Marking ---
281268

282-
function _markTableAndComputeTranslation<T>(
269+
function _markTable<T>(
283270
table: T,
284271
thisTableCompactionState: TableCompactionState,
285272
tableDesc: TableDescription<T>
@@ -327,8 +314,6 @@ function _markTableAndComputeTranslation<T>(
327314
throw assertExhaustiveCheck(desc);
328315
}
329316
}
330-
331-
thisTableCompactionState.computeIndexTranslation();
332317
}
333318

334319
function markColumn(col: Array<number>, shouldMark: BitSet, markBuf: BitSet) {

0 commit comments

Comments
 (0)