@@ -88,6 +88,7 @@ export type StackTiming = {|
8888 sameWidthsStart : number [ ] ,
8989 sameWidthsEnd : number [ ] ,
9090 callNode : IndexIntoCallNodeTable [ ] ,
91+ argumentValues ?: number [ ] ,
9192 length : number ,
9293| } ;
9394
@@ -114,14 +115,20 @@ export function getStackTimingByDepth(
114115 subtreeRangeEnd : callNodeTableSubtreeRangeEndColumn ,
115116 depth : callNodeTableDepthColumn ,
116117 } = callNodeTable ;
117- const stackTimingByDepth = Array . from ( { length : maxDepthPlusOne } , ( ) => ( {
118- start : [ ] ,
119- end : [ ] ,
120- sameWidthsStart : [ ] ,
121- sameWidthsEnd : [ ] ,
122- callNode : [ ] ,
123- length : 0 ,
124- } ) ) ;
118+ const stackTimingByDepth = Array . from ( { length : maxDepthPlusOne } , ( ) => {
119+ const shape : StackTiming = {
120+ start : [ ] ,
121+ end : [ ] ,
122+ sameWidthsStart : [ ] ,
123+ sameWidthsEnd : [ ] ,
124+ callNode : [ ] ,
125+ length : 0 ,
126+ } ;
127+ if ( samples . argumentValues ) {
128+ shape . argumentValues = [ ] ;
129+ } ;
130+ return shape ;
131+ } ) ;
125132
126133 const sameWidthsIndexToTimestampMap = [ ] ;
127134
@@ -152,6 +159,7 @@ export function getStackTimingByDepth(
152159 let deepestOpenBoxDepth = - 1 ;
153160 const openBoxStartTimeByDepth = new Float64Array ( maxDepthPlusOne ) ;
154161 const openBoxStartTickByDepth = new Float64Array ( maxDepthPlusOne ) ;
162+ const openBoxArgsByDepth = new Int32Array ( maxDepthPlusOne ) ;
155163
156164 let currentStackTick = 0 ;
157165 for ( let sampleIndex = 0 ; sampleIndex < samples . length ; sampleIndex ++ ) {
@@ -160,6 +168,11 @@ export function getStackTimingByDepth(
160168 continue ;
161169 }
162170
171+ let sampleArgs : number = - 1 ;
172+ if ( samples . argumentValues ) {
173+ sampleArgs = samples . argumentValues [ sampleIndex ] !== null ? samples . argumentValues [ sampleIndex ] : - 1 ;
174+ }
175+
163176 const sampleTime = samples . time [ sampleIndex ] ;
164177
165178 // Phase 1: Commit open boxes which are not shared by the current call node,
@@ -191,6 +204,9 @@ export function getStackTimingByDepth(
191204 stackTimingForThisDepth . sameWidthsStart [ index ] = startStackTick ;
192205 stackTimingForThisDepth . sameWidthsEnd [ index ] = currentStackTick ;
193206 stackTimingForThisDepth . callNode [ index ] = deepestOpenBoxCallNodeIndex ;
207+ if ( stackTimingForThisDepth . argumentValues ) {
208+ stackTimingForThisDepth . argumentValues [ index ] = openBoxArgsByDepth [ deepestOpenBoxDepth ] ;
209+ }
194210 deepestOpenBoxCallNodeIndex =
195211 callNodeTablePrefixColumn [ deepestOpenBoxCallNodeIndex ] ;
196212 deepestOpenBoxDepth -- ;
@@ -206,6 +222,9 @@ export function getStackTimingByDepth(
206222 deepestOpenBoxDepth ++ ;
207223 openBoxStartTimeByDepth [ deepestOpenBoxDepth ] = sampleTime ;
208224 openBoxStartTickByDepth [ deepestOpenBoxDepth ] = currentStackTick ;
225+ if ( samples . argumentValues ) {
226+ openBoxArgsByDepth [ deepestOpenBoxDepth ] = sampleArgs ;
227+ }
209228 }
210229 }
211230
@@ -227,6 +246,9 @@ export function getStackTimingByDepth(
227246 stackTimingForThisDepth . sameWidthsStart [ index ] = startStackTick ;
228247 stackTimingForThisDepth . sameWidthsEnd [ index ] = currentStackTick ;
229248 stackTimingForThisDepth . callNode [ index ] = deepestOpenBoxCallNodeIndex ;
249+ if ( stackTimingForThisDepth . argumentValues ) {
250+ stackTimingForThisDepth . argumentValues [ index ] = openBoxArgsByDepth [ deepestOpenBoxDepth ] ;
251+ }
230252 deepestOpenBoxCallNodeIndex =
231253 callNodeTablePrefixColumn [ deepestOpenBoxCallNodeIndex ] ;
232254 deepestOpenBoxDepth -- ;
0 commit comments