Skip to content

[JSC] AOT: short loops written out, B3 and Air printed for tests, one Structure for an object that is filled, facts on environment fields - #914

Merged
Jarred-Sumner merged 557 commits into
mainfrom
claude/compile-aot
Oct 27, 2026
Merged

Jarred-Sumner merged 557 commits into
mainfrom
claude/compile-aot

Conversation

@Jarred-Sumner

@Jarred-Sumner Jarred-Sumner commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #912, from the same branch. Most of it is under Source/JavaScriptCore/aot, which only a build with ENABLE_AOT compiles. The section "Outside aot/" describes the first changes outside it, the pushes below describe theirs, and the last section lists every file outside it.

Loops

  • The B3 step unrollLoops writes out eight or four turns of a small innermost counted loop. One of them tests the counter against a bound that leaves room for the others, and the loop itself takes the turns that are left. Only likely blocks are copied.
  • A sum of 32-bit integers that is kept in a double is added as a 64-bit integer while it stays exact.
  • A loop that goes on while a rising counter is below a falling one gets its range checks as guards at the entry.
  • A fast loop that ends within the data it walks has no poll.
  • On x86-64 a small hot loop is kept within lines of the instruction cache.

Tests of what the IR lowers to

  • testaot has two new RUN modes. lower-to-b3 takes IR text and prints B3 as the code generator built it, after one named step of the B3 pipeline, or right before Air. lower-to-air prints the final Air of each loop with a count of its instructions.
  • Blocks print with the hot path first, origins print as the IR operation they came from, heaps print by name, and no address is printed, so one text serves x86-64 and arm64. Only the counts of instructions are per architecture.
  • The first tests pin the loop that sums a Float64Array: the loads and the range check as lowered, the eight loads of the turns that are written out, and a hot loop without a range check, a poll or a second read of the length.

Guesses and facts

  • In the copy of a callee, a read of an environment field is a word and a cast that names its fact. Where flow shows that the field is stored before any function that captures the environment can run, the read keeps its type and leans on the entry of the body.
  • A store into a typed array, a DataView or a Buffer takes a double with a payload as a Double, and the payload does not enter an ImpureDouble at a join.

Analysis

  • Each layout and each object is asked once for who writes its fields, and writes into escaped classes are gathered once.
  • A prototype object stops the stores under the names it has and none under another name.
  • The listed prototype of a constructor inherits no removable feature, and a read of it lets the constructor escape.
  • valueflow-why prints the statement behind each hop of an escape and follows unknown callees to where they come from.

Objects and calls

  • An object that is given one name after another is a dictionary while it is filled and gets one Structure at the end.
  • Object.hasOwn(object, index), the text of an index as a key, stores under it, list[-1] and -1 in list are answered in the stub. The type test of a namespace is one load and one compare.
  • Whole numbers, booleans and null of members of unknown type are written by a prelude of JSONAppendValue.
  • NewObject narrows a reference where it stores it.
  • A list of arguments lies on the stack once at each hop between the engine's convention and the compiled one. A shared cold body that only prepares arguments leaves by its last call.
  • A switch whose arms only choose a value becomes a table of values.
  • A construction by a function whose prototype property changes is not put off.

Modules

  • Which groups of modules are loaded together is a table of the image, so import() walks no requests.
  • The words of a file that the first entry point does not bring along are filled when the file is entered.
  • However a step ends a load, the promise that was left in the entry ends with it.

Outside aot/

  • b3/B3UnrollLoops.{h,cpp}, b3/B3Generate.cpp, b3/B3Limits.h, b3/B3CompilationReport.h, b3/B3ReduceStrength.cpp, Sources.txt: the step unrollLoops, and Shl(Add(value, c1), c2) as Add(Shl(value, c2), c1 << c2), both under LoopPolicy::unrolls, which only the AOT client sets.
  • b3/B3LoopRangeChecks.{h,cpp}, b3/B3LoopVersionPlan.cpp, b3/B3VersionLoops.cpp: planRangeChecksOfMeetingCounters() and its guards in front of the fast loop; the fast loop drops its poll under LoopPolicy::limitsOfRangeChecksAreLengthsOfData, which only the AOT client sets.
  • b3/B3CycleForest.cpp: of a cycle with several entries, a block that polls is the header only if it is reached without a rare edge, and an entry counts as likely only if its predecessor outside the cycle is likely.
  • b3/B3LowerMacros.cpp: tryBuildValueTable(), under SwitchLoweringPolicy::usesValueTables, which only the AOT client sets.
  • b3/B3Generate.{h,cpp}: prepareForGeneration() takes an optional StepObserver, called after each step that ran.
  • b3/B3Policy.{h,cpp}: the four fields above, all off by default, and the switch UnrollLoops.
  • b3/testb3_bun*.{h,cpp}, shell/CMakeLists.txt: tests of the above.
  • runtime/Structure.{h,cpp}, runtime/JSObjectInlines.h: addNewPropertyTransition() takes the object that gets the property; under ENABLE(AOT) and only where the VM has compiled code, a hook may make it a dictionary.
  • runtime/JSObject.cpp, runtime/VM.cpp: under ENABLE(AOT), objects that are being filled are finished in front of a delete and in front of the microtasks.
  • runtime/ObjectConstructorInlines.h: checkStructureForClone() no longer asks hasBeenDictionary(). A Structure that is a dictionary is refused above, and one that has been a dictionary and is none has been flattened, which is still asked.
  • runtime/JSMicrotask.cpp: under ENABLE(AOT) and only where the VM has compiled code, moduleLoadStep() settles the promise in the entry at the end of every step.
  • runtime/ErrorConstructor.cpp, JSTests/stress/immutable-properties-listed-names.js: Error.captureStackTrace() throws a TypeError where stack is immutable.
  • heap/MarkedBlockCage.{h,cpp}: a VM that has released the last of its own reserve also takes from the reserve that is kept for all VMs of its range.
  • yarr/YarrFlatProgram.h, yarr/YarrFlatProgramBuilder.cpp, yarr/YarrFlatProgramMatcher.cpp, yarr/YarrInterpreter.cpp, JSTests/stress/regexp-flat-program-counts-turns-of-alternatives-tried-once.js: a flat program that counts turns walks the alternatives that are tried at the first place alone and then their copies, as the bytecode does, and makes an attempt at every place.

Later pushes

AOT: a value that may be unspecified names its fact, a narrowing stays inside the type it narrows, and short texts are joined out of one cache

  • IR: a result is T | unspecified only where a Return leaves it out, and each use takes AssumeType word, fact; the walk over paths that answered the same question is gone.
  • Types: what === leaves of its operand lies inside the operand's type, and one function says whether a built-in object may be an instance of a class.
  • Flow: evaluated text raises no flag of its own for what it loads by name; a data file of the image is found by name only where the program loads files by name.
  • Run time: the cache of short texts is made at its own first use; a class without fields below a built-in class is tested by the Structure that super() brought back.
  • Passes: value identities and dominators are built where a pass asks for them. B3UnrollLoops: far is farBound.

AOT: a cast that holds from a place on names its fact, a member escapes by the name that is read, and a field behind a decided test stays always filled

  • IR: the makers of a cast that holds only from a place on name a fact; the runner ties every parted cast in front of the passes that move code out of loops, and the verifier refuses a cast without one.
  • Flow: a read that hands its value on drops its key into one host node, and each family of escaped instances lets the methods under those names escape. A block whose parameter is never with and without the checks in front of it is never entered. What native code makes with a typed array constructor takes its prototype from the new target.
  • Types: a class part keeps what is expected of its contents beside a proof that says less; in hot blocks a call whose expected receivers find several methods is divided among them.
  • Modules: the words of files are filled by groups of files, and a body has the test only where it can be entered from outside; the search for what an import() loads hands its lists to the count of steps.
  • Run time: each function of the object's method table has one throw scope. Tests: 25 more loops are pinned by the B3 and the Air that they lower to.

AOT: a reference that may be unspecified is not published as dereferenceable

  • Code: publishKnownProperties() asks once whether the value may be unspecified; leastCellSizeOf() is asked about cells alone.
  • Tests: the filter of a Structure is asked of one that lies at another place of the table, and of two that share a place the later one has it; the words of the stack behind a function that made two Structures are overwritten in front of the collection that counts them.

AOT: a call of either of two built-ins gives what each makes, a built-in that native code calls may throw, and files of a cycle may enter each other's functions early

  • Flow: the class that the table names for a result stands only where every allocation noted at the object names it; every application of a built-in that calls a function may throw an error object, and any value where a parameter runs operand code; what the bodies of files in a cycle reach has an unknown entry; Reflect.set with a receiver defines the value on it.
  • Run time: JSON.parse(text) as T remembers the names of a text for each shape and makes the object with its final Structure; a descriptor that is written out is no object; f.apply reads its list before it tests the callee; a require.resolve that the program stores is the one that is called; the Structure of an object that was filled once is like any other; a mutator that finds no collector thread finishes the collection; a cell in a full range grows into the shared reserve.
  • Loops: a loop is written out where it walks data or keeps a sum as an integer; on arm64 the turns that are written out share one address; int32 tests stand only in place of a test that the operand gets anyway.
  • Patterns: the code of a pattern in the image hands a long search to the program that counts turns, and failed searches beside references are kept by operation, position and bounds.
  • Build cost: masks of memory locations, coverings and identities are computed once or on demand. Tests: several hundred programs are pinned by the B3 and the Air that they lower to.

AOT: a field that is stored by name in an object that is not yet made is found by in, and an index that is read is no name

  • Passes: where a field stays in its slot, the test whether the slot is filled answers for an object that is not yet made what it answers for the object once it is made.
  • Flow: a key that is an index marks what is stored under an index above that family, and no longer every name.

AOT: a proxy that is made in sight is written out, a check that names a call in parts throws where the call found nothing, and a native module under a made name is one module

  • Passes: a read, in or store through new Proxy(target, handler) in sight reads the trap off the handler and calls it; where the operand is an object's own definition, allocation sinking asks the description for its type; a field whose closure waits is asked about its stores as about its reads; what walks through casts answers with a type of its own.
  • Flow: the steps of built-in iterators note what they answer; the listed prototype of a host constructor lets the constructor escape under an unknown key too.
  • Run time: a built-in module that is native code is one module under a name made at run time; an import() that the loader answers hands on a promise of its own; frames of functions that are both called and constructed are listed; ArrayBuffer.prototype.byteLength is two loads; indexOf and includes of a text are an inline stub.
  • Inlining: the head of a callee also goes into a warm call that a loop reaches. JSON: memories of a text's names are kept by the name alone.
  • An object that was filled in one table counts again as one that has been a dictionary.

AOT: a type test narrows its operand, a typed JSON.parse takes a text with more members than its type lists, and switches in loops at the top level of a module

  • Passes: behind an edge of a type test a value is what the test leaves of it, and later tests of the same value are decided; a result is proven once every return has its type; a tally that the counter of its loop bounds is an integer; a switch over few integers in a loop at the top level of a module keeps its table; a declared field that is given what is only expected is read by its slot where nobody keeps the object; the result of defining a property is what its operand holds of objects.
  • Flow: the methods below listed own keys are found in one step; a function that is printed counts as read; the body of a library module is library code.
  • Run time: an ArrayBuffer is kept alive over the reads of its length; a request for a module that was put off hands on what it throws; the order of keys of an object with a field stored by name is asked at run time where the field may leave its slot.
  • JSON: the names of members that a type does not list are remembered by shape; an object with such members is written from one list of its properties.
  • Heap: where address space is bounded, a part of it is kept unused for requests that may not be refused; a Structure that becomes a dictionary is made before collections are put off; a weak table reports the memory of its buffer when it is visited.
  • RegExp: the count of turns of code in an image fits a word however long the subject is; the bytecode compiler asks what the JIT counts only where that is read, and once a disjunction.
  • B3: jumps are threaded through blocks that only test a constant; loops over bytes and words of typed arrays.
  • Tests: more tests that give the compiler's IR and check the B3 that it becomes.

AOT: a proxy that is made out of sight is written out, a getter defined on a file's exports takes the slot of its field, and the actions that a library sets are recorded behind the engine's own

  • Passes: a value that is expected to be the target of a proxy is asked whether it is a proxy; handler and target are read out of it and tested, and anything else takes the access as it is written.
  • Run time: a getter that Object.defineProperty defines on the exports of a file goes into the slot that the build made for the field.
  • Image: what a library asks the C library to do on an access to memory that is not there is kept and called behind the table of the places where compiled code reads through null.
  • WeakMap and WeakSet count their buffers as on main.

AOT: a built-in module answers to a name made at run time, loops that are written out keep their side paths, and the own keys of a built-in are listed in one order

  • Modules: one predicate says which records of the image answer to a path; the encoder and the verifier both ask it.
  • Flow: where native code calls a member under a name, the built-ins that have escaped under that name are among the callees; a call's known receivers answer with the built-ins they find; what happens to the objects that escape together is written apart from the program's own stores; four steps of the solver run on all threads.
  • Built-ins: a member that is added at its first read keeps that step only where the holder's keys may be listed; process.platform and process.arch are always constants.
  • Passes: a narrowing that leaves no member stays until the code behind it is cut; tests of one value are looked at only in the blocks that test it; a row of joins ends after 32 merged values; a value that may be undefined or a proxy is tested before its fields are read, and a proxy made out of sight is written out only where the handlers are known.
  • B3: side paths of a loop that is written out are written out with its turns or lead back into them; a loop that reads words is written out where it walks a list. Air: the ordinals of spilled instructions are a set.
  • Lowering: Reflect.get with a constant key is a read with a receiver; the text of an index in a literal's computed key takes the road of elements; a list takes the storage that its readers expect in Object.values, map with a built-in callback and for-of over a Map.
  • Entrances: a shorter entrance declares a parameter with what was tested and what the entrance declares. Stubs: the mark of a list of arguments that is kept elsewhere stands in an argument slot.
  • Modules: the files of a graph that require() loads run with the synchronous queue open.
  • Heap: the heaps for which an error is owed are a set, and each is told when it is thrown.
  • Trimming: the operations of regular expressions have a feature; an accessor outside the prototype objects has no guard.
  • WTF: what backtrace_symbols() returns goes back to the C library's free on Linux.

AOT: a list literal takes its storage from its own type

  • Code generation: the storage of a list literal no longer follows the one cast that reads it.

AOT: what was read out of a proxy is not asked again whether it is one

  • Resolving accesses: the arm of name in proxy without a trap asks the target once.

AOT: a slot that may be empty is tested before a closure is made of it, and a smaller table entry

  • Deferred closures: a field whose slot may be left is read behind a test also where the wide slot is called always filled.
  • Module variables: the list of answers of a callee has no inline room, so an entry of its table stays small in every build.

AOT: a check of a sum names both operands without their order

  • Tests: await-in-a-loop.ir asks for each operand of the sum by itself; a file without text goes.

AOT: a part of an address in a block that leaves the procedure is not shared

  • B3: the list of new parts of addresses loses what stands in a block that nothing leads to any more, in front of every reset of reachability.
  • Modules: the promise of a graph that did not load is rejected on every way out.

AOT: a loop polls unless a length of data bounds it, and a copied class is copied whole

  • Loops: the fast version of a loop leaves its poll out only where the length of a view, of a flat string or of an array that holds that many elements bounds it, or a bound of at most 2^20. The test in front of a rotated loop keeps its poll where the cycle around it has none.
  • Classes: every function that a copied function calls directly is copied with it. A class that an operation outside the copied functions names is not copied.
  • Allocation sinking: whether a slot has room for undefined and null is asked per allocation. An object made by a constructor function stays sunk where its own test shares guards with the test that members are unchanged.
  • Modules: an import() that waits for a CommonJS file settles though the file throws.
  • Proxies: an access is written out for a proxy only where flow sees one arrive beside at most four other known objects. No count over the whole program is left.
  • Lists: the operations that make a list write down what it holds. A list that declined a conversion to double storage uses up that place's allowance until the next collection.
  • Methods: a method read under a name that no layout lists, proven to be undefined or a function, gets no test of absence.
  • Patterns of many names build in linear time and memory.
  • Memory: array growth, argument lists, operator new and Rust's allocator take what is kept aside when nothing else is left. The page map's parts for the arenas are made ahead.
  • Size: 76 sources that run rarely are compiled for size.
  • The check of claims to the back end clears at entry every stack slot that holds no cell.

AOT: a variable of a heap cage test gets a name that no platform header defines

AOT: a native built-in module is generated once a load, and shorter conversions in front of masks and clamps

  • An import of a native built-in module runs its generator once, in the loader's step that makes the module, and keeps what it throws for later imports.
  • A name imported from "bun" is a copy made where the statement stands, once for each importing file.
  • f.apply(receiver, list) with f no function names f.apply in its TypeError.
  • x & y with y a small non-negative integer converts the lowest bits of x alone.
  • An int32 stored into a Uint8ClampedArray is clamped in 32 bits, and the loop's body is written out eight times.
  • A store whose receiver is a proxy of the object itself, without a trap that could see it, ends in the object.
  • Flow analysis keeps the writes of unknown code apart by a mark that no read asks for.
  • The own keys of a built-in object come in one order and one set, whatever the program uses of it.
  • Tests: IR tests and native tests for all of the above.

AOT: two reads of one place are merged only where nothing between them writes there

  • Where a loop is written out, two reads of one place in a turn become one read only if no block on a way from the first to the second, written out or not, writes there.
  • The poll of a loop that was turned round stands on the way back into it, not in front of it.
  • Range checks of a * counter + b leave a loop behind tests at its entry.
  • The instructions of a build are linear in the number of methods of a class.
  • delete proxy.name and delete proxy[key] call the deleteProperty trap of a handler in sight directly. The length of a list read through a get trap that hands on is the list's own.
  • What an ownKeys, getOwnPropertyDescriptor or defineProperty trap answers is held against what the target itself says of being closed.
  • An access that is left as written behind a test for a proxy is not written out again.
  • Filling the cell of a built-in adds no member to the object that holds it.
  • A namespace or a default import of "bun" that is exported again is a local export, and only export .. from "bun" asks for the module.
  • Two import() at once of files that share a native built-in module begin in the order of their calls, and such a module is generated when the loader reaches it.
  • Each CommonJS file of a level of an import() whose jobs are counted is asked for through the loader.
  • The link error of an export statement has the words and the order of the loader's. Frames of eval code say so. o[KEY] with a constant of the module is an access by name.
  • Under CMake the sources of aot/ take aot/support/AOTPrefix.h by -include and no precompiled header.
  • Tests: testb3 cases, IR tests and native tests for all of the above.

AOT: loops over typed arrays run on vectors, and one place decides whether two reads are one

  • A loop that copies, fills or combines the elements of typed arrays one by one runs on vectors behind tests at its entry, with the loop as written for what is left over. The x86-64 assembler has the instructions it needs.
  • Whether two reads of one place in a written-out loop are one read is decided by the numbering of memory alone. The reads of a loop's bound that are taken for one are noted for the check of moved loads.
  • Range checks of a * counter + b also leave a loop where the index is reduced by a mask or a remainder.
  • Listing, storing and deleting the keys of an object with many keys: the keys go from the table into the list directly, and a store or a delete looks the table up twice.
  • The instructions of a build are linear in the number of fields of a class.
  • Object.hasOwn, hasOwnProperty and getOwnPropertyDescriptor on a proxy made in sight call the trap of its handler directly.
  • A computed key that may be one of more than 32 names is any name to the analysis, so an object wrapped key by key costs it a fixed amount.
  • The accessors and functions that a program puts on process are followed where a statement imports node:process.
  • A handler for a slot is in an image only where a stub that jumps through its table is.
  • The destroy function of ten kinds of Intl objects is removable with the feature that creates them.
  • Who asks how much address space is left says what an answer that cannot be counted means: the whole limit for a request of its own, nothing for what is kept aside for others.
  • What is kept aside is renewed out of the allocator's arenas, and its state lies in the allocator's record of the thread.

AOT: a call says whether it writes the caches of call sites, and patterns made at run time remember a search by what a reference can still read

  • A call into the run time writes the caches of call sites unless its own declaration says that it writes nothing of the run time's state. No part of a cache is read ahead of a loop in which a call may fill it anew.
  • Loops over typed arrays do not run on vectors: the policy leaves the pass off. The pass itself asks how hot a loop is, leaves 64-bit words alone, walks falling and meeting counters, and is smaller.
  • A pattern made at run time: a search that found nothing is remembered by the bounds that a reference can still read from there, and a run without an upper bound remembers where its whole rest found nothing.
  • SinkAllocations no longer binds every guard of a layout to the object that it builds late.
  • The handlers of slots are in every image again.
  • In a release build the sources of aot/ trap where a check of libstdc++ does not hold, whichever version of the library they are compiled against. A Release lane for glibc looks at the archive for it.
  • JSON.stringify reserves what a long string needs where the string stands in the middle of a list or ends in an escape.
  • Objects with many keys: a name that the program does not spell asks for its number once, and a key that is used for properties alone is made a name at once.
  • A walk over a generator that is written out leaves the reads of next, return and throw where the keys of the generator's prototype are listed. JSON.stringify takes its short way for a Date once Date.prototype has the three members that the long way reads.
  • A file that runs ahead of the loader and calls import() finds the loader where bun run has it. An import() below a require() finds a CommonJS file that the required graph has just asked for.
  • Exports that nobody reads are removed a second time in front of CallModules, and a file with nothing to run keeps no body.
  • Live ranges are split around the frame of a loop only where that pays.
  • Range checks of a * counter + b leave a loop by less code of the compiler. The output is the same.
  • A cacheable dictionary that is made flat is reported to no cache of names.
  • The message for return f.call(..) and return f.apply(..) on what cannot be called names the callee.
  • A wrapper keeps the summary of effects that its function had.
  • A proxy that is asked under an integer hands its trap the text of it.
  • The message for a library module that is not found is what it was.
  • Under a limit on address space the allocator tells the keeper of what is kept aside who takes fresh small pages, and a store of the program gets its RangeError ahead of the operation.
  • The check of moved loads follows a load into the copies of a loop.

AOT: an object of a constructor function is made before its prototype property may change, and the front of a loop's version names values of copied blocks

  • SinkAllocations makes an object of a constructor function, whose prototype property flow does not call fixed, in front of whatever may end the member guards of its layout or run other code.
  • The front of a fast version of a loop may name a value of a block that another version copies. Such a value gets a variable, from the maker that demoteValues() uses.
  • A call writes the caches of call sites where its operation has a cache, where it writes what a lookup may come by, or where it calls a function of the program. A host function goes by its row in the table of built-ins, so a call that only reads leaves a loop again.
  • A pattern made at run time: the walk over what is reached on one way visits each operation once, and a greedy run that found nothing enters only the places below what is entered.
  • What JSON.stringify reserves ahead is room in the buffer, and only what it says is text is held against the longest string. A typed list whose short strings need an escape is written into the first reservation.
  • The finished list of Reflect.ownKeys and Object.getOwnPropertyNames is kept where a symbol stands beside the fields, in the cache that every collection clears.
  • A field that is created on an object with a property beside its fields finds its step of the key order.
  • A class finds a static field by an index, and the ledger finds its variables by object and key, so a build is linear in the number of static fields of a class.
  • Flow: what a function returns that the program laid on a holder of exports comes back to a call by name whose callee nobody knows. Only a read that is called asks for a lookup of its own. The predecessors of retired nodes are connected on all threads.
  • A guard and a position meet edge by edge.
  • The check of moved loads follows an entry through demoted values, and keeps its entries where code that nothing leads to is deleted.

AOT: an object that is handed its prototype is built where new stands, and native code polls where it enters compiled code

  • SinkAllocations: an allocation that is handed its prototype as an operand is built where it stands.
  • The adapters from native code into compiled code, and the stub that puts a saved frame back on the stack, compare with the stack limit that a request to the thread lowers, and poll out of line. What waits at an await does not go on once its thread was asked to end.
  • Flow: a built-in that keeps a value which nobody follows carries it out, so what Promise combinators, AbortSignal.abort().reason, SuppressedError, a stream's chunks and a rejected or thrown value hand back keeps its members.
  • Flow: a set of more than 64 members is tested for a watcher's member, not chained. Helpers that are imported from another file are copied for each file that calls them.
  • A read of a locked data property whose answer the build knows stays as an initialization where the keys of its holder may be listed. A first read goes by the name that is read.
  • What is written out for Object.hasOwn and hasOwnProperty on a proxy stands in an inline frame of that built-in.
  • The own keys of an object without a symbol are looked for in the first list first. A field that is created in a layout whose keys nobody lists looks no step of the key order up.
  • i < n with n: number: the counter is followed through what the branch on the comparison hands on, and the bound is tested ahead of the loop.
  • handGraphToLoader() and appendJSONTextOfProperty() look at their scope behind the last call that can throw.
  • A build is linear in the try blocks, loops, yields, cases, parameters and operands of || of one function: B3's induction records are found by their value, PlaceTypeTests asks the counters of one loop, and WTF::NaturalLoops finds a loop by its header.
  • The walk that builds objects ahead of a change of a constructor function's prototype returns at once where no family of the function may take one, and passes cells and other families.
  • The rounds of flow analysis: watchers, waves, edges into lists and long lists run in shares on all threads. The output is the same.
  • A pattern made at run time: runs of under eight units are not marked.
  • The verifier of modules finds what a function mentions by the schema's walkers. The check of moved loads holds the slots of call sites to the tighter form.
  • The jsc shell gives import.meta, module and require each function of the table of built-ins that it lacks. Such a function says which one is missing when it is called.

Air: a local in optimizeBlockOrder has a name that no system header defines

  • near is a macro in the headers of Windows. The iterator over the jumps in reach of a rare branch is named inReach.

AOT: an entry of the typed JSON.parse table that is being filled is not handed out again, and one rule orders unbuilt objects with member guards

  • JSON.parse into a typed shape: an entry of the table of learned objects has one writer at a time, at any depth of nesting; where none is free the inner object is parsed without being learned. A learn that gives up leaves its entry refused. No object is built from an entry without a plan.
  • SinkAllocations: one function decides where an unbuilt object is built: in front of whatever may end the member guards of its class or runs other code, and, for an object that is handed its prototype, also in front of whatever reads those guards. It replaces the rule that such an object is never virtual; four tests have their earlier text again.
  • Flow: the promise of an import() is also rejected with what the loader throws. A copy of an object's own properties lists its records when all else is at rest, so the graph of functions that each copy what they are given grows linearly. A wave's task asks ahead for the rows, messages, values and marks it is about to read.
  • A module that is linked stays linked, however the link step ends.
  • A thread tells the run time when it has started; the room that is kept for the next VM follows what a started VM of this process has taken.
  • Emitters in codegen, builtins, passes, ir, place and image append their values in the order written, whatever order the host compiler evaluates arguments in. eliminateRedundantReads() runs its three steps as statements.
  • The IR test runner knows the word windows in REQUIRES.
  • Native tests: a termination that is requested ahead of an entry from native code, with 0, 1, 9 and 300 arguments, a class and a resumed async function; a thread that takes small pages.

AOT: the reads of deferred initializers are recorded

  • DeferInitializers records a variable that a deferred initializer reads as read, so RemoveUnreadExports keeps its store.

Every file outside aot/

  • ./: Dockerfile
  • JSTests/: BUN-TEST-DIFFERENCES.md
  • JSTests/stress/: bun-weak-table-emptied-before-an-eden-collection.js, immutable-properties-listed-names.js, regexp-bytecode-of-deeply-nested-fixed-count-groups.js, regexp-flat-program-counts-turns-of-alternatives-tried-once.js, regexp-flat-program-memoizes-unbounded-runs.js, regexp-flat-program-remembers-failed-searches-beside-references.js, regexp-image-code-hands-long-searches-over.js
  • Source/JavaScriptCore/: CMakeLists.txt, Sources.txt, jsc.cpp
  • Source/JavaScriptCore/assembler/: MacroAssemblerX86_64.cpp, MacroAssemblerX86_64.h, X86Assembler.h
  • Source/JavaScriptCore/b3/: B3AbstractHeapRepository.cpp, B3AbstractHeapRepository.h, B3AffineIndex.cpp, B3AffineIndex.h, B3CompilationReport.h, B3ConvertBranchesToSelects.cpp, B3CycleForest.cpp, B3FixSSA.cpp, B3FixSSA.h, B3Generate.cpp, B3Generate.h, B3InductionRecords.cpp, B3InductionRecords.h, B3Limits.h, B3LoopRangeChecks.cpp, B3LoopRangeChecks.h, B3LoopRegions.cpp, B3LoopRegions.h, B3LoopUtilities.h, B3LoopVersionPlan.cpp, B3LoopVersionPlan.h, B3LowerMacros.cpp, B3MemoryNumbering.cpp, B3MemoryNumbering.h, B3MovedLoadCheck.cpp, B3MovedLoadCheck.h, B3PatchpointValue.cpp, B3PatchpointValue.h, B3Policy.cpp, B3Policy.h, B3Procedure.cpp, B3ReduceStrength.cpp, B3RegionCloner.cpp, B3RegionCloner.h, B3RotateLoops.cpp, B3SinkValues.cpp, B3StackmapSpecial.cpp, B3ThreadJumps.cpp, B3UnrollLoops.cpp, B3UnrollLoops.h, B3VectorizeLoops.cpp, B3VectorizeLoops.h, B3VersionLoops.cpp, testb3_bun.cpp, testb3_bun.h, testb3_bun_control_flow.cpp, testb3_bun_hoisting.cpp, testb3_bun_loop_plans.cpp, testb3_bun_loops.cpp, testb3_bun_placement.cpp, testb3_bun_policy.cpp, testb3_bun_random_program.h, testb3_bun_reductions.cpp, testb3_bun_selects.cpp, testb3_bun_strided_range_checks.cpp, testb3_bun_unroll_loops.cpp, testb3_bun_vectorize_loops.cpp
  • Source/JavaScriptCore/b3/air/: AirAllocateRegistersByGreedy.cpp, AirOptimizeBlockOrder.cpp, AirPolicy.cpp, AirPolicy.h, AirSplitLiveRangesAroundFrame.cpp, testair_bun.h, testair_bun_shrink_wrap.h
  • Source/JavaScriptCore/heap/: AddressSpaceBudget.h, Collector.cpp, Collector.h, CompleteSubspace.cpp, GCSegmentedArrayInlines.h, Heap.cpp, Heap.h, LocalAllocator.cpp, MarkedBlockCage.cpp, MarkedBlockCage.h, ReservedRangeHeap.cpp, ReservedRangeHeap.h, StructureAlignedMemoryAllocator.cpp, StructureAlignedMemoryAllocator.h
  • Source/JavaScriptCore/inspector/: ContentSearchUtilities.cpp
  • Source/JavaScriptCore/inspector/agents/: InspectorDebuggerAgent.cpp
  • Source/JavaScriptCore/interpreter/: Interpreter.cpp, StackVisitor.cpp, StackVisitor.h
  • Source/JavaScriptCore/runtime/: AbstractModuleRecord.cpp, ButterflyInlines.h, Error.cpp, ErrorConstructor.cpp, IntlDateTimeFormat.cpp, IntlDateTimeFormat.h, IntlDisplayNames.cpp, IntlDisplayNames.h, IntlDurationFormat.cpp, IntlDurationFormat.h, IntlListFormat.cpp, IntlListFormat.h, IntlLocale.cpp, IntlLocale.h, IntlNumberFormat.cpp, IntlNumberFormat.h, IntlPluralRules.cpp, IntlPluralRules.h, IntlRelativeTimeFormat.cpp, IntlRelativeTimeFormat.h, IntlSegmenter.cpp, IntlSegmenter.h, IntlSegments.cpp, IntlSegments.h, JSMicrotask.cpp, JSModuleLoader.cpp, JSModuleLoader.h, JSONObject.cpp, JSObject.cpp, JSObjectInlines.h, JSPropertyNameEnumerator.cpp, JSPropertyNameEnumerator.h, JSPropertyNameEnumeratorInlines.h, Lookup.cpp, MarkedVector.cpp, MarkedVector.h, ModuleGraphLoadingState.h, OptionsList.h, ProxyObject.cpp, ProxyObject.h, RegExp.cpp, ScriptExecutable.cpp, StackFrame.cpp, Structure.cpp, Structure.h, VM.cpp, VM.h
  • Source/JavaScriptCore/shell/: CMakeLists.txt, ExternalMimallocShims.cpp
  • Source/JavaScriptCore/yarr/: YarrFlatProgram.h, YarrFlatProgramBuilder.cpp, YarrFlatProgramMatcher.cpp, YarrInterpreter.cpp, YarrJIT.cpp
  • Source/WTF/wtf/: AutomaticThread.cpp, AutomaticThread.h, NaturalLoops.h, StackTrace.cpp, StackTrace.h
  • Source/WTF/wtf/threads/: Signals.cpp, Signals.h
  • Source/bmalloc/bmalloc/: bmalloc.cpp, bmalloc.h

The walk that calls a reviver looks up the offset of a property and stores what the reviver
returned at that offset if the property is plain. That passes by the check of stores into
objects with a typed layout. A reviver can put any object of the program into the tree that
is being walked, so the walk reached typed objects: a text landed in a field declared to be a
number, and compiled code read it as a number.

An object with a typed layout takes the arm that defines the property, which ends where the
check stands. A value that does not fit throws.

Only builds that are given a table of types have typed layouts.
A snapshot of work in progress, taken before merging main.
A TimeZone is an index into a table of every time zone ICU knows. The
first getHours(), toString() or getTimezoneOffset() in a process built
that table just to turn the host's zone into an index and back into a
name for ucal_open(). That cost 23.75M instructions and 655 KB.

Dates and Intl.DateTimeFormat now keep the identifier. The index is
looked up only when Temporal asks for DateCache::defaultTimeZone().
Host zones that cannot be resolved without the table still use it.

All of it is under USE(BUN_JSC_ADDITIONS).
Work-in-progress snapshot of the ahead-of-time compiler.

- Remove the earlier compiler that worked from bytecode (AOTGraph,
  AOTLower*, AOTTypeInference and friends).
- Describe built-in functions in tables under aot/builtins and generate
  their entries at build time.
- Add B3 loop phases: rotation, counted loops, strip mining, versioning.
- Keep environments in the frame where they do not escape, split
  functions so small results come back in registers, and compile
  regular expression literals ahead of time.
- Add a cage for marked blocks and a heap census.
In-place conversion of plain objects, module evaluation with top-level await,
audit sites for the JIT-on audit mode, the type error log, smaller code for
property access, casts and built-in calls, and compile time work in B3 and Air.
Brings the branch up to main at 4b724e9, with the last batch of
ahead-of-time compilation work before the merge.
…ing fixes

- The lock on built-ins applies to the first realm only; node:vm contexts are
  ordinary JavaScript again, see their own `var`s, and die when unreachable.
  An ended Worker no longer leaves 896 KB behind.
- Where outside data cannot become a declared type in place, it throws instead
  of being copied silently; an object already of another declared type is
  still copied, with a log record.
- A slim closure reached through a virtual call is entered directly
  (1,150 -> 285 instructions a call).
- Built-in calls on a predicted receiver keep their fast path.
- About 2,000 lines of earlier designs that nothing could turn on are removed
  from Structure, JSObject, JSFunction and the collector.
- macOS: the code's pages are mapped executable by dyld, so a hardened runtime
  without entitlements runs. Linux: one mprotect instead of a second mapping.
- B3 MoveConstants and InferSwitches are no longer quadratic.
- Inspector arrays, heap snapshot field names, spyOn under `bun test --aot`.
- Smaller code at no cost in time: frame slots by use, ldp pairs, out-of-line
  stores, shared arms.
- The run time of the compiler from bytecode is gone: the short form of
  FunctionExecutable (24 bytes in every executable, one JSType), three stubs,
  VM::bytecodeGenerationOptions, findCalleeCode(), unlinked functions in the
  program data; eight files are main's text again. A lattice of types nothing
  used and a heap census go too.
- Plain builds: sizeof(Structure) is 112 again, StackFrame 32; the stack
  visitor's read functions are templates whose plain form is main's text.
- Compiles and links on Windows x64, Linux arm64, musl and macOS x64.
- A heap snapshot of a program with many layouts no longer reads the typed
  data's header as a layout (SIGSEGV).
- The lock on built-ins: an heir does not store over what the language itself
  makes read-only; what the lock alone refuses is loud in sloppy code;
  Reflect.* answers false.
- `--aot-type-errors=log`: an object that does not fit goes on and is logged.
- Linux executables carry symbols and unwind information; the crash panel
  names compiled frames; a perf map on request.
- A try around very many statements, huge switches, huge flat functions:
  seven quadratic passes made linear; images unchanged.
- Spreads, Array.entries() in for-of, Map.get/Set.has by key type, calls of
  async closures: fast paths kept or regained.
…leanup

- Plain code that imports from the compiled program reads through to the
  compiled variable (JSScope, JSModuleEnvironment, JSModuleNamespaceObject,
  SyntheticModuleRecord); plain module reads are unchanged.
- A literal of constants with 4,096 leaves or more at the top of an untyped
  module is JSON text and one parse; a frame too large for the image is a
  sentence instead of a trap; long chains of concatenations are not fused
  into one.
- The lock on built-ins in sloppy code: what the lock alone refuses is loud,
  every Reflect.* answers false, a delete asks for itself.
- Spreads in cold text have a stub; eight *KnownArray built-ins and the rest
  of the first design's tables are gone.
- Names for debuggers and profilers in a Mach-O executable.
- The position of `throw new Error()` without taking the stack eagerly.
- --aot-audit: what carries the audit's tag passes in line.
- Build time: an index of who uses a value; allocation sinking without five
  walks over all candidates; on ARM64 a constant serves one stretch of a very
  large procedure.
…testb3

- JSON.parse makes objects with every member in line (up to 62); a literal is
  finished with every property at its end; conversion plans ask the record's
  own size.
- A record of another layout and a plain object are read by name through a
  type that accepts outside objects.
- Whoever calls by value checks the stack, so functions with a general entry
  and the entries themselves no longer check in their prologue.
- Slow paths: shared argument thunks for more operations, hole and string
  tests, regular expressions' prologues.
- The image step frees the program as read, function by function, and gives
  pages back between stages.
- Error.captureStackTrace keeps `stack` not enumerable on typed records.
- testb3 and the other engine test programs run on this branch again;
  testb3_bun.cpp holds the cases for the opcodes this branch adds.
…aller code

- Reads, stores and method calls by name go through one table per Structure and a stub per name; more than half of the read sites are 12 bytes or less.
- Guards on arrays are checked once where the array is made or enters, not at each use.
- `switch` over a union is a jump table again.
- Spreads, rest parameters and destructuring without intermediate arrays.
- One copy of the shared stubs in the middle of a large ARM64 image instead of two.
- Compiled regular expressions share their class tables.
- B3: integer paths are separated early, register copies are forwarded in Air, values live in an arena, and functions are compiled in cohorts.
- Typed objects answer getOwnPropertyDescriptor, `in`, Object.entries and deep equality without being turned into plain objects.
- A prototype changed on a typed object is honoured per object.
- Fewer stack checks, smaller frames and smaller slow paths.
- Validation of type facts can be built into a whole program.
Brings the branch up to main at b1e30d0, which includes the upgrade to
upstream WebKit. Also in this commit, the ahead-of-time compilation work
since the last commit:

- Each Worker gets its own 32 GB heap range. Under a limited address space
  the large reservations share one budget, and later heaps share the first
  range.
- JSON.stringify and Response.json are compiled per record type, including
  Date members, lists, and records that hold untyped values.
- Code made at run time with `new Function` runs faster in the interpreter:
  warm functions are decoded once, and typed objects, accessors and array
  literals take cached paths.
- Closures keep only the captured variables they can reach.
- A method that instances assign to gets a field in the layout.
- An object of an open class gives up its layout per object, as a record does.
- A store by name that reaches a setter of a typed class is cached.
- Property tables: shared stubs per name, entries that no longer evict live
  ones, cheaper `in`, hasOwnProperty, for-in after a delete, computed keys
  and Object.fromEntries.
- Frozen arrays stay in place; symbols as property names are constants.
- Regular expressions: no give-ups to the byte-code interpreter at run time,
  and a wrong capture for an optional empty group is fixed.
- B3: resetReachability() refreshes value owners, barriers made Nops are not
  decorated, and the optimizer's queue hands out small functions in batches.
- The engine builds and runs the test programs with assertions, with
  exception-check validation, as a Debug build and with AddressSanitizer.
  Fixes found that way: a Structure kept alive across an allocation, a strict
  store to an accessor without a setter, operations that forward to another
  operation from C++.
…keep their fast version

Work on ahead-of-time compilation since the merge of main.

Property access by name:
- A name's column in the lookup table is the name itself, so two names of one
  object can no longer collide and leave one of them on the slow path.
  Identifiers are numbered by the sites that use the table.
- Own and inherited properties stored far out of line have entries.
- A new row is placed where rows of similar objects have room, which makes
  the first access of a property cheaper.
- A store that replaces a property is cached on objects that others inherit
  from, including static fields of an extended class.
- Reading a property that an Error lacks, and `in` on an Error, are cached.
- A function is not marked as a possible prototype until something inherits
  from it. Adding a property to a function used to discard what the table
  knew under that name.
- Symbols made at the top of a CommonJS module are constant names unless the
  module has failed to load once.

Typed code:
- Bun.parse<T>() runs a parser emitted for T that fills the laid-out objects
  directly and falls back to JSON.parse plus validation when in doubt.
  Bun.validate, Bun.safeValidate and Bun.schema are compiled from the type.
- A spread of a record with one layout is copied inside the allocation stub.
  A spread into a wider type no longer evicts its one cache slot when records
  with and without an optional field reach the same site.
- An array literal of numbers is made by one stub call.
- Whether a field may be absent is decided by the type the access goes
  through, not by every type that shares the slot.
- A const filled by `new` keeps the type of what was made.
- A length read from an object that is only expected to be a typed array is
  compared on each path out of its check.
- filter(Boolean), map(Number) and similar calls with built-in callbacks are
  lowered in place.
- A BigInt literal is made once and kept.
- WebAssembly modules known at build time have their code in the image.

Loops and B3:
- `i < a.length` in untyped code is compared as integers.
- An int32 addition in a loop is an add and an overflow branch.
- A rare path out of a versioned loop runs the rest of that iteration in a
  copy and returns to the fast version instead of leaving it for good.
- Several compile-time blowups on very large functions are gone.

Fixes:
- DFG: with built-ins locked, an array that becomes a derived array and an
  instance of a class that extends Array no longer contradict the abstract
  interpreter.
- Memory faults found by stressing young collections, and a typed array that
  lost its buffer after a fifth property under a computed key.
- Values that satisfy their declared type are no longer refused in several
  cases involving Promise, ArrayBuffer, Error and casts.
- `"use strict"` is recognized only in its exact spellings.
…ting, JIT fixes

Names:
- About 7,000 identifiers in aot/ and in this branch's additions to runtime/,
  heap/, bytecode/, b3/ and assembler/ are renamed to ordinary engine
  vocabulary, and about 3,000 comment lines are deleted. The IR dump and 34
  messages are reworded. AOTLockWords.h is now AOTLockedOperation.h.

Typed code:
- Unused parameters have no check at the generic entrypoint and are not
  passed. String and object checks there are half the size.
- JSON.stringify of a typed literal is written from the values it was made
  with, and the literal is allocated only on the fallback. Members that are
  the constant undefined are dropped at compile time.
- `typeof x === "number"` on an optional number no longer boxes it. Reads of
  optional fields skip a normalization that the next test does not look at.
- A spread's fast path no longer loads strings that only its slow path reads.
- An empty array literal of numbers is one stub call.
- Stores to compact number slots are shorter.

JSON, dates and numbers:
- The parser emitted for Bun.parse<T>() parses integers inline, reads 16-bit
  text without converting it to UTF-8, and frees a large scan buffer at the
  next collection. A catch scope is declared before the generic parse.
- A Date no longer sends JSON.stringify to the generic writer, in the
  per-type writer and in FastStringifier when Date.prototype is locked.
  toISOString is one operation. A 16-bit string no longer fails the part of a
  typed JSON.stringify that is handed to the runtime.
- Intl.DateTimeFormat and Intl.NumberFormat with a constant locale and
  constant options format from a pattern in the image: Gregorian calendar,
  Latin digits, UTC or a fixed offset. Everything else goes to ICU.

Property access by name:
- A lookup table row is 16 bytes. Sibling rows are placed side by side and
  never copied. A read miss tries the ordinary-object lookup first.
- A keyed read that the by-name cache could answer reaches the keyed table
  again, so the same key on the same shape stays on the short path.
- The first named property stored to an array is cached.

Calls and loops:
- The generic entrypoint of a function that returns nothing jumps to it.
- A loop returns to its fast version at the header after a cloned slow path. A
  loop whose test never changes gets no fast version. Typed loops with a
  guard on their element poll once in 65,536 iterations.
- Declared int32 arithmetic stays integer.

JIT:
- The DFG's abstract interpreter no longer claims an Array for Construct of a
  class that extends Array when built-ins are locked. Freezing an array in
  place fires the old structure's transition watchpoint.
- HasOwnProperty in a for-in over a string constant no longer reaches
  Unreachable in the FTL. A string switch does not trust a substring's 8-bit
  flag after its base became 16-bit. An out-of-bounds store of a Number into a
  BigInt64Array throws. Each has a test in JSTests/stress.
…er generators

Build and tests:
- AOTTypedVerifier.cpp includes <wtf/text/MakeString.h>. All six Windows lanes
  stopped there.
- Four stress tests (immutable-intrinsics, immutable-properties-*) expected a
  write or delete refused by makePropertiesImmutable() to be ignored in sloppy
  code. It throws in both modes, so they now expect the TypeError.

Fixes:
- The cached in-place conversion of a plain object remembered the cell size of
  the first object it converted, keyed by StructureID. Objects of one Structure
  can lie in cells of two sizes, so a smaller cell could be written past its
  end. It now uses the object's own cell size. The cached path also takes
  properties that hold objects, arrays and functions, which halves the cost of
  a conversion.
- Object.setPrototypeOf() on a typed record cleared every prototype-dependent
  entry of the by-name table. It now invalidates only if the object may itself
  be a prototype, as JSObject::setPrototypeDirect() does.
- Locking the properties of a lazily created built-in class no longer clears
  the by-name table.
- `{ ...o, 1: v }`, `{ ...record, ...dictionary }` and a crash in
  placeVariables(), all found by the fuzzers.
- A function that ends in g.apply(thisArg, list) with a list that is not an
  array no longer crashes when g throws into a caller that is not compiled.

Typed code:
- Generators: next(), yield* and for-of over a generator that arrives as a
  value take a third to a quarter of the instructions.
- Members keyed by a module-level `const k = Symbol()` are fields of the layout.
- An object literal with a computed key the type lacks is born typed.
- A literal that leaves most members unset fills them in chunks.
- super() and `new` of a global constructor drop inline paths that cannot be
  taken.
- Text columns whose declared type is a union of string literals are decoded by
  comparing bytes.

Compile time:
- Flatter data in B3 and Air (Phi children, sparse collections, stackmap
  parameters) and fewer passes over a procedure.
…smaller code outside hot functions

- WeakSetInlines.h includes HeapCellInlines.h. The Windows ASAN lane stopped on
  -Wundefined-inline there.
- Revert the marking solver change that passed over a GreyedByExecution
  constraint while the mutator's execution version stood still. The fast path
  of Heap::acquireAccess() does not move that version, so a root could stay
  unmarked. The wasm tests under the GC verifier caught it.
- Take the DFG fix from the fork's main, with its test.
- One question about hot code replaces four, and a loop no longer changes the
  code outside it.
- Fixes to by-name reads of fields that were never stored, to typed object
  conversion, and to generators.
…side hot functions

- Rename a local named small: the Windows SDK defines it as a macro.
- instanceof with many classes no longer goes to C++ for each test.
- Code no loop calls shares one fast body per signature.
- Reads of a declared field nothing stored to stay out of the runtime.
- Fixes to generic types that grow several ways, casts to non-primitive
  types, and per-file tsconfig handling.
…uarded calls

- Windows x64 keeps no chain of frame pointers, so the walk from a native frame
  to its compiled caller goes through RtlVirtualUnwind.
- The image's build stamp has a Windows case.
- Calls through a function field share one guarded body per target.
- instanceof keeps its one-class fast path.
- Small integers are written to JSON from a table of digit pairs.
- A literal field whose name starts with a digit is born undefined, not empty.
- AOTTypedObject.cpp named a variable that a rename had removed.
- AOTTypedBuiltins.h includes AOTTypedBuiltinLists.h, which was not in the list
  of private framework headers, so a prebuilt WebKit could not be compiled
  against.
- The error for a store to a locked host prototype names the class and says to
  use a subclass or a wrapper.
…hey are safe, fixes

- mimalloc no longer deletes its pthread key at exit. A thread that started
  late stored into the deleted key, which another library could have been given
  by then; jsc died in glibc's mutex code in very short processes.
- RegExps whose text is only known at run time run on a flat program instead of
  the Yarr interpreter: lookahead, repeated and counted groups, simple
  back-references.
- A string buffer region is never nested in another. A stale mark left a later
  string starting with an earlier call's leftovers, and two interleaved regions
  could stop a build.
- Growing the side storage of a typed object copies from its first slot.
- ARM64 stubs check for FJCVTZS before using it.
- The first pages are reserved where mmap_min_addr is low.
- `instanceof` on an untyped object against a known class stays out of C++.
… x86-64

An operation's front end is entered under the C calling convention. This one
used two stub temporaries that are rdi and r12 there, so r12, which is
callee-saved, was overwritten.
…matcher

- A comparison of a widened string-literal-union field looked through the
  upcast to a placeholder and folded to false.
- A typed object used as a prototype no longer sends every inherited read,
  call and first store on its heirs to C++.
- The flat RegExp program is built only when the RegExp JIT is off: a failed
  JIT compile leaves the pattern reordered.
- A back-reference at the head of a group no longer hides a match; compiling a
  very long pattern is linear again.
- The placement check counts the bit sets of instanceof tests.
- Spreading an instance of a class, `delete` of an optional field and `%` with
  large or negative operands stay out of C++.
- A mismatch between front end and engine prints both sides' numbers.
- A pointer to a string's characters was kept from a split to a later
  Number() or parseInt(); it could dangle once the string was flattened.
- An unmade split, field or match group is made where the lowering asks for it.
- exec and match results are taken apart only where their type is an array or null.
- The RegExp matcher handles every pattern of the fuzzer's grammar.
- `new` through a constructor held in a variable is compiled.
- A call on an abstract class that is never used as a value is direct.
- Sorting by a key compares without calling back.
- ARM64: stubs that convert a double without FJCVTZS name the register they use.
…ixes

- Functions that stand for an import() no longer load every built-in module inline.
- Object.setPrototypeOf on a plain object, String(n), `${n}` and ~n stay out of C++.
- A class with a fixed layout constructed through a value is made in the stub.
- for..of over a user's iterable calls [Symbol.iterator] methods directly.
- A cast leaves a plain object as it is.
- The RegExp matcher: a counted group that is always empty is no loop.
- One symbol-keyed field no longer sends every Reflect.ownKeys to C++.
- At its step limit the flat RegExp matcher hands the pattern and the subject to
  Yarr's interpreter; optional pieces are bounded by what must follow them.
- import() functions load what the entry points have not, through one shared call.
- A copy made with Object.assign(Object.create(Object.getPrototypeOf(x)), x) keeps its layout.
- A cast converts a plain object again.
- Templates stored into an array inside a loop are built flat.
- A global read in rare code uses the value in its cache.
- abort() on Windows prints a crash report that names compiled functions.
- stress/sampling-profiler-line-column.js is skipped in one mode (see BUN-TEST-DIFFERENCES.md).
…s keys

- The collector's fast visitor of typed objects wrote the whole byte that holds
  a structure's marking stamp and its flags; it keeps the flags now.
- instanceof asks the structure whether a typed record's prototype was replaced.
- A generator of one module graph that is stepped from another runs with its
  own instance.
- JSON.parse without a reviver learns the shapes it meets at a place and expects
  their keys.
- A store of a lazily made closure fills its site's own cache slot.
- A class's own prototype may gain members where the program names it.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings marked 🟡 are optional suggestions and need no follow-up push.

…ether two reads are one

- A loop that copies, fills or combines the elements of typed arrays one by one runs on vectors behind tests at its entry, with the loop as written for what is left over. The x86-64 assembler has the instructions it needs.
- Whether two reads of one place in a written-out loop are one read is decided by the numbering of memory alone. The reads of a loop's bound that are taken for one are noted for the check of moved loads.
- Range checks of a * counter + b also leave a loop where the index is reduced by a mask or a remainder.
- Listing, storing and deleting the keys of an object with many keys: the keys go from the table into the list directly, and a store or a delete looks the table up twice.
- The instructions of a build are linear in the number of fields of a class.
- `Object.hasOwn`, `hasOwnProperty` and `getOwnPropertyDescriptor` on a proxy made in sight call the trap of its handler directly.
- A computed key that may be one of more than 32 names is any name to the analysis, so an object wrapped key by key costs it a fixed amount.
- The accessors and functions that a program puts on `process` are followed where a statement imports node:process.
- A handler for a slot is in an image only where a stub that jumps through its table is.
- The destroy function of ten kinds of Intl objects is removable with the feature that creates them.
- Who asks how much address space is left says what an answer that cannot be counted means: the whole limit for a request of its own, nothing for what is kept aside for others.
- What is kept aside is renewed out of the allocator's arenas, and its state lies in the allocator's record of the thread.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still open from earlier reviews (1):

  • Unresolved: 1 minor or pre-existing.

…erns made at run time remember a search by what a reference can still read

- A call into the run time writes the caches of call sites unless its own declaration says that it writes nothing of the run time's state. No part of a cache is read ahead of a loop in which a call may fill it anew.
- Loops over typed arrays do not run on vectors: the policy leaves the pass off. The pass itself asks how hot a loop is, leaves 64-bit words alone, walks falling and meeting counters, and is smaller.
- A pattern made at run time: a search that found nothing is remembered by the bounds that a reference can still read from there, and a run without an upper bound remembers where its whole rest found nothing.
- SinkAllocations no longer binds every guard of a layout to the object that it builds late.
- The handlers of slots are in every image again.
- In a release build the sources of aot/ trap where a check of libstdc++ does not hold, whichever version of the library they are compiled against. A Release lane for glibc looks at the archive for it.
- JSON.stringify reserves what a long string needs where the string stands in the middle of a list or ends in an escape.
- Objects with many keys: a name that the program does not spell asks for its number once, and a key that is used for properties alone is made a name at once.
- A walk over a generator that is written out leaves the reads of next, return and throw where the keys of the generator's prototype are listed. JSON.stringify takes its short way for a Date once Date.prototype has the three members that the long way reads.
- A file that runs ahead of the loader and calls import() finds the loader where `bun run` has it. An import() below a require() finds a CommonJS file that the required graph has just asked for.
- Exports that nobody reads are removed a second time in front of CallModules, and a file with nothing to run keeps no body.
- Live ranges are split around the frame of a loop only where that pays.
- Range checks of a * counter + b leave a loop by less code of the compiler. The output is the same.
- A cacheable dictionary that is made flat is reported to no cache of names.
- The message for `return f.call(..)` and `return f.apply(..)` on what cannot be called names the callee.
- A wrapper keeps the summary of effects that its function had.
- A proxy that is asked under an integer hands its trap the text of it.
- The message for a library module that is not found is what it was.
- Under a limit on address space the allocator tells the keeper of what is kept aside who takes fresh small pages, and a store of the program gets its RangeError ahead of the operation.
- The check of moved loads follows a load into the copies of a loop.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the latest push and found no new bugs; the earlier vectorization concern looks addressed since AOTB3Policy.cpp no longer enables the loop vectorization pass for any target. Given this is an ~88k-line change across the AOT compiler, B3, heap and allocator, a human look is still worthwhile.

What was reviewed:

  • Latest commit (call-site cache effects, run-time regexp failed-search memory, SinkAllocations guard binding, JSON.stringify reservation, module loader import()/require() paths).
  • Candidate ruled out: StackTrace.cpp freeSymbols releasing backtrace_symbols memory via dlsym(RTLD_DEFAULT, "free") under ASan — the resolved free matches the interposed malloc backtrace_symbols used, so no bad-free.
Extended reasoning...

The diff spans 1380 files and roughly 88k insertions, adding an ahead-of-time compiler (Source/JavaScriptCore/aot), changes to B3, Yarr, the GC heap and address-space budgeting, bmalloc, and module loading. It touches memory-safety-sensitive surfaces (JIT codegen, allocator and cage logic, stack trace symbol freeing) but no auth, crypto, or injection surface. The bug hunt ran dry this round with no findings, and the latest commit removed the vectorization policy that the prior review flagged. The size and the memory-safety-critical nature of the code rule out approval; the conversation history is also marked incomplete, so unaddressed third-party objections cannot be excluded.

… property may change, and the front of a loop's version names values of copied blocks

- SinkAllocations makes an object of a constructor function, whose prototype property flow does not call fixed, in front of whatever may end the member guards of its layout or run other code.
- The front of a fast version of a loop may name a value of a block that another version copies. Such a value gets a variable, from the maker that demoteValues() uses.
- A call writes the caches of call sites where its operation has a cache, where it writes what a lookup may come by, or where it calls a function of the program. A host function goes by its row in the table of built-ins, so a call that only reads leaves a loop again.
- A pattern made at run time: the walk over what is reached on one way visits each operation once, and a greedy run that found nothing enters only the places below what is entered.
- What JSON.stringify reserves ahead is room in the buffer, and only what it says is text is held against the longest string. A typed list whose short strings need an escape is written into the first reservation.
- The finished list of Reflect.ownKeys and Object.getOwnPropertyNames is kept where a symbol stands beside the fields, in the cache that every collection clears.
- A field that is created on an object with a property beside its fields finds its step of the key order.
- A class finds a static field by an index, and the ledger finds its variables by object and key, so a build is linear in the number of static fields of a class.
- Flow: what a function returns that the program laid on a holder of exports comes back to a call by name whose callee nobody knows. Only a read that is called asks for a lookup of its own. The predecessors of retired nodes are connected on all threads.
- A guard and a position meet edge by edge.
- The check of moved loads follows an entry through demoted values, and keeps its entries where code that nothing leads to is deleted.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

…ds, and native code polls where it enters compiled code

- SinkAllocations: an allocation that is handed its prototype as an operand is built where it stands.
- The adapters from native code into compiled code, and the stub that puts a saved frame back on the stack, compare with the stack limit that a request to the thread lowers, and poll out of line. What waits at an await does not go on once its thread was asked to end.
- Flow: a built-in that keeps a value which nobody follows carries it out, so what Promise combinators, AbortSignal.abort().reason, SuppressedError, a stream's chunks and a rejected or thrown value hand back keeps its members.
- Flow: a set of more than 64 members is tested for a watcher's member, not chained. Helpers that are imported from another file are copied for each file that calls them.
- A read of a locked data property whose answer the build knows stays as an initialization where the keys of its holder may be listed. A first read goes by the name that is read.
- What is written out for Object.hasOwn and hasOwnProperty on a proxy stands in an inline frame of that built-in.
- The own keys of an object without a symbol are looked for in the first list first. A field that is created in a layout whose keys nobody lists looks no step of the key order up.
- `i < n` with n: number: the counter is followed through what the branch on the comparison hands on, and the bound is tested ahead of the loop.
- handGraphToLoader() and appendJSONTextOfProperty() look at their scope behind the last call that can throw.
- A build is linear in the try blocks, loops, yields, cases, parameters and operands of `||` of one function: B3's induction records are found by their value, PlaceTypeTests asks the counters of one loop, and WTF::NaturalLoops finds a loop by its header.
- The walk that builds objects ahead of a change of a constructor function's prototype returns at once where no family of the function may take one, and passes cells and other families.
- The rounds of flow analysis: watchers, waves, edges into lists and long lists run in shares on all threads. The output is the same.
- A pattern made at run time: runs of under eight units are not marked.
- The verifier of modules finds what a function mentions by the schema's walkers. The check of moved loads holds the slots of call sites to the tighter form.
- The jsc shell gives import.meta, module and require each function of the table of built-ins that it lacks. Such a function says which one is missing when it is called.
…efines

- `near` is a macro in the headers of Windows. The iterator over the jumps in reach of a rare branch is named inReach.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

…ot handed out again, and one rule orders unbuilt objects with member guards

- JSON.parse into a typed shape: an entry of the table of learned objects has one writer at a time, at any depth of nesting; where none is free the inner object is parsed without being learned. A learn that gives up leaves its entry refused. No object is built from an entry without a plan.
- SinkAllocations: one function decides where an unbuilt object is built: in front of whatever may end the member guards of its class or runs other code, and, for an object that is handed its prototype, also in front of whatever reads those guards. It replaces the rule that such an object is never virtual; four tests have their earlier text again.
- Flow: the promise of an import() is also rejected with what the loader throws. A copy of an object's own properties lists its records when all else is at rest, so the graph of functions that each copy what they are given grows linearly. A wave's task asks ahead for the rows, messages, values and marks it is about to read.
- A module that is linked stays linked, however the link step ends.
- A thread tells the run time when it has started; the room that is kept for the next VM follows what a started VM of this process has taken.
- Emitters in codegen, builtins, passes, ir, place and image append their values in the order written, whatever order the host compiler evaluates arguments in. eliminateRedundantReads() runs its three steps as statements.
- The IR test runner knows the word `windows` in REQUIRES.
- Native tests: a termination that is requested ahead of an entry from native code, with 0, 1, 9 and 300 arguments, a class and a resumed async function; a thread that takes small pages.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

…ounted loop polls for termination, and loops over typed arrays run on vectors

- Module variables: DeferInitializers records a variable that a deferred initializer reads as read, so RemoveUnreadExports keeps its store.
- Loops: a counted loop polls for a requested termination once per stretch of turns; unrollLoops also runs in functions without warm code and ignores blocks behind decided comparisons; a loop that its data ends after a few turns keeps its poll in the turn. The poll does not count as a write of the run time's state; a stub or operation that may collect counts as changing the slots of by-name sites.
- B3: VectorizeLoops turns counted loops over typed arrays into vector loops (copy, scale, mean of neighbors, reverse in place); two counters that meet are tested against one limit.
- Fields: a number field whose writers store more than an int32 keeps the type it had before narrowing; a field that is added to, indexes or takes part in a bit operation stays an integer until a fraction is stored.
- Classes: an unused class leaves the look at its heritage behind unless the heritage is proven; EliminateDeadCode removes that look where the type rules a throw out. Below a constructor function whose prototype property is not fixed, the prototype link of a class is a condition at run time. SinkAllocations follows objects of constructor functions; a copy of own properties runs its rule before it looks at its source. Fields that tsc defines with Object.defineProperty are fields of the layout.
- Objects: getOwnPropertyNames() asks whether the list is empty after the index keys are in. A fast copy of extra properties follows checkStructureForClone, refuses a Structure with private names and takes the Structure in front of PreventExtensions, Seal or Freeze. The JSON serializer asks what a slot holds, markers included.
- Calls: a forwarded apply() tells its list from its receiver by the operand's position. Only callable built-ins join a function type; the type of a well-known symbol is symbol.
- Flow: built-ins that let in unseen code stand behind the unknown object in the heap once they have escaped, and share a few records per cause. One readLength() serves keys, values and entries; escaped iterators are chosen by what they were allocated as; opening an iterator reads next. A read under an unknown key of an unknown value counts a host prototype's accessors as read. Tables made once replace walks over all modules for each name given to a bundler's require.
- Modules: require() of a module whose load an import() has begun loads its root once more where that load is still pending.
- Workers: a new thread's reservation leaves room while other threads are ending.
- Errors: making an Error takes fewer steps. A string past the longest length throws. The frame's size is tested before the frame is written.
- The compiler: its own sort, shared walks and tables in place of repeated template instances. Dominators numbers a backwards graph without making a list of successors at each step.
- Checking builds: --aot-check=DecidedComparisons compares again what versionLoops, unrollLoops and foldComparisonsWithBounds decided; the log of moved loads follows joined blocks. The validating mode keeps its state behind one thread-local pointer.
- Windows: tail calls are marked musttail; three IR tests have lines for Windows x64.
- Tests: IR, native and testb3 cases for each of the above.
…leave their poll to a copy, and an import() under a require() keeps its own queue

- B3VectorizeLoops.cpp includes AllowMacroScratchRegisterUsage.h itself.
- unrollLoops: a loop and its polling copy may both hold blocks behind a rare edge that come back into the loop, and a fast version whose estimate one branch in front has halved still counts as warm for this question. A loop that its data ends after a few turns keeps its poll in the turn.
- Modules: an import() that began outside a require() is not handed to the loader while that require()'s synchronous queue is active. A root that is evaluated with its own stack has its top-level capability set first, so an import() of the running module settles.
…orded

- DeferInitializers records a variable that a deferred initializer reads as read, so RemoveUnreadExports keeps its store.
- Everything else is as in bdb594b. The changes of 4dc7fd9 and 57fcf6e are taken out here and follow in a pull request of their own.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

@robobun

robobun commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Three flow results change with the order of the rules on main (191c6a4). This PR fixes the first one. The other two are also in the testaot of this PR (bdb594b).

I found them from the TODO line that #923 adds to accessor-laid-on-an-object-that-has-escaped-is-an-indirect-call-with-all-flow-rules-delayed.ir. The two switches reach three schedules. For more schedules I read the seed of letSomeDueStatementsWait() from an environment variable in a local build of main. The seed counts below are from that build. Each case also fails with a released testaot.

1. An object that escapes alone shares its nodes with letAnythingHappenTo() (fixed here)

  • Reproduction on main: the -with-all-flow-rules-delayed.ir file with # OPTIONS: testing=DelayOtherFlowRules fails with nothing from output line 3 on matches: indirect f0 {{*}} -> f1 Accessor Once. On Upgrade to upstream WebKit e8f704815e94 #923 the file with both switches fails in the same way, because the upstream merge renumbers the statements.
  • Cause: the Escape statement runs when table is the only new member of escaped. letAnythingHappenTo() writes through {table}, and so does Object.defineProperty(table, ..). The node written({table}, GetterUnderUnknownKey) then holds the getter and the unknown object. The getter has escaped, so leaveOutWhatIsCoveredInTheEnd() removes it, and Table gets no accessor field member.
  • 3704a06 and 8d293fd keep the two writers apart. main with only that hunk: 1000 of 1000 seeds print the same valueflow-results. Without it, 199 of 1000 seeds lose the indirect line.
  • The folder has 24 -with-flow-rules-delayed.ir files, 24 -with-all-flow-rules-delayed.ir files and 23 -with-other-flow-rules-delayed.ir files. The missing one is for this program: the -with-all- file with # OPTIONS: testing=DelayOtherFlowRules. It fails on main and passes with this PR.

2. The heap index reads written nodes that are at rest (not fixed)

  • Reproduction without a switch, with the testaot of main and of this PR: the program in the first block below. It is store-written-for-the-instances-lists-no-member-of-the-prototype-object.ir with the call made on the prototype object itself. The result lists size in namedMembers and says prototypeNamesAreComplete=true.
  • On main 83 of 151 seeds give that answer for this program, and 68 list nothing. The test that is in the folder changes its answer for 10 of 301 seeds.
  • Cause: the store this.size = 0 first runs when this holds one of its two receivers. It asks for written({that receiver}, size). When the other receiver arrives, the store asks for written({both}, size), and letGoOf() puts the first node to rest. ValueFlowHeapIndex::collectNodesWritten() still reads the first node. If its receiver is the prototype object, the ledger files a write into the prototype object alone. listAssignedMembers() then lists the name.
  • A node at rest ignores arrivals, so it does not hold what its statement writes now. With the change in the second block, 151 of 151 seeds list nothing for both programs. testaot all gives the same counts with and without the change.

3. copyProperties() records a source only if it runs before the unknown object arrives (not fixed)

  • Reproduction with the testaot of main and of this PR: a-literal-gets-fields-for-what-a-spread-source-that-unknown-code-holds-is-born-with.ir with the ten lines of the third block in front of the Return of main. It passes with no switch, with DelayOtherFlowRules and with both. With testing=DelayFlowRules the layout Copy gets no fields a and b. The test as it is fails for 13 of 121 seeds.
  • Cause: copyProperties() adds known(sources) to written(targets, CopiedFrom). A rule does not see a member that the unknown object covers, and source has escaped. So the rule sees source only in a run after copy(source) arrives at the parameter and before copy(unknown()) does. In the failing schedules there is no such run, and the node stays empty.
Program for 2
# function Point() { this.size = 0 }; Point.prototype.count = 1; Point.prototype.reset = Point; new Point(); Point.call(Point.prototype)
# RUN: valueflow-apply
# CHECK: layout L0 kind=Instance name="Point" {{*}}namedMembers=[{key="count"}, {key="reset" function=f1}]}

module m0 path="main.js" displayPath="main.js" body=f0
entry module=m0
layout L0 kind=Instance name="Point" constructor=f1 fields=[{key="size" declared={type=anything}}] flags=[IsConstructorFunction]
variable g0 name="Point" module=m0 declared={type=function flags=[IsFromCompiler]} initialization=Function function=f1 flags=[IsImmutable]
function f0 name="main" kind=Module results=[{type=anything}] {
    v0 = GetModuleVariable variable=g0
    v1 = PropGet v0 key="prototype"
    v2 = Integer integer=1
    PropSet v1, v2 key="count" mode=Strict
    PropSet v1, v0 key="reset" mode=Strict
    v5 = Construct v0
    v6 = Call v0, v1
    Return
}
function f1 name="Point" flags=[HasThis] thisType={type=L0 flags=[IsExpected]} results=[{type=anything}] {
  b0(v0: anything):
    v1 = Integer
    PropSet v0, v1 key="size" mode=Strict
    Return
}
Change tried for 2, in ValueFlowHeapIndex::collectNodesWritten()
            case ValueFlowMadeNodeKind::Written:
                if (solver.graph().isAtRest(node))
                    break;
Lines for 3, in front of the Return of main
    v20 = Builtin builtin=GlobalThis
    v21 = PropGet v20 key="padding" [isFreeName]
    v22 = PropGet v20 key="padding" [isFreeName]
    v23 = PropGet v20 key="padding" [isFreeName]
    v24 = PropGet v20 key="padding" [isFreeName]
    v25 = PropGet v20 key="padding" [isFreeName]
    v26 = PropGet v20 key="padding" [isFreeName]
    v27 = PropGet v20 key="padding" [isFreeName]
    v28 = PropGet v20 key="padding" [isFreeName]
    v29 = PropGet v20 key="padding" [isFreeName]

@Jarred-Sumner
Jarred-Sumner merged commit fcc1ea0 into main Oct 27, 2026
87 checks passed
Jarred-Sumner added a commit to oven-sh/bun that referenced this pull request Oct 28, 2026
Pins `WEBKIT_VERSION` to oven-sh/WebKit `main` at fcc1ea0973a4
(oven-sh/WebKit#914).

#45631 was merged on the preview build of that pull request. This is the
same source, built from `main`.
robobun added a commit that referenced this pull request Oct 28, 2026
main got #914 (fcc1ea0) after this branch was cut.

Dockerfile is the one conflict. Both sides added a check behind the check of
the glibc floor, and both are kept: jsc needs no version of glibc that is
not a number, and in a Release build the sources of aot/ do not call
__glibcxx_assert_fail.

aot/tests/valueflow/results/accessor-laid-on-an-object-that-has-escaped-is-an-indirect-call-with-all-flow-rules-delayed.ir
loses the TODO line of 877c88a. #914 has the repair of the solver, and
with it the test passes on this branch with both switches.

aot/tests/codegen/collections-and-built-ins/array-for-each-with-an-arrow.ir
and array-reduce-with-an-arrow.ir are new in #914 and name the runtime
functions 44 and 82. Here forEach is 43 and reduce is 81, as in d23596b.
No other file of #914 names a runtime function above 23.

Twelve more files changed on both sides, and git merged them:
JavaScriptCore/CMakeLists.txt, Sources.txt, heap/Collector.cpp,
heap/Heap.{cpp,h}, interpreter/Interpreter.cpp, jsc.cpp, runtime/VM.{cpp,h},
yarr/YarrJIT.cpp, aot/builtins/AOTBuiltinArrayOperations.cpp and
JSTests/BUN-TEST-DIFFERENCES.md. In Heap.cpp #914 adds a collection on the
mutator's thread for when no thread can be made for the collector:
collectInMutatorThreadUntilDone(), called from releaseAccessSlow() and
waitForCollector(), and a check in relinquishConn(). Those are functions
where upstream now asserts the bits of Heap::m_worldState in release
builds. The tests of #914 for that path are in testaot (heap-cage/), which
the test jobs run.

Checked with a Debug build for Linux x64: jsc and testaot compile and link.
The test of the table of built-ins finds no mismatch. The flow test above
and the two renumbered tests pass. No name that upstream removed in this
range is used by the code of #914.
robobun added a commit to oven-sh/bun that referenced this pull request Oct 28, 2026
main got the ahead-of-time compiler (#45631) and WebKit fcc1ea0973a4
(#47125) after this branch was cut.

scripts/build/deps/webkit.ts is the one conflict. WEBKIT_VERSION is the
preview build of oven-sh/WebKit#923 at 0e103663, which has main's WebKit
(oven-sh/WebKit#914) merged into the upstream upgrade.

Upstream deleted one JavaScript builtin of the engine
(defaultAsyncFromAsyncIteratorWithNext, runtime function 23), so every
engine runtime function behind it is one lower. Five tests under
test/aot/engine-tests name such a function by number: every is 30, filter
32, from 46, map 64 and some 88. The numbers of Bun's own functions start at
0x10000 and stay.
Jarred-Sumner added a commit that referenced this pull request Oct 28, 2026
…s, number fields past 32 bits, and fixes (#927)

Follow-up to #914, from the same branch. Almost all of it is under `Source/JavaScriptCore/aot`, which only a build with `ENABLE_AOT` compiles. The last section lists every file outside that folder.

### Changes that reach builds without `ENABLE_AOT`

- **DFG and FTL:** `switch` over a string takes the width of a substring's characters from its base's storage as it is now. `JSTests/stress/switch-string-substring-of-base-widened-by-atomization.js` covers it.
- **Module loader:** a record that is evaluating may be linked and evaluated again where `require()` of an ES module re-enters it. `ModuleRegistryEntry::replaceRecord()` swaps the record of an entry. The queue of a synchronous load stays where the collector finds it, and `VM::synchronousModuleQueue()` says which queue reactions go to.
- **`JSON.stringify`:** takes the width of a string's characters from its storage as it is now.
- **`JSObject`:** `ordinaryGetOwnPropertySlot()` and `hasDirectProperty()` ask an object's class only where its Structure says that absence can't be cached. The fast-path tests of `RegExp.prototype.exec`, `Symbol.species` and `Symbol.isConcatSpreadable`, `calculatedClassName()` and the labels of both heap snapshots use them.
- **Windows, with Bun's additions:** `CRASH()` calls `WTFAbort()`, which first calls the reporter that the embedder sets with `WTFSetAbortReporter()`.
- **WTF:** `Dominators` numbers a backwards graph without building a list of successors at each step.

### B3 and Air

These phases run under the policy that the ahead-of-time compiler sets.

- **`VectorizeLoops`** turns counted loops over typed arrays into vector loops: copy, scale, mean of neighbors, reverse in place, clamp, least, greatest, and sums in integer lanes. Anything a lane can't hold goes to the loop as written. Without AVX, the x86-64 assembler emits the SSE forms.
- **`UnrollLoops`** also runs in functions without warm code. A counted loop polls for a requested termination once per stretch of turns, so `worker.terminate()` ends it.
- **`RegionCloner`, `VersionLoops`, `RotateLoops`:** an end that a copied block computes has its user in the pre-header before values that leave copied blocks are demoted.
- **`MovedLoadCheck`** follows joined blocks.

### The ahead-of-time compiler

- **Flow analysis:** built-ins that let in unseen code share a few records per cause. That an object goes out of sight no longer means that its keys may be listed. A function of the compiler that no record describes is entered only by the calls that statements make. A hub is a kind of node name of its own and no longer shares its numbers with host nodes.
- **Fields:** a number field whose writers store more than an int32 is widened. A field defined on an object follows `DefineOwnProperty` where the object can't grow or the property is read-only.
- **Classes:** a store that leaves another object in a constructor's `prototype` ends the class's guards. An unused class keeps the look at its heritage unless the heritage is proven.
- **Calls:** the inliner judges a typed callee in a loop by the code that is likely to run. `[...arguments]` appends what the arguments object was made of. A forwarded `apply()` tells its list from its receiver by position.
- **Allocation sinking** follows the path that the interpreter would take from the state in front of each value.
- **Property access:** one comparison on a slot's flags sorts a hit at a by-name site four ways. Receivers that are proven objects skip the cell test. A symbol whose holder the library prepares has no name in the by-value stubs.
- **Modules:** `require()` of a module whose `import()` is still pending loads its root once more. Where a statement imports a file as text, an `import()` of it without a type gets the text.
- **Strings:** the string builders, the URL built-ins and the key cache take the width of a rope's piece and of a substring's base from its storage as it is now.
- **Run time:** an operation that throws and does not collect puts collections off. A new thread's reservation leaves room while other threads are ending.
- **The verifier** refuses a read of a variable that is recorded as never read, a store to one that is recorded as never stored to, and an allocation of a layout that is recorded as never allocated.
- **Checking builds:** `--aot-check=DecidedComparisons` compares again what the loop phases decided. With `--aot-validate`, a throw that leaves a call without a site is reported before it is unwound.
- **Windows:** tail calls are marked `musttail`, a counted loop polls with one load on x64, and the native tests map an image's code from its file.
- **Size of the compiler:** its own sort, shared walks and tables replace repeated template instances. `SourcesCompiledForMinimumSize.txt` names sources that take no sample in a profiled build.
- **Tests:** IR, native, testb3 and testair cases for each of the above.

### Every file outside `aot/`

- `JSTests/`: `BUN-TEST-DIFFERENCES.md`
- `JSTests/stress/`: `switch-string-substring-of-base-widened-by-atomization.js`
- `Source/JavaScriptCore/assembler/`: `MacroAssemblerX86_64.cpp`, `MacroAssemblerX86_64.h`, `X86Assembler.h`
- `Source/JavaScriptCore/b3/`: `B3AbstractHeapRepository.cpp`, `B3AbstractHeapRepository.h`, `B3EliminateDeadCode.cpp`, `B3FoldComparisonsWithBounds.cpp`, `B3Generate.cpp`, `B3Limits.h`, `B3LoopInvariance.cpp`, `B3LoopRangeChecks.cpp`, `B3LoopRangeChecks.h`, `B3LoopUtilities.cpp`, `B3LoopUtilities.h`, `B3LowerToAir.cpp`, `B3MoveConstants.cpp`, `B3MovedLoadCheck.cpp`, `B3MovedLoadCheck.h`, `B3PatchpointValue.cpp`, `B3PatchpointValue.h`, `B3Policy.cpp`, `B3Policy.h`, `B3ReduceStrength.cpp`, `B3RegionCloner.cpp`, `B3RotateLoops.cpp`, `B3StackmapSpecial.cpp`, `B3UnrollLoops.cpp`, `B3UnrollLoops.h`, `B3VectorizeLoops.cpp`, `B3VectorizeLoops.h`, `B3VersionLoops.cpp`, `testb3_bun_hoisting.cpp`, `testb3_bun_loop_plans.cpp`, `testb3_bun_strided_range_checks.cpp`, `testb3_bun_unroll_loops.cpp`, `testb3_bun_vectorize_loops.cpp`, `testb3_bun_version_loops.cpp`
- `Source/JavaScriptCore/b3/air/`: `AirFrameStates.cpp`, `AirFrameStates.h`, `AirOptimizePairedLoadStore.cpp`, `AirPolicy.cpp`, `AirPolicy.h`, `AirShrinkWrapFrame.cpp`, `testair_bun.h`, `testair_bun_shrink_wrap.h`
- `Source/JavaScriptCore/dfg/`: `DFGSpeculativeJIT.cpp`
- `Source/JavaScriptCore/ftl/`: `FTLLowerDFGToB3.cpp`
- `Source/JavaScriptCore/heap/`: `AddressSpaceBudget.h`, `BunV8HeapSnapshotBuilder.cpp`, `HeapSnapshotBuilder.cpp`, `ReservedRangeHeap.cpp`, `ReservedRangeHeap.h`
- `Source/JavaScriptCore/interpreter/`: `Interpreter.cpp`
- `Source/JavaScriptCore/llint/`: `LowLevelInterpreterAOT.asm`
- `Source/JavaScriptCore/runtime/`: `ArrayPrototypeInlines.h`, `CyclicModuleRecord.cpp`, `ErrorInstance.cpp`, `JSFunction.cpp`, `JSModuleLoader.cpp`, `JSModuleLoader.h`, `JSONObject.cpp`, `JSObject.cpp`, `JSObject.h`, `JSObjectInlines.h`, `JSPromise.cpp`, `ModuleRegistryEntry.cpp`, `ModuleRegistryEntry.h`, `RegExpPrototypeInlines.h`, `Structure.h`, `VM.h`
- `Source/WTF/wtf/`: `Assertions.cpp`, `Assertions.h`, `BackwardsGraph.h`, `Dominators.h`
- `Source/bmalloc/bmalloc/`: `bmalloc.cpp`
- `Tools/Scripts/aot/`: `check-includes.py`, `check-unified-sources.py`
sosukesuzuki pushed a commit to oven-sh/bun that referenced this pull request Oct 30, 2026
Fixes #44697

### Problem
- Bun's JavaScriptCore is 360 upstream commits behind
WebKit/WebKit@e8f704815e94. 59 touch JavaScriptCore, WTF or bmalloc.
- `RegExp.lastMatch` after a `test()` that matched can end the process:
`panic(main thread): Segmentation fault at address 0x4`.
- Two results are wrong: `Math.sumPrecise([-1])` is
`-1.0000000000000002`, and an async function that awaits itself through
`Promise.all` repeats its frame in `Error.stack`.

### Fix
- `WEBKIT_VERSION` is a7b59e61de2e, the merge commit of
oven-sh/WebKit#923: the engine of `main` plus the upstream merge.
- Upstream deleted one builtin: in `test/aot/engine-tests`, 2,648
builtin numbers are one lower and 19 instance offsets eight bytes lower.
Loop bytecode changes, so `bundler_bytecode_portable.test.ts` has new
snapshots.
- **Two test bounds go up, which needs a maintainer's yes**: the
`--trim` size in `compile-aot-size.test.ts` and the function count of
one program (Notes).
- Verified, local debug build:
`test/js/bun/jsc/webkit-upgrade-e8f704815e.test.ts` (new, 17 cases, Bun
1.4.3-canary fails 4) and
`test/js/bun/jsc/regexp-legacy-static-properties.test.ts` (new, the
panic on Bun 1.4.3-canary). `test/aot/engine-tests` passes with a
release `testaot`.

### Background
- `WEBKIT_VERSION` (`scripts/build/deps/webkit.ts`) names the
oven-sh/WebKit release whose JavaScriptCore the build downloads.
- The ahead-of-time compiler numbers the engine's JavaScript builtins by
name order, and the instance of a compiled program has one word per
link-time constant.

### Downsides
- Size: hello world with `--aot --trim` maps 167,808 bytes more. A
compiled program that calls `Array.from` holds 22 functions, was 6.
- A thread that breaks the collector's stop-the-world protocol now
crashes a release build (Notes).
- The own keys of the `Proxy.revocable` revoke function now start with
`length` and `name`.

<details><summary>Notes</summary>

#### The WebKit side

oven-sh/WebKit#923 merges upstream `e8f704815e94` into the fork. Its
description lists the 16 conflicts and how each one is resolved.

The first CI run of that pull request built every lane and published a
preview release. Its test jobs failed for three reasons. None of them is
in the libraries that Bun links:

- Upstream now links its programs with `-z pack-relative-relocs`
(WebKit/WebKit@c47b7c073c). The `jsc` and `testFFI` programs of the
Linux lanes then need glibc 2.36. The arm64 test runner has glibc 2.35.
- One new upstream test
(`stress/regexp-legacy-static-properties-rematch-failure.js`) cannot
pass in two test modes that only the fork has.
- Upstream deleted one JavaScript builtin. The tests of the
ahead-of-time compiler name builtins by number, and the numbers behind
the deleted one moved.

That pull request has a commit for each of them. After that, the fork's
`main` got oven-sh/WebKit#914, #886 and #926, and Bun's `main` got the
ahead-of-time compiler (#45631) with that WebKit (#47125). Both are
merged in, over there and here.

A review of the merged head found one defect of the merge itself: with
the object loop of `JSON.parse` that upstream rewrote, `Bun.JSONL` could
give an object a Structure that a collection had freed. `bcd362b31e`
over there repairs it and adds a stress test. With the `jsc` of the
build before it, that test ends in `SIGSEGV` in 6 runs of 6.

The fork's `main` then moved three more times, and each time its Bun
side had to be on Bun's `main` before this branch could pin a build with
it:

| oven-sh/WebKit `main` | Bun side | merged into oven-sh/WebKit#923 at |
|---|---|---|
| #927 | #47129 | `be93e08e36` |
| #930 | #47129 | `35b64c4afb` |
| #919, #936 (ICU 79.1), #937 | #47281 | `b67a0b1a3a` |

- `780dc90982` over there turns upstream's fast path for `{ ...fn }` off
in builds with the ahead-of-time compiler (see "What Bun's CI showed").
- oven-sh/WebKit#923 is merged as `a7b59e61de`, and `WEBKIT_VERSION` is
that commit. It has the same tree as `b67a0b1a3a`, the head whose
preview build (`autobuild-preview-pr-923-b67a0b1a`) this branch pinned
before. That is `8c6c963e3c`, which `main` pins since #47281, plus the
upstream merge. The CI of oven-sh/WebKit#923 was green at that head: 84
jobs, with `testFFI`, `TestWTF`, `testaot` and
`run-javascriptcore-tests` on Linux x64 and arm64.
- A build of this branch against an engine whose Bun side is not on
`main` does not work. With the preview of `780dc90982` and `main` before
#47129, the build stopped at
`src/jsc/bindings/BunCompiledModules.cpp:756` (`too few arguments to
function call`, `JSC::AOT::tryReservePagesForNewThread`), and with that
call changed every `bun build --compile --aot` ended with
`IdOutOfRange`.

The release zip sizes of an earlier version of this description compared
builds 133970 and 133646: between -0.15% and +0.12% over the 12 release
zips (`bun-linux-x64.zip` -38,546 bytes).

#### What Bun's CI showed

The head is `e22cf6a525` now. On top of `3688162c4c` it has the pin of
the merge commit, the test for #44697 and one corrected comment. The
engine source is the same as in build 135015.

**Build 135015** ran `3688162c4c`, the head with the answers below. 184
of its 188 jobs passed and none failed: every build, and every test job
on Linux, Windows and macOS on ARM64. The four macOS x64 test jobs had
not started when this was written. No agent of that queue was free, and
three attempts of each job expired after an hour of waiting. Four tests
failed once and passed on a retry or alone (`bun-serve-html.test.ts`,
`no-leak-records-at-exit.test.ts`, `hot.test.ts`,
`process-stdin.test.ts`).

**Build 134977** ran the head before that, with `main` up to #47129 and
the preview of `35b64c4afb`. Three things failed that do not pass on a
retry. `3688162c4c` answers each:

| Test | Failure | Answer |
|---|---|---|
| `test/aot/engine/ir-1`, `ir-3`, `ir-5`, `ir-6` (nine `.ir` files,
Linux x64) | `lower-to-b3: output line 7 does not match: Int64 b@22 =
Load(b@10, offset = 8264, ..); nearest: .. offset = 8256 ..` | The
offsets are written anew (see "The engine tests") |
|
`test/aot/parallel/arrays/searches-folds-and-flat-maps-of-a-list-bring-in-only-the-functions-that-do-them.js`
| `ImageFunctionsEmitted <= 40, but the build counted 42` | The bound is
48. **A maintainer has to agree** |
| `test/bundler/compile-aot-size.test.ts` | hello world with `--trim`
maps 25,777,292 bytes, and the bound is 25,700,000 | The bound is
25,880,000. **A maintainer has to agree** |

Eight more tests failed and passed on a retry or alone
(`plugin-requests-run-ahead.test.ts`, `no-leak-records-at-exit.test.ts`,
`compile-aot-run-time.test.ts`, `43831.test.ts`, `filesink.test.ts`,
`process-stdin.test.ts`, `body.test.ts`, `test-cluster-shared-leak.js`).

**The function count.** The program calls `Array.from({ length: 16 })`
and six array methods. Its executable holds 24 functions with the canary
of `main` and 42 here.

- Upstream's `Array.from` (WebKit/WebKit@37aa2b5bd94d) steps an iterator
by a call of its `next` and closes it by a call of its `return`. The old
text was a `for-of` loop.
- One function of the library runs for every call of `Array.from`, so
the compiler keeps what that call of `next` can reach by name. The 18
more functions are the two helpers `iteratorGenericNext` and
`iteratorGenericClose`, one part of `Array.from` that is moved out of
line, and the `next`, `return` and `throw` of array iterators,
generators, iterator helpers and wrapped iterators.
- A one-line `console.log(Array.from([1, 2, 3], x => x + 1).join())`
holds 22 functions where `main` holds 6. Its bound is 24.
- #47316 expands the two helpers in line in the front end
(its engine half is oven-sh/WebKit#934). A release build of it keeps 25
functions for this program and 7 for the one-line program, so the bound
of 40 holds again once that pull request is on `main`. The bound of 48
is needed only until then.

**The size.** `test/bundler/compile-aot-size.test.ts`, Linux x64 with
glibc. Build 135015 is the commit of the canary plus this upgrade:

| hello world | canary of `main` (`081ace731d`) | build 135015 | bound |
|---|---|---|---|
| `--aot` | 68,138,180 | 68,305,988 | 68,440,000 |
| `--aot --trim` | 25,584,836 | 25,752,644 | 25,700,000, now 25,880,000
|

Both grow by 167,808 bytes. `.text` of `jsc` grows by 143,376 bytes with
the 360 upstream commits. The test says that its bounds only go down, so
this is a maintainer's call. The new bound has about the slack the old
one had (127,356 bytes, it was 115,164). The comment beside it says
183,000 bytes, which was measured on an older commit of `main`. The next
push corrects it to 168,000.

**Earlier runs** (builds 134164 and 134232, before #47129, with the test
names of that time) showed two more causes. Both are answered on the
WebKit side:

- A stack frame after `{ ...fn }`. Bun names a frame by the own property
`name` of the callee first, and by `displayName` after it. A copy that
looks every key up makes `name` a property of a function. Upstream
WebKit/WebKit@e04a6f9faecf copies from a function by its Structure and
leaves `name` alone, and the run time of compiled programs still looks
the keys up. Three programs printed another frame compiled than plain. A
maintainer chose to turn upstream's fast path off in builds with the
ahead-of-time compiler (`780dc90982` of oven-sh/WebKit#923). With a
local debug build of this branch,
`errors/frames-functions-display-name-statement.js`,
`errors/frames-functions-given-display-name-far.mjs` and
`errors/names-frames-new-function-objects-names.mjs` print the same
compiled and plain. The cost: `{ ...fn }` does not get upstream's
speedup (160 ms against 50 ms on
`JSTests/microbenchmarks/object-spread-function.js`).
- `Array.from` in a compiled program held 441 functions. The flow
analysis took the call of `next` inside the helper `iteratorGenericNext`
for a call of a value nobody knows. oven-sh/WebKit#930 changed that
rule, and 22 functions are left (above).

Build 134164 also showed a crash under collector stress (`SIGSEGV` at
address 0 in `WTF::findAtomBeforeAdding`). Its cause was on `main` too:
`AOT::nameOfBuiltin()` makes an atom while a collection ends, where
`Heap::pruneDeadReferences()` has set the atom table of the thread to
null.

#### The engine tests

`test/aot/engine-tests` has the IR text tests of the engine that need
entries of Bun's table of builtins (1,601 files since #47129).

- A test names a builtin that is written in JavaScript by its runtime
function number. Upstream WebKit/WebKit@37aa2b5bd94d deleted
`defaultAsyncFromAsyncIteratorWithNext`, which was number 23. Every
number from 24 on is one lower: 2,648 numbers in 371 files. `every` is
30 (was 31), `find` 34, `from` 46, `map` 64 and `some` 88. The numbers
of Bun's own functions start at 0x10000 and do not move. No file names a
number that the engine's list does not have.
- The instance of a compiled program holds one word for every link-time
constant of the engine, and the deleted builtin was one. Every field
behind that list is eight bytes lower. Nine tests check the B3 of a
function line by line and had such offsets in 19 lines (8040, 8168,
8192, 8216, 8264). `test/aot/tools/update-ir-tests.ts` wrote them anew
with a release `testaot` on Linux x64, and nothing else in those files
changed.
- With a release `testaot` and `jsc` built from this branch, `testaot
run test/aot/engine-tests` passes: 1,599 files, 2 todo.
- oven-sh/WebKit#923 makes the same change of numbers in the engine's
own tests.

#### The new test file

`test/js/bun/jsc/webkit-upgrade-e8f704815e.test.ts` has 17 cases. Four
of them fail on Bun 1.4.3-canary, because the engine changes there:

| Case | Old engine | New engine |
|---|---|---|
| `Math.sumPrecise([-1])` | `-1.0000000000000002` | `-1` |
| Own keys of the revoke function of `Proxy.revocable`, after `length`
is deleted and defined again, against those of an arrow function after
the same steps | another order (`name`, `length`) | the same order
(`length`, `name`) |
| `Error.stack` of an async function that awaits its own promise through
`Promise.all` | the frame repeats | one frame |
| `[x, y].sort(boundComparator)` when the comparator leaves optimized
code (the program of oven-sh/WebKit#885) | the caller gets
`Array.prototype.sort` itself | the caller gets the sorted array |

The other 13 cases pass on both engines. They cover the code that the
merge rewrote by hand: spread and rest of a function, the iterator
protocol of `Array.from`, `Object.groupBy`, `Map.groupBy` and the
iterator helpers, `Array.fromAsync`, `Array.prototype.join`,
`JSON.parse` of objects with the same keys (also `-0`, invalid input and
a reviver), `Bun.JSONL.parseChunk` cut at every position, loops that end
in a null test or a negated comparison, and an anchored RegExp and a
`switch` on a substring.

#### The bytecode snapshots

`test/bundler/bundler_bytecode_portable.test.ts` compares a hash of the
serialized bytecode. 22 entries come from a local debug build with the
merged engine. The entry `bun build --bytecode libraries.js` comes from
CI: the bundle of that entry differs on the machine the other values
come from. All ten test platforms of build 133970 reported the same
value for it, and accepted the other 22.

#### Bun's CI on the first preview build

Build 133970 ran this branch with `autobuild-preview-pr-923-b6e34894`.
One test failed on every platform: the snapshot entry above, which had
its old value then. Eight other tests failed and passed on a retry
(`bake.test.ts`, `hot.test.ts`, `no-orphans.test.ts`,
`spawn_waiter_thread.test.ts`, `test-zlib-invalid-input-memory.js`,
`nth-anplusb-ident.test.ts`, `process.test.js`, `bun.test.ts`).

The zip sizes in "The WebKit side" compare the release zips of that
build with those of build 133646, which is `main` at the commit this
branch started from. The range is over the 12 release zips. The unpacked
binaries were not measured: the artifact store of CI is not reachable
from the machine this was written on.

#### The crash of #44697

`test()` records only where the match is. A read of `RegExp.lastMatch`,
`RegExp.$1` or another legacy static property runs the match again for
the captures. That second run can need more stack than the first, and
when it failed, `RegExpGlobalData::getBackref` read through a null
pointer. Upstream WebKit/WebKit@191803bb2304, which is in this range,
throws a `RangeError` there.

```sh
BUN_JSC_maxRegExpStackSize=65536 bun -e '
  const re = new RegExp("^" + "(z)?".repeat(8) + "(?:a|b)+$");
  console.log(re.test(Buffer.alloc(100000, "a").toString()));
  console.log(RegExp.lastMatch.length);'
```

- Bun 1.4.3-canary: `true`, then `panic(main thread): Segmentation fault
at address 0x4`.
- A debug build of this branch: `true`, then `RangeError: Out of
memory`, also for `RegExp.$1`, `RegExp.$9`, `RegExp["$&"]` and
`RegExp.lastParen`.

`test/js/bun/jsc/regexp-legacy-static-properties.test.ts` runs the
program of upstream's stress test in a child with
`BUN_JSC_maxRegExpStackSize=65536` and compares every line that the
child prints: `matched: true` for the first `test()`, a `RangeError` for
each read and for an assignment to `RegExp.input`, and the values of the
properties after the next match. `USE_SYSTEM_BUN=1 bun test` fails it
with the panic, and `bun bd test` passes it. The test comes from #47160,
which had the upstream commit alone (oven-sh/WebKit#929, closed now).

#### What ran locally

- With the pin of the merge commit, a debug build with ASAN:
`webkit-upgrade-e8f704815e.test.ts` passes 17 of 17, and
`regexp-legacy-static-properties.test.ts` passes.
- `bun run build:local` against the merged WebKit (Debug, no ASAN). `-p
'42'` prints `42`.
- `test/js/bun/jsc`: 215 pass. Two `domjit.test.ts` cases pass their 20
s limit in this Debug build. The same two take 42 s on a debug build of
`main`.
- `test/js/bun/jsonl`, the worker tests, the GC tests and the heap
snapshot tests pass.
- `JSType.h`, `OptionsList.h`, the WebCore bindings scripts and the
structured clone sources have no upstream change in this range.
`src/jsc/JSType.rs` needs no change.

#### The three assertion commits

WebKit/WebKit@0bf94cf0c1, WebKit/WebKit@4bc9ad4d7f and
WebKit/WebKit@cf89f1571e check the bits of `Heap::m_worldState` with
`RELEASE_ASSERT`, in the functions through which a thread takes or gives
up its access to the heap. Bun gives up heap access while the event loop
waits (`Bun__JSC_onBeforeWait`) and takes it again after the wait. That
order is the one the assertions check.

#### Upstream changes

Range:
[`f59345e04a8d`](WebKit/WebKit@f59345e)
(2026-10-22) ..
[`e8f704815e94`](WebKit/WebKit@e8f7048)
(2026-10-27). **59** of the 360 upstream commits touch
`Source/JavaScriptCore`, `Source/WTF` or `Source/bmalloc`. 20 of the 59
change nothing that a JSCOnly build compiles: they touch a preferences
yaml, a sandbox profile, the Xcode project, or code for Swift, GLib or
Cocoa only.

### Highlights

- **`JSON.parse` reads the keys it already knows in a loop of their
own**
([`6f5f583b55`](WebKit/WebKit@6f5f583b55)). A
key found in `JSONCache`'s name table, and a value that is a cached
string or an integer of at most nine digits, are read through a local
cursor. The lexer is only used for the other values. Upstream measures
1.13x on its JSON benchmarks (geometric mean), up to 1.32x.
- **Object spread and rest of a function take the fast path**
([`e04a6f9fae`](WebKit/WebKit@e04a6f9fae)): `{
...fn }` and `let { a, ...rest } = fn` are 5x faster. PostCSS does this
once per `LazyResult`.
- **`Array.from`, `%TypedArray%.from`, `Object.groupBy`, `Map.groupBy`
and `Iterator.prototype.flatMap/some/every/find` drive the iterator
themselves**
([`37aa2b5bd9`](WebKit/WebKit@37aa2b5bd9)).
They no longer build a wrapper object for a `for-of` loop: 1.1x to 1.6x
on the `Array.from` microbenchmarks.
- **`Proxy.revocable` is 2.9x faster**
([`fad04e2527`](WebKit/WebKit@fad04e2527)).
The revoke function is a `JSFunctionWithFields` with a cached
executable, and the result object has a cached Structure. The class
`ProxyRevoke` is gone.
- **Loop conditions are one instruction more often**
([`bd50166362`](WebKit/WebKit@bd50166362)). A
null test or a negated compare that feeds a backward conditional jump is
fused into the jump (`jneq_null`, `jnless`, ...). No opcode is new, but
the bytecode of most loops changes.
- **The RegExp first-character filter reads substring ropes in place**
([`b92d6a6bea`](WebKit/WebKit@b92d6a6bea)),
and `String#match` with a constant anchored RegExp uses the filter in
the DFG. The same commit makes DFG/FTL `switch` on a substring rope read
the width of the base string, not the bit cached in the rope.
- **Two DFG/FTL and Wasm miscompile fixes**: an OSR exit in a bound
`Array#sort` comparator returned past the `sort` call
([`f274ef4c03`](WebKit/WebKit@f274ef4c03)),
and a cross-instance Wasm tail call copied its frame from one
`restoreFrameSize` too low
([`0927910cf9`](WebKit/WebKit@0927910cf9)).
- **The GC asserts its stop-the-world protocol in release builds**
([`0bf94cf0c1`](WebKit/WebKit@0bf94cf0c1),
[`4bc9ad4d7f`](WebKit/WebKit@4bc9ad4d7f),
[`cf89f1571e`](WebKit/WebKit@cf89f1571e)). A
mutator that takes or gives up heap access in a state the protocol does
not allow crashes now.
- **`Math.sumPrecise` is correct for negative sums**
([`8ee560d748`](WebKit/WebKit@8ee560d748)):
`Math.sumPrecise([-1])` was `-1.0000000000000002`.

### Runtime & builtins

- [`e04a6f9fae`](WebKit/WebKit@e04a6f9fae)
([328286](https://bugs.webkit.org/show_bug.cgi?id=328286)):
`@copyDataProperties` and `@cloneObject` accept a `JSFunction` source on
the path that reads the Structure, through the new
`JSFunction::canPerformFastEnumerablePropertyEnumeration(VM&)`. It needs
an unmodified `name` and `length`, no accessors and no own `__proto__`.
object-spread-function 4.99x, object-rest-function 5.54x.
- [`37aa2b5bd9`](WebKit/WebKit@37aa2b5bd9)
([328563](https://bugs.webkit.org/show_bug.cgi?id=328563)): Five builtin
files call `@iteratorGenericNext` in a `for (;;)` loop and close the
iterator with `@ifAbruptCloseIterator`. The link-time constant
`defaultAsyncFromAsyncIteratorWithNext` is removed, and
`defaultAsyncFromAsyncIterator` has its body now.
- [`fad04e2527`](WebKit/WebKit@fad04e2527)
([328635](https://bugs.webkit.org/show_bug.cgi?id=328635)):
`Proxy.revocable`: see Highlights. Removed: `ProxyRevoke.{h,cpp}`,
`ProxyRevokeInlines.h`, `proxyRevokeSpace`,
`JSGlobalObject::proxyRevokeStructure()`. Added:
`proxyRevocableResultStructure()`, `VM::proxyRevokeExecutable()`,
`JSFunctionWithFields::Field::RevocableProxy`, the identifiers `proxy`
and `revoke`. Observable: the own keys of the revoke function list
`length` and `name` first, like any function.
- [`e81441a5ec`](WebKit/WebKit@e81441a5ec)
([328769](https://bugs.webkit.org/show_bug.cgi?id=328769)):
`JSOnlyStringsAndInt32sJoiner` is renamed `JSExactLengthJoiner`.
`Array#join` keeps its exact-length path for arrays that also hold
booleans, `undefined` or `null`.
- [`8ee560d748`](WebKit/WebKit@8ee560d748)
([315450](https://bugs.webkit.org/show_bug.cgi?id=315450)):
`WTF::Xsum::XsumSmall::compute()` rounded a negative sum away from zero
when it must not. `Math.sumPrecise([-Number.MAX_VALUE])` was
`-Infinity`.
- [`071ce01fcb`](WebKit/WebKit@071ce01fcb)
([328147](https://bugs.webkit.org/show_bug.cgi?id=328147)):
`Interpreter::getAsyncStackTrace` stops at the second visit of a promise
combinator. An async function that awaits its own promise through
`Promise.all` no longer repeats its frame up to `Error.stackTraceLimit`,
or hangs.
- [`be583048f3`](WebKit/WebKit@be583048f3)
([328788](https://bugs.webkit.org/show_bug.cgi?id=328788)):
`Identifier::add` no longer does one atomic ref and one deref of the
`AtomStringImpl` it returns.
- [`ca48e0119c`](WebKit/WebKit@ca48e0119c)
([328786](https://bugs.webkit.org/show_bug.cgi?id=328786)): The last two
`USE(BIGINT32)` blocks are deleted. Dead code.

### Parser / bytecode generator

- [`bd50166362`](WebKit/WebKit@bd50166362)
([328623](https://bugs.webkit.org/show_bug.cgi?id=328623)):
`emitJumpIfTrue` and `emitJumpIfFalse` no longer require a forward
target for their fusions. `while (node != null)` and `do {} while (!(a <
b))` end in one fused jump. The subject names only the null tests. The
diff also covers the ten negated compares.
- [`4e5e850636`](WebKit/WebKit@4e5e850636)
([328770](https://bugs.webkit.org/show_bug.cgi?id=328770)):
`BytecodeGeneratorBase<Traits>` is folded into `BytecodeGenerator`.
`GenericLabel` and `GenericBoundLabel` are the plain classes `Label` and
`BoundLabel`, and `Label::bind` takes the instruction writer.
`BytecodeGeneratorBase.h` is deleted and
`BytecodeGeneratorBaseInlines.h` is renamed
`BytecodeGeneratorInlines.h`. `BytecodeList.rb` loses the unused type
`:WasmBoundLabel`, and no opcode.

### DFG / FTL

- [`f274ef4c03`](WebKit/WebKit@f274ef4c03)
([327983](https://bugs.webkit.org/show_bug.cgi?id=327983)): An inlined
bound function keeps the call kind of its caller.
`InlineCallFrame::BoundFunctionCall` and `BoundFunctionTailCall` are
removed. A bound comparator inlined into `Array#sort` is an
`ArraySortComparatorCall`, so an OSR exit inside it restarts the `sort`.
A recursive tail call through a bound function can become a jump in the
FTL.
- [`b92d6a6bea`](WebKit/WebKit@b92d6a6bea)
([328389](https://bugs.webkit.org/show_bug.cgi?id=328389)): See
Highlights. `compileRegExpMatchFast` (DFG) returns `null` without a call
when the first byte cannot start a match.

### RegExp

- [`59e81f3e12`](WebKit/WebKit@59e81f3e12)
([328828](https://bugs.webkit.org/show_bug.cgi?id=328828)): A match
array gets `index`, `input`, `groups` and `indices` written into its
butterfly before the array cell exists.
`tryCreateUninitializedRegExpMatchesArray` has a fifth parameter, and
`JSArray::tryCreateUninitializedRestrictedButterfly` is new.
- [`1984003fd9`](WebKit/WebKit@1984003fd9)
([328895](https://bugs.webkit.org/show_bug.cgi?id=328895)): On x86_64
the Yarr JIT copies fewer than 16 `ParenContext` frame slots with
straight-line code, and eight per loop iteration above that.
regexp-parencontext-frame-slots 1.80x.
- [`191803bb23`](WebKit/WebKit@191803bb23)
([328417](https://bugs.webkit.org/show_bug.cgi?id=328417)):
`RegExp.lastMatch`, `RegExp.$1` and the other legacy properties throw a
`RangeError` when the lazy re-match fails. Before, they read a null
array.

### JSON

- [`6f5f583b55`](WebKit/WebKit@6f5f583b55)
([328615](https://bugs.webkit.org/show_bug.cgi?id=328615)): See
Highlights. The object branch of `LiteralParser::parseRecursively` is
one loop with the lambdas `parseValue`, `putWithTransition` and
`finishObject`. `Lexer::skipWhitespaceBeforeKey()` is removed,
`Lexer::setPtr()` and `end()` are new, and `numberOfDigitsForSafeInt32`
moves to `ParseInt.h`.
- [`2dff3f1dbf`](WebKit/WebKit@2dff3f1dbf)
([329046](https://bugs.webkit.org/show_bug.cgi?id=329046)): Compile fix
for the commit above with clang 20: three lambdas capture `vm` by name.

### GC / heap

- [`0bf94cf0c1`](WebKit/WebKit@0bf94cf0c1)
([328987](https://bugs.webkit.org/show_bug.cgi?id=328987)):
`Heap::stopTheMutator` asserts that no mutator holds the conn, where it
had a branch that returned false.
- [`4bc9ad4d7f`](WebKit/WebKit@4bc9ad4d7f)
([329005](https://bugs.webkit.org/show_bug.cgi?id=329005)):
`Heap::resumeTheMutator` asserts that the mutator is stopped, has no
heap access and no conn. It returned early when the mutator was not
stopped.
- [`cf89f1571e`](WebKit/WebKit@cf89f1571e)
([329038](https://bugs.webkit.org/show_bug.cgi?id=329038)): Release
asserts on `Heap::m_worldState` in `acquireAccessSlow`,
`releaseAccessSlow`, `setNeedCollectionEpilogue`, `setMutatorWaiting`,
`clearMutatorWaiting`, `Collector::beginCollectionInEachHeap`,
`finishChangingPhase` and `stopThePeriphery`.
`Collector::requestCollection` gets two debug asserts.
`Heap::needCollectionEpilogue()` is new.

### WebAssembly

- [`0927910cf9`](WebKit/WebKit@0927910cf9)
([329002](https://bugs.webkit.org/show_bug.cgi?id=329002)):
`Wasm::emitRestoreInstanceFrameIfNeeded` starts its copy at the stack
pointer from before the adjustment.

### WTF

- [`45f193ae80`](WebKit/WebKit@45f193ae80)
([328940](https://bugs.webkit.org/show_bug.cgi?id=328940)):
`Thread::tryCreate()` returns null when the thread cannot be created.
`Thread::create()` calls it and still crashes. `$.agent.start` in the
`jsc` shell throws.
- [`e8f704815e`](WebKit/WebKit@e8f704815e)
([329066](https://bugs.webkit.org/show_bug.cgi?id=329066)): The defaults
of `LOG_DISABLED`, `ASSERT_MSG_DISABLED`, `ASSERT_ARG_DISABLED`,
`BACKTRACE_DISABLED`, `FATAL_DISABLED` and `ERROR_DISABLED` move from
`Assertions.h` to `PlatformEnable.h`.
- [`bbfbc41dc9`](WebKit/WebKit@bbfbc41dc9)
([327419](https://bugs.webkit.org/show_bug.cgi?id=327419)): The
`RELEASE_LOG*` macros are defined once, on top of a
`WTF_RELEASE_LOG_SEND` per backend. `LOGF`, `SD_JOURNAL_SEND` and
`LOG_ANDROID_SEND` are removed.
- [`3757158274`](WebKit/WebKit@3757158274)
([328861](https://bugs.webkit.org/show_bug.cgi?id=328861)):
`allowCompactPointers<T>()` looks at the `AllowCompactPointers<T*>`
specialization first.
`WTF_ALLOW_COMPACT_POINTERS_TO_INCOMPLETE_TYPE(JSC::JSCell)` moves from
`MicrotaskQueue.h` to `JSCJSValue.h`.
- [`2b85a5e547`](WebKit/WebKit@2b85a5e547)
([328859](https://bugs.webkit.org/show_bug.cgi?id=328859)):
`printInternal(PrintStream&, String&)` is defined in `PrintStream.cpp`,
not inline.
- [`38418ba096`](WebKit/WebKit@38418ba096)
([328643](https://bugs.webkit.org/show_bug.cgi?id=328643)):
`NeverDestroyed` and `LazyNeverDestroyed` read their storage through
`std::launder`.
- [`701620c269`](WebKit/WebKit@701620c269)
([328791](https://bugs.webkit.org/show_bug.cgi?id=328791)):
`Vector::appendRange(Range&&)` for a sized range. The rest of the commit
is WebCore.
- [`272972fe8c`](WebKit/WebKit@272972fe8c)
([328652](https://bugs.webkit.org/show_bug.cgi?id=328652)):
`WTF::initializeObjectIdentifierDomain()`. Only WebKit's GPU process
calls it.
- Fixes in headers that nothing in JavaScriptCore uses:
[`961981e9e8`](WebKit/WebKit@961981e9e8)
(`MediaTime` ordering),
[`2c813011e9`](WebKit/WebKit@2c813011e9)
(`WeakListHashSet` const iterator),
[`3e90cc907c`](WebKit/WebKit@3e90cc907c)
(`LoggingHashMap`),
[`474bb3fa62`](WebKit/WebKit@474bb3fa62)
(`BitSet::setEachNthBit` asserts `n`).

### bmalloc / libpas

Bun's JavaScriptCore allocates through mimalloc, and the ASAN builds
through the system allocator, so none of these changes what a shipped
`bun` does.

- [`c8ce68fbaa`](WebKit/WebKit@c8ce68fbaa)
([328247](https://bugs.webkit.org/show_bug.cgi?id=328247)): Each page
config of a heap has its own minimum of objects per page.
`PAS_MIN_OBJECTS_PER_PAGE` is renamed
`PAS_DEFAULT_MIN_OBJECTS_PER_PAGE`, and `PAS_MAX_OBJECT_SIZE` takes the
minimum as an argument.
- [`37e9021372`](WebKit/WebKit@37e9021372)
([328674](https://bugs.webkit.org/show_bug.cgi?id=328674)): Medium
segregated pages take objects up to 18432 bytes (from 11776).
- [`ad3ad2c6ea`](WebKit/WebKit@ad3ad2c6ea)
([328277](https://bugs.webkit.org/show_bug.cgi?id=328277)): Free small
segregated pages stay committed 450 ms longer (900 ms on macOS).
- [`1ae8574624`](WebKit/WebKit@1ae8574624)
([328282](https://bugs.webkit.org/show_bug.cgi?id=328282)): Four more
size classes in the designated intrinsic heap: 112, 144, 272 and 384
bytes.

### Build system

- [`9c5e8c5fc1`](WebKit/WebKit@9c5e8c5fc1)
([328481](https://bugs.webkit.org/show_bug.cgi?id=328481)): CMake Debug
builds compile bmalloc and `FastMalloc.cpp` with `-O3`, except with MSVC
and clang-cl.
- [`3c41f3fb2f`](WebKit/WebKit@3c41f3fb2f)
([329015](https://bugs.webkit.org/show_bug.cgi?id=329015)): Symbols that
only offlineasm output references get `REFERENCED_FROM_ASM`, for GCC
LTO.

### Nothing for a JSCOnly build (20)

`2fe794df22`, `a46f812bfd`, `0ae4c9d112`, `da8e478d08`, `1d91ff5512`,
`ac53330cbd`, `319a9b6c84`, `8655634bf3`, `e381818e3a`, `280384b995`,
`933708cada`, `3b48f12459`, `17d262face`, `4e2a07134b`, `d71f3d702b`,
`500be61de4`, `ad490a9bef`, `58ebe7bde3`, `8bd119f86f`, `48fd938fe4`:
web preferences, sandbox profiles, the Xcode project, Swift bridging,
GLib and GTK/WPE build files.

</details>

<!-- robobun:evidence:begin -->

---

**no test proof** · iteration 7 · platform-specific test(s) that do not
run on this machine, deferring to CI, which covers all platforms:
test/bundler/compile-aot-size.test.ts,
test/bundler/bundler_bytecode_portable.test.ts

<!-- robobun:evidence:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants