Repository navigation
Conversation
CodeBlock::m_llintGetByIdWatchpointMap had the key (StructureID, BytecodeIndex). A site could have more than one entry, and nothing could find the entry of a site without the structure. The key is now the BytecodeIndex, which has the checkpoint. The entry has the structure and the watchpoints. The watchpoint and the collector each had a switch that finds the metadata of a site. CodeBlock::llintGetByIdModeMetadata() is that switch, once. It uses the checkpoint, so a dead entry of iterator_next or instanceof clears the cache that it guards, not both caches of the instruction. A watchpoint or a collection clears the cache that the guards are for, which is a ProtoLoad or Unset cache. A cache of an own property or of the length of an array, that the site got later, stays. clearToDefaultModeWithoutCache(), setUnsetMode() and setArrayLengthMode() set bytes 8 to 13 of GetByIdModeMetadata to zero. A site that leaves ProtoLoad mode had bytes of the pointer to the slot base there. Only ProtoLoad mode reads them. A program cannot see a difference.
Collaborator
Author
|
Status
|
|
Preview build of 5f1f719: |
robobun
added a commit
to oven-sh/bun
that referenced
this pull request
Sep 26, 2026
…e misses count toward the Baseline JIT The interpreter of JavaScriptCore (LLInt) has one cache entry for each property read, for one object shape. A read that sees several shapes calls its slow path each time, and nothing counted those calls toward the Baseline JIT. oven-sh/WebKit#735 (on top of oven-sh/WebKit#736) adds four JSC options, all on by default: - missCountForLLIntTierUp (12): the 12th slow path call of one get_by_id or put_by_id site lowers the threshold of the Baseline JIT for its function. The startup JIT policy (--compile-jit-policy) does not apply to such a function. - useLLIntUnsetCaching: a read that finds no property is cached. - useLLIntStringLengthFastPath: the length of a string is read with no call of the slow path. - useLLIntPrototypeCacheRearming: the cache of a value of the prototype chain is made again after it is cleared or replaced, 4 times at most for a read. The pin is the preview build of that pull request, which is the previous pin (f20ce77445) plus the two changes. Replace it with the merge commit before this merges. The test runs a fixture of property reads in 9 configurations of the options. What a read returns must not depend on what the cache holds.
robobun
added a commit
to oven-sh/bun
that referenced
this pull request
Sep 27, 2026
…e misses count toward the Baseline JIT The interpreter of JavaScriptCore (LLInt) has one cache entry for each property read, for one object shape. A read that sees several shapes calls its slow path each time, and nothing counted those calls toward the Baseline JIT. oven-sh/WebKit#735 (on top of oven-sh/WebKit#736) adds these JSC options: - missCountForLLIntTierUp (12): the 12th slow path call of one get_by_id or put_by_id site lowers the threshold of the Baseline JIT for its function. The startup JIT policy (--compile-jit-policy) does not apply to such a function. With useStartupJITDeferralAfterLLIntMisses (off) it applies. - useLLIntStringLengthFastPath (on): the length of a string is read with no call of the slow path. - useLLIntUnsetCaching (off): a read that finds no property is cached. - useLLIntPrototypeCacheRearming (off): the cache of a value of the prototype chain is made again after it is cleared or replaced, 4 times at most for a read. The object of a vm.constants.DONT_CONTEXTIFY context answers a property read with what the global object of the context has, so it can get a property and keep its structure. Its class now has the flag GetOwnPropertySlotIsImpureForPropertyAbsence. Without the flag, an inline cache of the JIT kept "no such property" for it, and a read returned undefined for a property that the context got later. The pin is the preview build of that pull request, which is the previous pin (f20ce77445) plus the two changes. Replace it with the merge commit before this merges. The test runs a fixture of property reads in 12 configurations of the options. What a read returns must not depend on what the cache holds.
robobun
added a commit
to oven-sh/bun
that referenced
this pull request
Sep 27, 2026
…e misses count toward the Baseline JIT The interpreter of JavaScriptCore (LLInt) has one cache entry for each property read, for one object shape. A read that sees several shapes calls its slow path each time, and nothing counted those calls toward the Baseline JIT. oven-sh/WebKit#735 (on top of oven-sh/WebKit#736) adds these JSC options: - missCountForLLIntTierUp (12): the 12th slow path call of one get_by_id or put_by_id site lowers the threshold of the Baseline JIT for its function. The startup JIT policy (--compile-jit-policy) does not apply to such a function. With useStartupJITDeferralAfterLLIntMisses (off) it applies. - useLLIntStringLengthFastPath (on): the length of a string is read with no call of the slow path. - useLLIntUnsetCaching (off): a read that finds no property is cached. - useLLIntPrototypeCacheRearming (off): the cache of a value of the prototype chain is made again after it is cleared or replaced, 4 times at most for a read. The object of a vm.constants.DONT_CONTEXTIFY context answers a property read with what the global object of the context has, so it can get a property and keep its structure. Its class now has the flag GetOwnPropertySlotIsImpureForPropertyAbsence. Without the flag, an inline cache of the JIT kept "no such property" for it, and a read returned undefined for a property that the context got later. The pin is the preview build of that pull request, which is the previous pin (f20ce77445) plus the two changes. Replace it with the merge commit before this merges. The test runs a fixture of property reads in 12 configurations of the options. What a read returns must not depend on what the cache holds.
Collaborator
Author
|
Closing: this commit is now the first commit of #735, which has |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CodeBlock::m_llintGetByIdWatchpointMaphas the key(StructureID, BytecodeIndex)(bytecode/CodeBlock.h). A site can have more than one entry, and nothing finds the entry of a site without the structure.bytecode/GetByIdMetadata.h).Fix
BytecodeIndex, which has the checkpoint. The entry has theStructureIDand the watchpoints.CodeBlock::llintGetByIdModeMetadata()finds the metadata of a site. The watchpoint and the collector each had that switch.clearToDefaultModeWithoutCache(),setUnsetMode()andsetArrayLengthMode()set bytes 8 to 13 ofGetByIdModeMetadatato zero.JSTests/stress/llint-*.jstests on an assert build, in each of their modes.Behaviour change: none
Background
get_by_idsite has 16 bytes of metadata for its inline cache. In ProtoLoad mode (a value of the prototype chain), 8 of them are the pointer to the object with the value.get_by_idof an instruction.iterator_nextandinstanceofhave two. The checkpoint of theBytecodeIndexsays which.Downsides
iterator_nextandinstanceof. Only$vmand the time of a read show that.Notes
Tests that cover the code.
llint-proto-get-by-id-cache-change-prototype.js,llint-proto-get-by-id-cache-intercept-value.js,llint-get-by-id-cache-prototype-load-from-dictionary.jsandllint-cache-replace-then-cache-get-and-fold-then-invalidate.jsmake a prototype load cache and make a watchpoint clear it. The tests of #735 pass on this build in the modes that do not read the state of a cache:llint-proto-get-by-id-cache-rearm.js,llint-get-by-id-cache-random.js,llint-get-by-id-unset-cache.jsandllint-get-length-string.js, with the defaults, with a threshold of 200 and no concurrent compiler, and with--collectContinuously=1.Why a site has one entry at most before #735. The countdown of a site (
hitCountForLLIntCaching) runs once, sosetupGetByIdPrototypeCache()runs once for a site at most. The assertion that the entry is new is still there.