mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
### What does this PR do?
- **Use `Latin1Character` instead of `LChar`**
- **Fix for
0875bc8f62**
### How did you verify your code works?
---
# WebKit Update Summary (September 2025)
## Overview
This document summarizes the major changes in WebKit/JavaScriptCore from
the September 2025 update. The update includes approximately 254
JSC-related commits with significant improvements to performance,
stability, and developer experience.
## Critical Bug Fixes
### Memory Safety
- **operationMaterializeObjectInOSR fix** (5c7aadfa0a96): Fixed
uninitialized Butterfly storage during OSR exits with sunk Array
allocations. This prevents potential crashes when arrays with holes are
materialized during OSR exit.
- **FTL materialization fixes** (a72d19840714, ed1e6fe03899): Added
missing internal object type handling in FTL materialization, improving
stability during optimization bailouts.
### Promise and Async Improvements
- **JSPromiseReaction object** (a1cb5e087a46, later reverted in
b0566a4db201): Initially introduced to improve promise reaction handling
but was reverted due to compatibility issues with Bun's modifications.
- **Async stack traces enhancements**:
- Added support for `Promise.any` in async stack traces (d9a997b3edaa)
- Added empty JSValue checking for async stack trace safety
(9d26223d4bcb)
- Promise.all support was added and later reverted due to performance
concerns
## Performance Optimizations
### JIT Compiler Improvements
- **B3 Immutable Loads** (570a3530f949, 62300f8db3d9): Added
immutability annotations and CSE optimizations for loads that can look
for targets in dominators
- **BBQ JIT enhancements**:
- Fixed callee-save register handling (c7ae05719045)
- Simplified F32 copysign operations (e0651af57025)
- **DFG optimizations**:
- Fixed RegExp constant folding with materialized NewRegExp nodes
(7b53a04a5afa)
- Improved RegExp object node handling in strength reduction
(eeb65e05095b)
### WebAssembly Improvements
- **WASM SIMD Support**:
- Added v128 support for IPInt call and tail-call instructions
(73f0c9d430cb)
- Implemented v128 support in local.get, local.set, global.get,
global.set (67d7bf15139a)
- Added x86_64 SIMD integer arithmetic and float instructions
- **WASM Memory Management**:
- Introduced WasmInstanceAnchor for better instance lifecycle management
(f9f1ed183bf7)
- Attached AbstractHeap to wasm memory access for better optimization
(f183c6f7def4)
- Added signal handling for null checks in wasm (bf18b5b709f3)
- **WASM Debugging**: Added LLDB debugging infrastructure for
WebAssembly (e03c10225cc8)
## API and Language Features
### Iterator Helpers
- Merged `Iterator.prototype.sliding` into `Iterator.prototype.windows`
(1d49e823702d)
- Optimized iterator next method calls using CachedCall (5ee92514060c)
### Math Extensions
- Improved performance of `Math.sumPrecise` implementation
(602294057337)
### Error Handling
- Enhanced error messages for for-of loops without Symbol.iterator
(0051bbf2491f)
## Infrastructure Changes
### Character Type Refactoring
- **LChar to Latin1Character rename** (63b97b511366, 1424f0687876):
Major refactoring replacing the `LChar` type with `Latin1Character`
throughout the codebase for better clarity
- Additional fixes for Latin1Character usage (711eab3243f0,
50bf8e6fd4ca, 88e29ab76aec)
### Build System
- Fixed builds with GCC 15.x (e33b18bc59d6)
- Added gitattributes for JSC test files (82c4cc796da6)
- Improved test runner with comprehensive verbose logging (7ef95c177a42)
- Added memory-limited annotations for tests using excessive memory
(b991cd17d612)
### Testing Infrastructure
- Improved handling of missing test executables (db1e3bbb3be2)
- Added support for non-customized ICU 74.2 in intl tests (c922a28b6642)
- Fixed various test configuration issues and timeouts
## Bun-Specific Modifications
### Preserved Customizations
- Maintained `BUN_JSC_ADDITIONS` for Bun-specific features
- Kept async context support for AsyncLocalStorage
- Preserved V8 heap snapshot compatibility layer
- Maintained custom inspector extensions
### Conflicts Resolved
- Successfully merged upstream changes while preserving Bun's event loop
integration
- Resolved conflicts in promise handling while maintaining Bun's async
behavior
- Fixed re-declaration issues with `isAsyncFrame` for async stack traces
## Breaking Changes and Reverts
### Reverted Features
1. **JSPromiseReaction object**: Reverted due to conflicts with Bun's
promise handling
2. **Promise.all async stack trace support**: Reverted due to ~4%
performance regression in JetStream3/doxbee-async benchmark
3. **Array.prototype.flat C++ implementation**: Reverted (reason not
specified in commit)
## Security Improvements
- Type safety improvements with uncheckedDowncast for Wasm::Callee
(48425afd643d)
- Added bounds checking and validation for Wasm array operations
(b5148db1c4c1)
- Improved memory safety with proper initialization of materialized
objects
## Platform Support
- macOS: Continued support for x64/arm64
- Linux: Maintained glibc/musl compatibility
- Windows: Preserved x64 support
- Fixed platform-specific alignment issues for x86_64 (94a60eb123c5)
## Notable Debugging Enhancements
- LLDB infrastructure for WebAssembly debugging
- Improved verbose command logging in test runners
- Enhanced stack trace capabilities for async functions
- Better error reporting for missing Symbol.iterator
## Performance Metrics
- Several memory optimizations for test execution
- JIT memory reservation size adjustments for debug builds
- Optimized iterator operations with cached calls
- Improved Math.sumPrecise performance
## Future Considerations
- The JSPromiseReaction implementation may need revisiting with adjusted
architecture
- Async stack trace support for Promise.all requires performance
optimization
- Continued work on WASM SIMD support for additional operations
## Migration Notes for Bun Team
1. **LChar usage**: All references to `LChar` have been replaced with
`Latin1Character`
2. **Promise handling**: The reverted JSPromiseReaction changes indicate
potential architectural conflicts that may need addressing
3. **Test configuration**: New memory-limited annotations should be used
for memory-intensive tests
4. **Build flags**: Ensure USE_BUN_JSC_ADDITIONS and USE_BUN_EVENT_LOOP
remain enabled
102 lines
3.1 KiB
CMake
102 lines
3.1 KiB
CMake
option(WEBKIT_VERSION "The version of WebKit to use")
|
|
option(WEBKIT_LOCAL "If a local version of WebKit should be used instead of downloading")
|
|
|
|
if(NOT WEBKIT_VERSION)
|
|
set(WEBKIT_VERSION 6d0f3aac0b817cc01a846b3754b21271adedac12)
|
|
endif()
|
|
|
|
string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX)
|
|
|
|
if(WEBKIT_LOCAL)
|
|
set(DEFAULT_WEBKIT_PATH ${VENDOR_PATH}/WebKit/WebKitBuild/${CMAKE_BUILD_TYPE})
|
|
else()
|
|
set(DEFAULT_WEBKIT_PATH ${CACHE_PATH}/webkit-${WEBKIT_VERSION_PREFIX})
|
|
endif()
|
|
|
|
option(WEBKIT_PATH "The path to the WebKit directory")
|
|
|
|
if(NOT WEBKIT_PATH)
|
|
set(WEBKIT_PATH ${DEFAULT_WEBKIT_PATH})
|
|
endif()
|
|
|
|
set(WEBKIT_INCLUDE_PATH ${WEBKIT_PATH}/include)
|
|
set(WEBKIT_LIB_PATH ${WEBKIT_PATH}/lib)
|
|
|
|
if(WEBKIT_LOCAL)
|
|
if(EXISTS ${WEBKIT_PATH}/cmakeconfig.h)
|
|
# You may need to run:
|
|
# make jsc-compile-debug jsc-copy-headers
|
|
include_directories(
|
|
${WEBKIT_PATH}
|
|
${WEBKIT_PATH}/JavaScriptCore/Headers/JavaScriptCore
|
|
${WEBKIT_PATH}/JavaScriptCore/PrivateHeaders
|
|
${WEBKIT_PATH}/bmalloc/Headers
|
|
${WEBKIT_PATH}/WTF/Headers
|
|
${WEBKIT_PATH}/JavaScriptCore/DerivedSources/inspector
|
|
${WEBKIT_PATH}/JavaScriptCore/PrivateHeaders/JavaScriptCore
|
|
)
|
|
endif()
|
|
|
|
# After this point, only prebuilt WebKit is supported
|
|
return()
|
|
endif()
|
|
|
|
if(WIN32)
|
|
set(WEBKIT_OS "windows")
|
|
elseif(APPLE)
|
|
set(WEBKIT_OS "macos")
|
|
elseif(UNIX)
|
|
set(WEBKIT_OS "linux")
|
|
else()
|
|
message(FATAL_ERROR "Unsupported operating system: ${CMAKE_SYSTEM_NAME}")
|
|
endif()
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
|
|
set(WEBKIT_ARCH "arm64")
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|x64|AMD64")
|
|
set(WEBKIT_ARCH "amd64")
|
|
else()
|
|
message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
|
|
endif()
|
|
|
|
if(LINUX AND ABI STREQUAL "musl")
|
|
set(WEBKIT_SUFFIX "-musl")
|
|
endif()
|
|
|
|
if(DEBUG)
|
|
set(WEBKIT_SUFFIX "${WEBKIT_SUFFIX}-debug")
|
|
elseif(ENABLE_LTO)
|
|
set(WEBKIT_SUFFIX "${WEBKIT_SUFFIX}-lto")
|
|
else()
|
|
set(WEBKIT_SUFFIX "${WEBKIT_SUFFIX}")
|
|
endif()
|
|
|
|
if(ENABLE_ASAN)
|
|
# We cannot mix and match ASan Bun + non-ASan WebKit, or vice versa, because some WebKit classes
|
|
# change their layout according to whether ASan is used, for example:
|
|
# https://github.com/oven-sh/WebKit/blob/eda8b0fb4fb1aa23db9c2b00933df8b58bcdd289/Source/WTF/wtf/Vector.h#L682
|
|
set(WEBKIT_SUFFIX "${WEBKIT_SUFFIX}-asan")
|
|
endif()
|
|
|
|
setx(WEBKIT_NAME bun-webkit-${WEBKIT_OS}-${WEBKIT_ARCH}${WEBKIT_SUFFIX})
|
|
set(WEBKIT_FILENAME ${WEBKIT_NAME}.tar.gz)
|
|
setx(WEBKIT_DOWNLOAD_URL https://github.com/oven-sh/WebKit/releases/download/autobuild-${WEBKIT_VERSION}/${WEBKIT_FILENAME})
|
|
|
|
if(EXISTS ${WEBKIT_PATH}/package.json)
|
|
file(READ ${WEBKIT_PATH}/package.json WEBKIT_PACKAGE_JSON)
|
|
|
|
if(WEBKIT_PACKAGE_JSON MATCHES ${WEBKIT_VERSION})
|
|
return()
|
|
endif()
|
|
endif()
|
|
|
|
file(DOWNLOAD ${WEBKIT_DOWNLOAD_URL} ${CACHE_PATH}/${WEBKIT_FILENAME} SHOW_PROGRESS)
|
|
file(ARCHIVE_EXTRACT INPUT ${CACHE_PATH}/${WEBKIT_FILENAME} DESTINATION ${CACHE_PATH} TOUCH)
|
|
file(REMOVE ${CACHE_PATH}/${WEBKIT_FILENAME})
|
|
file(REMOVE_RECURSE ${WEBKIT_PATH})
|
|
file(RENAME ${CACHE_PATH}/bun-webkit ${WEBKIT_PATH})
|
|
|
|
if(APPLE)
|
|
file(REMOVE_RECURSE ${WEBKIT_INCLUDE_PATH}/unicode)
|
|
endif()
|