Bug 1682504 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Bug 1673553 (TI removal and follow-ups) simplified the Baseline IC code and data structures a lot but there's still more to explore:

* We still have a C++ class for each fallback stub kind. I think we can get rid of this and have just `ICFallbackStub` (the current base class) similar to `ICCacheIRStub`. Some fallback stubs (NewArray, NewObject, Rest) store a template object, but that will likely change in the future.

* We then have the following for each fallback stub:
```
* ICEntry (2 words) [array in JitScript]
firstStub
pcOffset

* ICFallbackStub (4 words) [allocated in LifoAlloc]
code
enteredCount + isFallback
icEntry
state
```
This isn't very efficient, for example ICEntry has 4 padding bytes. It might be better to store a pointer to the fallback stub in the ICEntry and store the pcOffset in the fallback stub. This would get us down to 5 words.

Another option is to merge ICEntry and ICFallbackStub like this:
```
* ICFallbackStub (4 words) [array in JitScript]
code
enteredCount + isFallback
firstStub
pcOffset + state
```
This would let us speed up JitScript allocation because we no longer need the LifoAlloc, we just allocate an array of fallback stubs as part of JitScript (similar to current `ICEntry[]`) and fill it in.
Bug 1673553 (TI removal and follow-ups) simplified the Baseline IC code and data structures a lot but there's still more to explore:

* We still have a C++ class for each fallback stub kind. I think we can get rid of this and have just `ICFallbackStub` (the current base class) similar to `ICCacheIRStub`. Some fallback stubs (NewArray, NewObject, Rest) store a template object, but that will likely change in the future.

* We then have the following for each fallback stub:
```
* ICEntry (2 words) [array in JitScript]
firstStub
pcOffset

* ICFallbackStub (4 words) [allocated in LifoAlloc]
code
enteredCount + isFallback
icEntry
state
```
This isn't very efficient, for example ICEntry has 4 padding bytes. It might be better to store a pointer to the fallback stub in the ICEntry and store the pcOffset in the fallback stub. This would get us down to 5 words.

Another option is to merge ICEntry and ICFallbackStub like this:
```
* ICFallbackStub (4 words) [array in JitScript]
code
enteredCount + isFallback
firstStub
pcOffset + state
```
This would let us speed up JitScript allocation because we no longer need the LifoAlloc for fallback stubs, we just allocate the fixed-size array as part of JitScript (similar to current `ICEntry[]`) and fill it in.

Back to Bug 1682504 Comment 0