Repository navigation
[JSC] AOT: flow follows Proxy and the library helpers; typed JSON.parse; the main module - #930
Conversation
…branch hints - A call that returns an object in registers is not joined by a block parameter when the code behind a shape test is split; the compiler aborted on it. - new Response(x.body, init) with a call, an await or a yield as its init no longer aborts the compiler. - The structure remembered for `new F()` is no longer shared by call sites whose cache slots have one address; an object could be born with another site's layout. - A block that only asks whether a module has been evaluated is not treated as rare, and the question is asked in line. - An explicit throw in a small function calls its stub again instead of trapping. - The shared JSON parser shares repeated string values as the former one does. - Set.prototype.forEach on an unknown receiver walks the table. - startsWith and endsWith with a literal, substrings and string comparisons take fewer bytes and instructions. - Built-in modules can mark a condition as likely or unlikely. - Fixes for a use after poison in the JSON scan buffer and for a crash in release builds.
…instanceof stays in line - Air lays the unlikely side of a branch out of line; the frequency estimate carries weights backward and treats edges to cold blocks outside loops as rare. - An exception that unwinds through a tail call from one module graph into another is caught with the catching graph's instance; it could crash. - A recursion in which every call crosses module graphs throws a RangeError instead of running off the stack. - A Map or Set that grows in the code of a module graph gets its table's structure; the collector crashed on the table. - A program that may run in several module graphs makes no lazy closures: one read from another graph aborted or ran with the reader's module variables. - A host class's getter read by name in the host and then in a module graph no longer crashes. - The globals of a Bun.ModuleGraph may replace the globals that Bun provides. - instanceof of a built-in class stays in line in programs that hold eval, new Function or a subclass of a built-in class. - new F(), super() and the guards of direct calls hit their fast paths for functions that were constructed before and for class objects. - ARM64: methods of primitives on unknown receivers take the stub's fast part. - A cast of an object that cannot be converted is decided once per structure and type; a cast converts a plain object in place during marking without waiting for the collector. - A closure returned by a direct call with constant arguments is known when the program is built, so calls through it are direct. - Arithmetic and comparisons of two heap BigInts, === of two unknown strings in a loop, super(...args) and reads at known places in loops take fewer steps. - Generator closures no longer collide in the cache of resume functions. - Header names that are constants are looked up when the program is built. - A slice of a rope and Object.setPrototypeOf on a fresh object take as many instructions as before. - BUN_AOT_LAYOUT_SEED pads the compiled code when a program is built, so that a measurement can be averaged over layouts; unset, the output is unchanged.
- The table of copied properties holds its entries behind a pointer; an entry was over the size WTF::HashTable allows where Vector carries ASAN's fields. - Calls of built-ins beside exception handlers, global functions, the size of a Map or Set and private names may share one body; equal bodies are folded. - new Set(array) is made by the runtime again: filled by compiled code it allocated more. - The stub that converts by a plan takes fewer instructions on its way to the runtime. - A closure returned by a helper that needs no constant argument is known when the program is built.
…ed stores and Map lookups - Heap::waitForCollector(): a mutator that is handed the conn uses it instead of handing it straight back; one wait cost thousands of wake-ups on one core. - Converting a plain object to its record type waits for marking to end again: doing it in place raised peak memory. - o[key] = value looks in one table; the megamorphic cache's epoch is mirrored in the instance. - Map.get, Map.has and Set.has on an ordinary table look a hashed string key up without a frame; `key in o` takes fewer instructions. - new Set(array) is filled by compiled code where no compact table is due. - Freezing a typed record that is a prototype tells the caches: a store on an object that inherits from it throws as it must. - A string that was left out of the image is no longer compared when a module graph's globals are looked up: it was given a hash that was not its own. - Number.isNaN and its kin and stores to private names stay in line. - The side of `number | undefined` that is not a number is laid out as unlikely. - A read of a permanent dictionary takes fewer instructions. - The JSON parser's kinds: late turns of a long session no longer pay for the wait.
…objects - Revert "o[key] = value looks in one table" and the two changes on top of it. A keyed store that adds a property within the object's capacity skipped the write barrier when the value was not a cell. The store still gives the object a new Structure, so an old object could end up holding a Structure that nothing else kept alive: heap corruption in long-running processes. - validateAOTTypedFacts: the check of the keyed tables no longer ends in a collection. It cleared a descriptor row that a stub had just found filled. - Object.assign onto an instance of a typed class follows a remembered plan, and between objects of known types the fields are copied in line. - A typed read of a property that the class does not declare is answered ahead of the operation. - `k in o ? o[k] : d` looks the key up once. - The cache of native getters uses open addressing and grows: which entries collided depended on the addresses of strings, so counts varied by run. - An entry point that casts its arguments calls its body through the leaf stubs again.
…s get layouts - A Set or Map literal with constant string keys is a table in the image's read-only data. The cell is made at run time and points at it; the first write copies it. Making a Set of eight strings: 2,413 -> 176 instructions. - `const self = Object.create(Proto); self.a = a; return self` is born as the record its declared type names. - `key in record` finds an inherited name without leaving compiled code. - A typed read of a property beyond the layout no longer forgets its answer when objects of one structure differ in their further keys. - `new URL(request.url, base)` that is only read is not allocated. - process.nextTick(f, a, b) makes no array. - Short slow paths of functions that run at most once are laid behind their guards. - ASAN builds: after a collection only blocks where something can have died are searched. - Tests for the write barrier of keyed stores and for validateAOTTypedFacts.
…hat are never made - Reads, stores and method calls by name test a cache of their own site in line, in the built-in modules that run at every request. node:http /text: -7.0% cycles, Fastify /text: -4.3%. - A constant Set or Map that the program only asks has, get or size is never made: the lookup names the table in the image. - o[key] = value looks in one table again, with the write barrier on the store that adds a property. - What a program makes read-only on a class prototype, or freezes, stops stores on objects that inherit from it, as without --aot. - Fix a crash: a plain object that refers to itself entering typed code a second time. - A number stored under a name the class does not declare is cached: 2,150 -> 40 instructions. - A base URL written as a literal is parsed when the program is built. - `x instanceof C` goes by shape also where C is passed as a value. - node:http and streams queue their ticks by a direct call. - Tests run a part of the suite under the GC verifier.
…nt Sets - Fix a crash on arm64: the stub that converts array elements restored the first argument register over the conversion's answer, so an element that was not converted could reach typed code as if it had been. - has() and get() on a constant Set or Map resolve a rope once instead of copying it at every lookup. - A name that the program defines as an accessor anywhere gets no site cache. - A missing name read through an index signature: 437 -> 52 instructions. - A literal that only a cast holds is made as the record its type names. - Native setters stored in turn: 2,149 -> 132 instructions at every size.
- A call through a function-valued field of an object that never escapes could run the wrong function: two passes dropped the store that the call's test reads. - Proper tail calls were lost for a large typed method taken as a value. - A generic function that spreads its argument threw a TypeError in code that is cold by the call graph: whether the copy keeps its source's layout hung on a prediction that compact code does not ask for. - A copy of an object that inherits a field (spread, Object.assign) no longer counts as the whole type, so reading the missing field gives undefined. - Freezing an object made by Object.create no longer marks every layout as possibly frozen. - Objects made deep in a chain of small makers are made as the type they are cast to. - `x.length` beside `x[i]` in a loop is read in line. - Constant Sets and Maps are made at first use again: skipping that made has() slower.
…rged reads - Array.prototype.sort in compiled code is the engine's algorithm, call for call. The order and the number of comparator calls differed for a comparator that is not transitive. - A young plain object that typed code only reads is checked in line and stays plain: three fields 234 -> 91 instructions, six fields 339 -> 135. - Reads of several properties of one object at one place are merged into one call: smaller code and 1 to 3% fewer cycles on an Effect server. - A testing option compiles every function as cold, beside the one that compiles every function as hot. - Site caches: stores that add a property no longer miss at every run. - Object.keys of an instance with an undeclared property is read in line.
…il-call results checked by the receiver - Chains of filter, map, slice ending in an array, reduce, length, some, every, find or findIndex run as one loop where every callback is proved unobservable. - A plain object that typed code only reads is checked in line instead of converted, including nested data and fields that are unions of string literals. - The result of a call in tail position is checked by whoever receives it, the same whatever was inlined. Proper tail calls hold. - A function that calls itself last is a loop. Atomics on integer typed arrays are in line. - A typed object that untyped code freezes keeps its layout. - A property descriptor that is only taken apart is never made. - Inline caches at call sites on ARM64. - Fixes: a copy of an object with inherited members no longer throws, new of a function cast to a constructor type no longer throws, a cast kept its "if convertible" when an inlining showed the layout.
…rt of ahead-of-time compilation - A local named `small` is a macro on Windows. It goes with the change that brought it: whole-number keys no longer index the buckets of Map and Set directly. - MegamorphicCache and the JSON cache are cleared as before. - The first local time of a program builds its time zone data as before. - A constructor that is expected at a `new` is no longer always inlined. - reduce over numbers keeps its earlier loop.
…hind tail calls, frozen plain objects - Inline caches at call sites are back to Bun's per-request modules. In every module they made a large program slower to start and larger in memory. - A site that no cache can serve is marked once instead of trying at every run. - ARM64: a site may lie any distance from the instance. - Where the checks behind calls of a small function outweigh it, typed direct callers get a copy that checks its own result. Tail calls are unchanged. - A plain object that is frozen, sealed or not extensible is converted by a remembered plan. - `x.next = x` on a predicted record no longer stops the compile. - Elements of an any[] array are predicted from what the program stores in it. - A fused replace chain that made two programs slower is out again.
…al boolean arrays as bytes - The fused forms of String.prototype.replace are reverted. One kept values for RegExp's static properties where the collector could not see them, so a live object could hold a freed cell. Another made an aligned 16-byte store into a std::array that Microsoft's STL packs to 8, which crashed compiled programs on Windows x64. Their test programs stay. - `"text" + integer` builds a rope again. Building it flat made the common case several times dearer. - Sorting typed records by a numeric field reads the field as a number and writes no pairs for a run that already rises or falls. - `new Array<boolean>(n).fill(false)` that never leaves its function, with every index proved in range, is stored as bytes. - Bun's per-request modules are lowered as code in a loop. - A plain object cast to a record type in a loop or a hot function is converted by compiled code. - A typed call that resolves to a function with a self-checking copy enters the copy. - console.assert releases its exception scope.
…y become fields, frozen objects into typed code - The hottest functions by the static call graph, until they hold 32,768 property accesses by name, get inline caches at their sites and are compiled as hot code. Express, Fastify and Effect spend 7 to 8% fewer cycles a request. A site whose name is an accessor of a locked host prototype keeps the plain call. - A name that typed code stores on a class instance through `any` becomes a hidden optional field. Defining an accessor on it moves that name of that instance out again. - A frozen, sealed or non-extensible plain object that enters typed code is converted by a plan that is remembered. - Typed code predicts the callee of `new` where the type is a construct signature. - The typed JSON writer takes instances of classes that extend Array. - A string built by concatenation that only a Response can reach is written as UTF-8 without being flattened. - A check of values that meet is made on the one edge that needs it. - A typed store through an open layout tests the frozen bit inside the subtype test.
…at for the hottest functions, loop checks on array parameters - The parser generated for a type reads keys in any order and with any white space, keeps properties the type does not declare without building a plain object first, and picks the arm of a tagged union with one dispatch on the tag wherever the tag stands. A line of a JSONL file with 100 record types costs 22.8 K instructions, JSON.parse 35.0 K. - A function that is hot only because it is among the hottest by the call graph is hot for the lowering and the preparation passes but not for the inliner. On the TypeScript compiler that takes the cost of the inline caches from +8.9% to +1.7% of compile time. - makeCallsPreserveLiveRegisters() no longer sweeps every block to a fixpoint: a function of 6,000 chained string concatenations compiles in under 25 s instead of 196 s. - versionLoops() hoists the checks on array parameters and drops bounds checks when the loop bound is not the array's length. - A class whose constructor is named only in class definitions and on the right of instanceof has no laid-out instances, so accesses through it no longer test for a layout nothing has. - new Set() of a short list of strings fills the table in one pass. - A method call's cache serves a function that is the receiver's own property. - A Latin-1 string with one character beyond ASCII is copied into a response in one pass.
…lared keys at JSON.parse's price, getters served from the by-name table - A recursive union whose arms are told apart by a number, a boolean or null took time that doubled with every level of nesting: 40 levels, 764 bytes, ran for hours. A constant member of any kind now picks the arm with one dispatch, a chosen arm that refuses is final, and arms that can open alike go through one parse by the engine's own parser. - A run of properties the type does not declare costs 78 instructions a key, JSON.parse 81. - JSON.stringify of a typed object that also holds undeclared properties is written by a plan: a line of the JSONL benchmark 18.5 K -> 12.0 K instructions, plain objects 12.4 K. - -0 under the constant type 0 stays -0. From 131 undeclared keys one key could change places. - The by-name table's cell keeps the accessor itself where its getter is compiled: a getter read 108 -> 98 instructions, Fastify -1.6% and Express -1.1% cycles a request.
…rs on the stack, convert unions in linear time - Typed JSON parser: a cached key longer than the input's padding could make the parser read past the end of its buffer. A key is cached only if it fits in the padding. - Typed JSON.stringify: the cache of writer plans was cleared while a writer was still using one of them. From about 16,384 distinct shapes that crashed or wrote wrong JSON. The cache is cleared only where a write begins. - Converting plain objects to a typed union kept a raw copy of the first object's tag in malloc memory, where the collector never saw it. Each object's own tag is copied now. - The conservative stack scan also tests 32-bit halves against the heap's block bitmaps, so a compressed pointer in a register or a stack slot keeps its cell alive. - ARM64: the stubs that append to compact Map and Set tables fence their stores while the collector is marking. - Converting a value to a recursive union took exponential time: 12 levels took 8.8 s. 1,000 levels take 9 ms. A union whose members differ only more than three levels down accepts valid values again. - A check over compiled code verifies at every safepoint that each live compressed pointer is rooted. The test suite compiles under it. - new Set(strings), Object.assign(this, record), stores to optional fields and arrow functions stored on `this` no longer take slower paths on typed objects than on untyped ones. - A number field that is used with fractions is stored as a double. - A run of property accesses no longer predicts its shape from an object literal in a built-in module. - Functions that guard removable features are NEVER_INLINE, so LTO keeps them apart.
…-in helper files - Remove the interpreter's predecoded tier. llint/ and bytecode/ go back to upstream's text there. Code created at run time with eval or new Function runs about 1.7 times slower in a compiled executable. - Remove the allocation report, seven testing options, twelve $vm functions no test calls, 21 operations nothing asks for, a header left from the bytecode compiler and other dead code. - Rename about 900 internal functions, types and fields in aot/ to shorter, more conventional names. No line that upstream also has is changed. - A helper file compiled into every program never ran its top-level code, so its variables read as zero. A function that uses one now runs the file's top level first. - The sampling profiler read a stopped thread's frame through accessors that ASAN instruments. - A method named by a symbol no longer trips an assertion in the compiler. - Sorting by a key checks for an exception where it was missing. - Object.getOwnPropertyDescriptor() on a typed field that holds undefined takes the fast path again. - Converting one value of a plain object to a typed field costs a tenth of what it did. - Error messages from the engine are rewritten in plain words and no longer begin with "--aot:".
…sed operations - The marking loop for typed objects and the serialization of images move out of upstream's files into files of their own, so heap/SlotVisitor.cpp and runtime/CachedTypes.cpp are close to upstream again. - Remove inline-cache helpers and typed operations that nothing calls.
A snapshot of the whole working tree, taken as an undo point before a large change to how types are represented and trusted. It builds and passes the smoke programs and the four server programs. Known bugs are still open. Includes two test folders that a .gitignore pattern (results) was hiding.
Everything since the checkpoint of Oct 19: the value-flow analysis and its relational summaries, the pass pipeline and its change log, a direct code generator for x86-64, stubs, layouts, the outliner, hardening under one build flag, and the IR and native test suites that go with them.
collectXorOrChain names a limit that moved to Limits::, AssemblerBuffer gets a read-only accessor that testb3 can use on ARM64 too, a local in testb3 no longer collides with MacTypes.h, and one IR test follows the longer number buffer.
…elease holds the lanes that built
…n is followed; own keys are expanded by the loops of their own function
- A statement counts as reached only where the tests in front of its block can pass. Flow reads HasJSType, instanceof, `!`, Array.isArray, Error.isError and the predicates of node:util/types.
- A proxy of a function is followed through calls, bind, instanceof and the built-ins that only call their operand. Reflect.get is answered at the call.
- A proxy that a member answers out of a cell is open where the member is taken without its name.
- What is found under `get` on the handler of an open proxy counts as stored under the names whose methods reach the printer. callLibraryMethodsOfUnknownReceiver() leaves out a library method that is handed primitives alone.
- ExpandOwnKeys asks heatClassByOwnLoops(): hot in a loop of its own function, else warm, cold on the way to a throw.
- A Map or WeakMap made from entries runs code on the operand and on its entries and stores what lies in them.
- PlaceTypeTests tests the bound of a counter together with the other operand of the operator. Where it tests a member of a constructor function, the failing side lets its guards begin.
- SimplifyCasts drops a cast that expects no contents. DescriptorLiteral takes `{ __proto__: null, .. }`.
- process.mainModule and require.main are answered where a walk or a computed key reaches them.
- More objects than flow tells apart are put together only once all else is at rest.
- An array literal of the same function gets the test that its elements are present.
- The edge into a catch block is no side of the branch that its try block ends in.
- Calls of the compiler's own helpers stand behind no guard, so their answers have a type in every arm that is compiled.
- runtime/JSModuleLoader.cpp, under ENABLE(AOT) and with compiled code alone: loadModuleSync() leaves out the second load of a root whose graph waits for a step of a synchronous load further out.
…t that something holds is not as it was made; a key written at a call counts for the inliner - The engine asks the driver for what a program lacks behind flow, so a program that is compiled again does not go past flow the first time. - isArgumentsObjectAsCreated(): only the state of a walk may keep the object in its own result. A closure, an object or a list that holds it does not count as staying in its function. - InlineCalls values a key written at the call as it values a known receiver (computeKnownKeyBenefit()). - The get traps of a program's proxy are called with a trap's operands, and what they answer counts as stored under the names whose methods reach the printer. - A read under a key nobody knows, in program code, looks up the instances of library classes that its node lists. - Flow reads ArrayBuffer.isView. - RemoveTrivialParameters: what a relational comparison leaves of a number stays a parameter of its own while the other side is only expected to be a number. - PlaceTypeTests: a read in a loop of a dense array literal of the same function gets the test of the bounds where its value goes into a type test that only an absent element fails. - PlaceTypeTests places tests in a catch clause too. - heap/MarkedBlockCage.cpp, runtime/VM.cpp: the dead stack that is cleared lies below the frame that asks, and goes down to the stack limit of the running thread. - bmalloc/bmalloc.cpp, with mimalloc on Linux, where address space is kept aside: a request that finds no piece to let go of looks once more if a piece was let go of since its last look, and the size of a request is held against the pieces only behind that look.
… of the built-ins' table are interned at once; what process.send needs hangs on its call - PlaceTypeTests: `x === x` on a value that is not proven a number becomes "is it a number? then compare it with itself; else true". A comparison whose answer a branch narrows by is left as it is. - AOTStringTable: appendBuiltinNames() takes the names of the built-ins' table in without a copy and a second lookup of each. - AOTBuiltinTable: RecordsByBuiltin holds where the records of each built-in begin, in place of two binary searches at each ask. - Flow and the generator's dependency closure: the modules and functions that a host function of its own needs are taken in where it is called, so process.send and process.disconnect bring node:net in only by a call. - The record of a require: once the main module is decided, a pair of which one file has no module object to hand out leaves at once, and a file's distance below the root of a load is found once a load. - statistics.def counts the source files of Bun's library that a build parses. - builtins/generator/declarations.ts imports OperandName.
…d when it is first asked for; link sites that arrive in ascending runs are merged - AddGenericVersion copies no function and asks for no heat. The limit MaxGenericVersionJoinWork, five statistics and the decline kind GenericVersionNotCreated go. - AOTStubCatalog generates a stub's body at the first question about it. - assembler/LinkBuffer.cpp finalizeRecords(), assembler/X86JumpShortening.h: the recorded link sites and jumps arrive as a few ascending runs and are merged. More than 16 runs are sorted as before. - Flow: a native getter that calls the library is read through a value nobody knows. A named export of a library module that was carried out of sight counts as called where a value nobody knows is called. Whoever asks for the object above require or above a module object gets one nobody describes, and the holder counts as handed on. A function that gets its name from a computed symbol key where it is made records its callee once it is renamed out of sight. - Types: the intersection of a listed function or Proxy with Proxy holds no listed function. - AOTStringArena, AOTTypeArena, AOTStoragePool: an empty pool takes no room. - bmalloc/bmalloc.cpp, with mimalloc on Linux, where address space is kept aside: a request writes down the count of pieces let go of at every look, and reads the count behind a release that found no piece. - yarr/YarrJIT.cpp: under verboseRegExpCompilation, the table lookahead says where it searches for the first character of a match.
There was a problem hiding this comment.
Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.
Still open from earlier reviews (1):
- Unresolved: 1 minor or pre-existing.
Additional findings (outside the current diff — GitHub can't attach inline comments there):
-
🟡
Source/JavaScriptCore/b3/B3VectorizeLoops.cpp:1449— nit: Bottom-tested loops whose turn holds a branch that only chooses (the new Choice form) are never vectorized, although findTurn accepts them. dropPlansWhoseTurnsAreReadBehindLoop fills planOfBlock from plan.blocks and plan.blocksNeverEntered only (B3VectorizeLoops.cpp:1446-1449), not from plan.waysOfChoices, so the Upsilon in a way block that reads the element or a header Phi is taken for a read behind the loop at :1457-1463 and the plan is dropped. Fix: mark the way blocks of every choice with the plan's index too (iterate plan.waysOfChoices beside plan.blocks at :1446), so that only a user outside the turn drops the plan.Why this was flagged
A loop whose counter is tested at the bottom (plan.testsCounterBeforeStep false) and whose turn holds
to[i] = from[i] > limit ? limit : from[i]written as a branch reaches readChoices (B3VectorizeLoops.cpp:406), which adds the two ways to plan.blockSet and plan.waysOfChoices (:441-444) but not to plan.blocks. dropPlansWhoseTurnsAreReadBehindLoop (:1437) skips plans with a test at the top (:1442) and for the others sets planOfBlock only for plan.blocks and plan.blocksNeverEntered (:1446-1449); a way block keeps planOfBlock 0. The Upsilon in that way has the loaded element or the header Phi as its child, both owned by a block of the plan, so at :1457 found is the plan's index + 1 while planOfBlock of the way is 0, the child is neither a counter nor constant and the way is not never entered (:1460), and :1463 nulls the plan. The scalar loop keeps running; the base branch had no Choice form, so no vector loop is lost there, but the new form only ever applies where the test is at the top.Verification: In a bottom-tested loop whose turn holds a branch that only chooses, dropPlansWhoseTurnsAreReadBehindLoop (B3VectorizeLoops.cpp:1437) marks planOfBlock only from plan.blocks and plan.blocksNeverEntered (:1446-1449), leaving the way blocks at 0. At :1456-1463 the Upsilon in the
withinway is taken for a read behind the loop and the plan is nulled at :1463. The loop stays scalar.
…ween two values runs on vectors; internal/util/inspect is loaded for a printed value only where a class that needs it may have an instance - b3/B3UnrollLoops.cpp: where the upper end of a counted loop lies beyond a stretch of zero and the lower end may lie that far out too, the two ends are held against each other before the copy that polls is taken. A loop that is told by its upper end alone still needs no subtraction. The loops that are written out do the same at the start of a stretch. - b3/B3VectorizeLoops.cpp: the two ways of a choice belong to the turn wherever the counter is tested, and a way may hold alive what does not change from turn to turn. - Flow: a printed value nobody knows brings internal/util/inspect in only where an entry in use carries the feature of a host class whose own print calls it, beside a result of the host that no row describes. A feature listed under a condition counts where the condition may hold. - Flow: whether a named export that has escaped may be called is asked last, and only by a read that found a library module among its receivers. - Flow: a closure of the program is no instance of BoundFunction, so the inherited instanceof test on a function of the program keeps the tested value where it is. - The generator of the table of built-ins emits, for the front end, what each start-up function needs.
…the element barrier asks its first questions in place; a prediction reads fields by layout and name - codegen: the least frequency of warm code is found exactly, so a loop in a function that is entered once is written out and put on vectors like any other - codegen: behind a store into a long array the barrier asks the first questions of its stub in place and calls the stub for what is left; what is remembered is the same - B3VectorizeLoops: the step of a counter may be a product of two constants, as versionLoops writes the stride of a running index - MarkedBlockCage, ReservedRangeHeap: no cell lies where an address of the image could name it: the range starts at a distance from the base of the cage - flow: what a prediction reads is followed from where a value stands in sight: through fields by the receiver's layout and the name, calls, constructions, variables and captures - flow: a type test in an untyped body of the library narrows what is reached behind it - flow: the message of an error asks the constructor of a value for its name alone - flow: a function that the program stores under a key nobody knows may be a method that the host looks for, where the program can have that symbol in hand - flow: a spread, a rest pattern, Object.keys and its kin, Reflect.ownKeys and for-in ask a followed proxy by its ownKeys, getOwnPropertyDescriptor and get traps - flow: the rule of a record of data runs whether or not its block is reached - the engine asks the driver whether to go on right behind flow's rounds
…f the formatter is in hand by three ways alone - MarkedBlockCage: std::max takes uintptr_t on both sides, also where Elf64_Xword is unsigned long long - flow: a function under a key nobody knows counts as a method that the host looks for only where the program itself registers, lists or reads that symbol off a function of the host
…t versions of loops are added up in integers; the pairs of a Shuffle name registers to each other - b3/B3UnrollLoops: a sum of whole numbers is added up in integers in a fast version of a loop too, which still holds the paths behind the comparisons that were decided for it. Where the start of a sum is no constant, one question in front of the tests asks whether every sum starts at zero. - b3/air/AirAllocateRegistersByGreedy: the two halves of a pair of a Shuffle are neighbors, as the operands of a conditional move are: whichever half is assigned first names its register to the other. Only the AOT pipeline puts a Shuffle in front of register allocation. - heap/MarkedBlockCage: in a range that grows, an out-of-memory error that is made for cells is the error the program is owed, as it is for storage. - passes: SeparateUnlikelyLoopPaths and UnrollShortLoops ask whether a loop is expected to run: its header has normal frequency and is not cold. No tier is read. - inlining: in a cycle of a caller that is not cold, arguments that are expected to pass open the entry checks of the callee. - PlaceTypeTests: a wider proof is cast where it is passed on beside a class that no test tells apart. - flow: a read by key, and a question for the prototype, ask a followed proxy by its traps, whether or not the answer is used. - flow: one rule for what the host prints of a value nobody catches, and a row for Bun.inspect.table. The host comes to call only functions that are known. - flow: what a module of the library itself stored in its exports reaches them anyway: as the receiver of a member call they are handed to nobody new, unless code of the program has written to them. - what the table of built-ins only guesses is left to the engine to ask for, unless the program holds a host module for certain. - six tables that only a build reads are made at first use. - testaot lists its longest native tests first.
…may be no function keeps its throw; the options of a host function are described by their paths - b3/B3LowerToAir: under the AOT selection policy a 32-bit Phi that is widened more than twice as often as it is handed a value cut off 64 bits is handed its values by Move32, so no turn of a loop copies the counter. - b3/air/AirAllocateRegistersByGreedy: a register that a frame saves is no wish for the half of a cut live range that does more than cross the border. - jit/GCAwareJITStubRoutine, heap/JITStubRoutineSet: the handler of a stub stays in the CodeBlock's table until the routine is destroyed, as its CallSiteIndex stays reserved. - DeferInitializers asks the rule of effects whether a call or a construction may throw before it enters; a definition that makes a name read-only moves only under a name under which no store to a function moves; a static member whose written key spells "prototype" stays. - HoistTestsIntoPredecessors: a guard on a parameter of a block, where some edge proves the expected type, goes to the ends of the other edges. - OutlineColdOperations keeps what holds the subject of a guard's proof. - flow: what a getter of the exports of a library module answers lies under its own name on the namespace; a store into the exports behind the body of their module may be the program's; a module object behind a check is carried out as a value too; a host class that is only read has no instance. - flow: a rule is shown what is covered by now; functions of the engine that have escaped are followed behind the rounds like closures. - flow: operands that a row only inspects or passes to code of the program stay followed; an operand read as a dictionary takes any object, and what is described is what is read out of it; Bun.spawn, Bun.listen and Bun.connect say each option by its path. - the shell of the tests counts instructions; the pass runner clears its schedule only where one ran.
… in its body again - passes/AOTModuleVariables: a definition by a descriptor is looked for among the uses of the function in one body, as before.
main is at f495db1 (#930). There is no conflict. Three files changed on both sides and merged by themselves: aot/builtins/engine-syntax.builtins.ts, runtime/VM.cpp and yarr/YarrJIT.cpp. #930 adds five tests that name a function of the engine by its number: find (35), flatIntoArrayWithCallback (41), flatMap (42), the next of the array iterator (69) and performIteration (73). Upstream 37aa2b5 deleted number 23, so each is one lower on this branch. 22 numbers change in codegen/prologue/a-loop-beside-rare-calls-takes-no-register-that-a-frame-saves.ir and in four files of valueflow/host/. #930 takes four ShadowRealm functions out of the list of numbered functions and moves no other number. aot/builtins/generator/engine.ts runs on the merged tree, and its list is the list of #930 without number 23.
…compiler docs (#47129) Follow-up to #45631. Upgrades WebKit to oven-sh/WebKit `main` at f495db1d2488 (oven-sh/WebKit#930), which holds the engine's half of this work. Most of this is behind `--aot`. The first two sections list what is not. ### Changes that reach Bun without `--aot` - **`node:path`:** the native functions take the width of a substring's characters from its base's storage as it is now. `test/js/node/path/string-forms.test.ts` covers it. - **Heap snapshots:** `Bun.generateHeapSnapshot()`, its V8 form and the heap profiler release the profiler's snapshot once the JSON is built. - **`execve`:** the suspension lock is held over `execve`. - **`process.env` on Windows:** `Object.preventExtensions()`, `Object.seal()` and `Object.freeze()` throw a `TypeError`, as in Node. - **Module loader:** follows `VM::synchronousModuleQueue()` from the WebKit upgrade. - **Windows:** the crash handler registers with `WTFSetAbortReporter()`. - **Parser:** a class records whether `useDefineForClassFields: false` turned its fields into assignments in the constructor. `declare` is a name on the left of `for-of`, `for-in` and `for await`, and before every kind of line break. Any of the language's line breaks may follow `global`. - **`bun check`:** a ring of functions without annotations resolves in linear time. Only callable built-ins join a function type. The type of a well-known symbol is `symbol`. `--timing` prints the number of queries. ### `bun build --compile` - **`Bun.build({ compile })`:** `import.meta.main` is inlined for the entry point, as on the command line. - **Windows:** where the section table has no free slot for the payload's header, the sections' data is laid out again behind a table that has one. - **macOS:** the executable is built and signed over a private mapping of the template and written page by page, so the process never holds the whole file in memory. - **macOS:** a compiled executable no longer starts a background thread at boot to load the system CA certificates. They load on first use, on the thread that asks, as before #45631. The flag for it, and the search of the output for `getCACertificates` that set the flag without `--aot`, are removed with their tests. - **`node:fs` on paths inside an executable:** the asynchronous calls on Windows name each path in an error as the caller wrote it. Asynchronous `statfs()` answers for the file system that holds the executable. - **`--trim`:** - On macOS, stack traces and the allocator's override know the several code segments of a trimmed executable. - The two TLS hooks that only the WebSocket client calls go with it. - On Windows, the tool tells a member of an archive from a file of the same name. - On Windows, a build on a trim template fills holes and joins pieces over them, so it cuts what a build on Bun cuts. ### The ahead-of-time compiler - **Modules:** - One set of `__esModule` marks serves both kinds of module. - Export tables of re-exporting files are limited like those of other files. - A name taken from a JSON import loads the files in between, so files that a package lists under `sideEffects` run. - A name that a library module lacks can be read off its namespace. - **CommonJS:** under `"type": "module"`, a default import holds what the link captured. It takes the short path only where nothing stores to `module.exports` after the body ends. - **Module names from lists and tables:** a walk of a list (`forEach`, `map`, `filter`, `find` and so on) counts as leaving the list unchanged only under these conditions: - its callback is written in the call - the callback has no rest parameter - the callback cannot reach itself through `arguments`, a direct `eval` or its own name - **Projects with a second `tsconfig.json`** take what the application's load found: `import.meta.main`, file identities, erased sites and folded constants. - **Classes:** - An unused class is removed whole only where its heritage is proven. - Methods stored on a constructor function's `prototype` are members of its layout. - **Workers:** - Whether the files and texts that Workers start from form one program with the rest is decided after the front end, before the engine's first run. - A Worker that finds no room for its thread waits for siblings that are ending, and is tried again on a timer. - **`node:http`:** only what `new ServerResponse()` makes takes the compact form. An instance of a subclass, and an object that `ServerResponse` is called on, keeps its state on itself. - **Build:** a third list of the engine's sources is compiled for minimum size. Dependencies that no code of a crate uses are gone from 13 `Cargo.toml` files. ### Docs `docs/compiler` is rewritten and about 5,800 lines shorter. Each page keeps a runnable example, which `test/cli/aot-docs.test.ts` runs. `docs/snippets/compiler-internals.jsx` had no importer left and is removed. The table of libraries known not to work moves next to its test. ### Tests and CI The ahead-of-time compiler's tests run in the ordinary `test-bun` shards. The `test-aot` and `test-aot-drawn` steps, their path triggers, draws and shares are gone, and so is every step that was allowed to fail. Every pull request gets the same pipeline. - **Lanes:** every test of the compiler runs on the two Alpine lanes. The other lanes run the ones that ask something of the system: processes, Workers, the environment, files, sockets, memory limits, the image, native code. Windows also runs the `.ir` tests. The lane with AddressSanitizer runs all but a list of files that feed it nothing new, on a copy of Bun without its debug information. The lists are in `scripts/runner.node.ts`, and a test file that says `// Runs alone:` stays out of the bucket of files that run side by side. - **Whole programs** are small files under `test/aot/parallel/`. Each passes when its executable exits and prints as `bun <file>` does, on Alpine also with its types erased. The runner runs them side by side, as it does Node's tests. - **Source to IR:** files under `test/aot/ir/` with `// RUN: lower` and `// CHECK:` lines. `cargo test` runs them in one Buildkite step. `AOT_IR_UPDATE=1` writes everything below a `// GENERATED:` line again. - **IR to IR, and IR to B3:** `.ir` files under `test/aot/engine-tests/`, run by `testaot` with Bun's table of built-ins. `bun test/aot/tools/update-ir-tests.ts` writes a file's input from its source and its expectation from its input. - **Servers, frameworks and packages** are ordinary test files: `test/aot/servers/`, `test/aot/frameworks/`, `test/aot/backend-packages/`. - **Frameworks:** Next and Angular compile to one file. Nuxt and SvelteKit compile with `--compile-in-place`. Each of these four has caught a compiler bug that no smaller test showed. The Astro and React Router apps never did, and building the site is most of what these tests cost, so those two apps are removed. The twelve units (six apps, two forms each) become four test files. - **Generators** moved to `test/aot/fuzz/`, where `bun test/aot/fuzz/run.ts` draws from them. No test file starts one. - The stored programs were cut to those that cover an edge of the compiler that no cheaper one covers, and those that came in with a fix. - `bun run rust:test` runs the Rust crates' unit tests in the same Buildkite step. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…930 (#934) Follow-up to #930. Most of it is under `Source/JavaScriptCore/aot/`. The first section lists what is not. ### Outside `aot/` - **B3 and Air**, each behind a flag of the procedure's policy that only the ahead-of-time compiler sets: - `Math.min` and `Math.max` lower to selects, and on x86-64 to `minsd` and `maxsd` where the operands allow it. - `a == 1 || a == 2 || a == 3 || a == 4` as a value is one test of a bit, with no branch. - A branch on a zero- or sign-extended value tests the value. - `ConvertBranchesToSelects`, `RotateLoops` and `ThreadJumps` take a few more forms. `RotateLoops` tests every back edge that is not rare at the bottom. A double made from integers and finite constants equals itself. `SinkValues` places the load of the next link below the other reads through the link. `HoistCommonMoves` hoists the copies on a loop's back edges. - **Air's insertion sets** reserve their capacity. This is the one change that reaches every user of B3. - **`VM`:** `BytecodeIntrinsicRegistry` is created on first use when the VM has compiled code. The eight `performProxyObject*` functions are created only when it has none. - **`InternalFunction`:** a native constructor that `super(..)` of compiled code has entered gives the object the Structure of that class. - **`ReservedRangeHeap`:** the purge at a Worker's end is not forced. On Linux a range that is reserved without access is mapped so from the start. - **`WTF::OSAllocator`:** on Linux it stops naming mappings once the kernel has refused a name. - **`SamplingProfiler`:** inside `#if ENABLE(AOT)`: a frame whose callee is a compiled function counts as compiled where the pc is not yet in its code. - **`StructureRareData`:** inside `#if ENABLE(AOT)`: the absence of a special property is cached for the compact function objects of compiled code. - **Heap**, only where `MarkedBlockCage::isRequired()`: when an allocator outside the cage has no memory, the allocation returns null and the caller throws, without starting a collection first. - **`WTF::HashTable`:** `tryReserveCapacityForAdd()` grows a table now if adding more keys would, and leaves it as it was where there is no memory. No existing function changes. Under a limit on address space the table of Symbols grows ahead of need; elsewhere `Symbol::finishCreation()` pays one load and a branch. ### Behavior of compiled programs - **Calls without a receiver:** a call that names no receiver hands `undefined` on as `this` through a proxy and into functions of the library. - **Stack overflow:** a `finally` or `catch` runs when a call, getter, setter or method of the program itself overflows the stack. - **Out of memory:** an operation that cannot allocate throws where it returns into a function: at a return address that has a call site of its own, or in a function without handlers. Under a handler the site names the handler, so the error unwinds from the site like any other. A loop poll inside a `try` keeps its handler, because it throws the error that an earlier operation could not throw itself. - **Fused chains of array methods:** `list.map(f).filter(g)` runs each method to completion where a later callback may overflow the stack. - **Modules of the library:** a body that was compiled to be entered once, and threw, gives the next request the same error. - **Read-only names:** a store under a name that `Object.defineProperty` made read-only throws wherever the store is. - **Host objects:** an object of unknown origin may back a property with a native accessor, and a copy by descriptors copies its getter and setter. - **`--cpu-prof`:** a sample taken in native code goes to the compiled function that called it. On x86-64 the walk goes by what the calls on the stack say they entered. - **`node:fs`** lists the files of a program that have code. - **Foreign callbacks:** their block follows what the target was built without and what `--trim` removes. Under the strict flag `node:vm` marks an image as `eval` does. ### Flow analysis - Every string constant is tracked separately, not only those used as a property key somewhere in the program. - A switch that names every string of a union drops its last comparison and the arm after it. - Two array types that prove different storage intersect to nothing. - A collection, a poll or an allocation writes the weak tables alone. - An escaped constructor function makes its instance, and stores are followed after the rounds. - An object constructed by a function that only passes `this` on has a layout, with fields from the stores and the `Object.defineProperty` calls seen to reach it. - In a very large program the body of an async function runs as often as the function that starts it. - Library modules that only a file other than the entry imports by a statement count as loaded, so a server has the same code as the entry and as an imported file. ### Code - **Sets and Maps:** a walk reads table, size and entries ahead of the loop. - **Lists:** `at()`, `indexOf()`, `includes()` and `pop()` use the kind of storage that the type proves. A `for-in` loop over a list gets a copy of its body in which the key is an integer. - **Loops:** `k + 1 < length` bounds the counter as `k < length - 1` does. - **Subclasses of `Map`, `Set`, `WeakMap`, `WeakSet` and the `Error` family:** their objects carry a brand of the class in their Structure, and typed code runs on them. For subclasses of `Date`, `RegExp`, `Promise`, typed arrays, `ArrayBuffer`, `DataView` and host classes, the built-in class takes the place of the layout in declared types. Instances of subclasses of `Array` are read by index, iterated by for-of and destructured by an array pattern without a call. - **Calls:** `f.apply(t, list)` passes an array through unchanged. A short function whose rest parameter goes only into the lists of its calls is copied into the caller that made the list. A result is returned where its type puts it, also after a call through the method table. The statements of a short `finally` block are duplicated for each way in. - **Objects:** `{ ...defaults, ...options }` keeps the names of the first copy. A closure whose creation a field deferred is created at the first read of its slot. `const node = createNode(kind); node.left = left;` names a late field of the layouts followed to `node`. A spread, a rest or an `Object.assign` of one proven order is written out in code that runs once, and an object is expected to get its late keys in the order of the stores in the source. - **`JSON.stringify`:** a serializer writes any order of keys where every written member is read from its slot. - **Typed `JSON.parse`:** a learned form may hold lists of numbers, strings, booleans, records and lists. - **Reads by key:** a name read by key in an object that also has elements is answered in the stub, and a function is a key like any other. - **Built-ins on proven receivers:** `view.set()`, `Buffer.copy()` and `performance.now()` stay out of the general call. - **Strings:** a key that is one of a few names is compared without a test of its form. An untyped `out += piece` is one call. The length of a string that is one of a few constants is selected by its index. ### Startup - The code of an image is mapped by one call, and the process's personality is queried once. - `process.stdout`, `process.stderr` and `process.stdin` have light forms that bring in no stream until something needs one. - A store that creates a field stays in its stub where the name changed only on an unrelated chain. - `StructureTable::forgetStructuresOf()` walks what was made, not every shape of the image. - The tables a VM creates at startup are parts of one mapping, which is released in one call when the VM ends. ### Build - The steps after flow's rounds run on all threads. - Large literals, unions and chains of small lists build in linear time. - The lists of sources that are compiled for size apply to clang-cl too. ### Checks - A build that reports when an unreachable end is reached says which pass created it. It plans objects and closures into frames as any other build does, and a use of one after its frame has ended names the allocation. It also checks the mutations that a layout is claimed never to see. - The sources of `aot/` are compiled with `-Werror=dangling`. - Generated IR tests carry source positions. - In a validating build a folded instance test is still performed, and its answer is compared. - IR tests under `aot/tests/answers/` run small closed programs and compare their answers with the shell's own run of the same source. - Tests that read the sources are removed.
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 -->
Follow-up to #927, from the same branch.
JSON.parsetakes the learned path for a record inside another as it did before, and keeps what it learned where a member holds a record ornull.Proxy, the library's helpers and the members of host classes, so a small program compiles fewer library functions.await. The names of a CommonJS entry point are taken when the file has run.statistics.defhas four counts of work that the scaling tests read.Object.freeze()of a module namespace throws. Rows of a typedsqlquery are made as typed objects.DeferInitializersasks the rule of effects whether a call or a construction may throw before it enters, and a static member whose written key spellsprototypestays where it is.Bun.spawn,Bun.listen,Bun.connectandfetchare described by their paths.testb3cases.Shufflename registers to each other, and a register that a frame saves is no wish for the half of a cut live range that does more than cross the border.testaotwrites its output in binary mode on Windows, andrun-in-shellhands its leading--words to the shell.Outside
aot/andb3/:runtime/(CyclicModuleRecord.cpp,JSMicrotask.cpp,JSModuleLoader.cpp,JSONObject.cpp), each under#if ENABLE(AOT)and taken only for compiled modules.heap/ReservedRangeHeap.cpp: a build without mimalloc hands out granules of the reserved range itself.heap/MarkedBlockCage.cpp,runtime/VM.cpp: the dead stack that is cleared lies below the frame that asks, and goes down to the stack limit of the running thread.heap/MarkedBlockCage.*,heap/ReservedRangeHeap.*: no cell lies where an address of the image could name it: the range starts at a distance from the base of the cage.bmalloc/bmalloc.cpp, with mimalloc on Linux, where address space is kept aside: a request that finds no piece to let go of looks once more if a piece was let go of since its last look.assembler/(LinkBuffer.cpp,X86JumpShortening.h): the recorded link sites and jumps arrive as a few ascending runs and are merged rather than sorted.wasm/(WasmBinding,WasmCodeInImage.cpp,WasmOMGIRGenerator.cpp,js/JSToWasm.cpp): code for an image cages a memory's base through two slots of its pointer table. Only builds with a Gigacage have the slots and the instructions; other code is generated as before.yarr/(YarrInterpreter.cpp,YarrJIT.cpp): underverboseRegExpCompilation, a line says which matcher a pattern runs on..gitignore:rustc-ice-*.txt.