Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1116b17
feat(string): implement RopeString with thin vtable and lazy flattening
akash-R-A-J Mar 11, 2026
c2d6dca
fix: cross-platform path resolution and clippy warnings
akash-R-A-J Mar 12, 2026
d4b634f
docs: fix broken intra-doc links in boa_string
akash-R-A-J Mar 12, 2026
66e1582
feat(string): implement robust rope rebalancing and fix memory safety…
akash-R-A-J Mar 12, 2026
258bbc2
fix(string): resolve seg fault, memory leak, and recursion limits
akash-R-A-J Mar 13, 2026
44389c5
refactor(string): refine rope implementation and cleanup vtable integ…
akash-R-A-J Mar 14, 2026
e59d576
fix(string): escape brackets in rope doc comments
akash-R-A-J Mar 14, 2026
94e1fff
perf(string): switch OnceLock to OnceCell
akash-R-A-J Mar 14, 2026
b2b9f83
fix(string): revert OnceCell to OnceLock due to reentrancy panic
akash-R-A-J Mar 14, 2026
a8ee04e
fix(string): resolve rope SIGSEGV via raw-buffer cache
akash-R-A-J Mar 15, 2026
f40dea1
fix(string): ensure 32-bit compatibility for rope thresholds
akash-R-A-J Mar 15, 2026
5181de9
refactor(string): unify JsStr as enum and support unflattened ropes
akash-R-A-J Mar 15, 2026
2d73457
perf(string): optimize rope performance with leaf sinking
akash-R-A-J Mar 16, 2026
4b3696f
docs: fix rustdoc intra-doc links for private items
akash-R-A-J Mar 16, 2026
f3b84e6
fix(string): stabilize rope implementation and address edge cases
akash-R-A-J Mar 17, 2026
ba37ac3
refactor(string): maintain rope laziness in date, number and regexp b…
akash-R-A-J Apr 1, 2026
72cd1ee
perf(string): kind-indexed vtable dispatch and u32 fibonacci thresholds
akash-R-A-J Sep 20, 2026
ffda8ec
fix: restore parseFloat input trimming
akash-R-A-J Nov 17, 2026
a648977
fix: resolve clippy needless_bool and wasm test unfulfilled lint expe…
akash-R-A-J Nov 18, 2026
9fc208b
ci: exclude boa_string from semver check and restore legacy type aliases
akash-R-A-J Nov 18, 2026
1331101
chore: merge upstream/main and bump version to 0.23.0
akash-R-A-J Nov 23, 2026
b6926e4
refactor(string): scope internal types to pub(crate), add RopeSlice::…
akash-R-A-J Nov 25, 2026
3a16e53
Merge branch 'upstream/main' into feat/rope-strings
akash-R-A-J Nov 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exclude = [

[workspace.package]
edition = "2024"
version = "0.22.0"
version = "0.23.0"
rust-version = "1.100.0"
authors = ["boa-dev"]
repository = "https://github.com/boa-dev/boa"
Expand All @@ -36,16 +36,16 @@ description = "Boa is a Javascript lexer, parser and compiler written in Rust. C
[workspace.dependencies]

# Repo Crates
boa_ast = { version = "~0.22.0", path = "core/ast" }
boa_engine = { version = "~0.22.0", path = "core/engine", default-features = false }
boa_gc = { version = "~0.22.0", path = "core/gc" }
boa_icu_provider = { version = "~0.22.0", path = "core/icu_provider" }
boa_interner = { version = "~0.22.0", path = "core/interner" }
boa_macros = { version = "~0.22.0", path = "core/macros" }
boa_parser = { version = "~0.22.0", path = "core/parser" }
boa_runtime = { version = "~0.22.0", path = "core/runtime" }
boa_string = { version = "~0.22.0", path = "core/string" }
boa_wintertc = { version = "~0.22.0", path = "core/wintertc" }
boa_ast = { version = "~0.23.0", path = "core/ast" }
boa_engine = { version = "~0.23.0", path = "core/engine", default-features = false }
boa_gc = { version = "~0.23.0", path = "core/gc" }
boa_icu_provider = { version = "~0.23.0", path = "core/icu_provider" }
boa_interner = { version = "~0.23.0", path = "core/interner" }
boa_macros = { version = "~0.23.0", path = "core/macros" }
boa_parser = { version = "~0.23.0", path = "core/parser" }
boa_runtime = { version = "~0.23.0", path = "core/runtime" }
boa_string = { version = "~0.23.0", path = "core/string" }
boa_wintertc = { version = "~0.23.0", path = "core/wintertc" }

# Utility Repo Crates
tag_ptr = { version = "~0.1.0", path = "utils/tag_ptr" }
Expand Down
16 changes: 9 additions & 7 deletions cli/src/debug/string.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use boa_engine::{
Context, JsNativeError, JsObject, JsResult, JsValue, NativeFunction, js_string,
object::ObjectInitializer, property::Attribute, string::JsStrVariant,
object::ObjectInitializer, property::Attribute, string::JsStr,
};

fn storage(_: &JsValue, args: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
Expand Down Expand Up @@ -34,9 +34,10 @@ fn encoding(_: &JsValue, args: &[JsValue], _: &mut Context) -> JsResult<JsValue>
};

let str = string.as_str();
let encoding = match str.variant() {
JsStrVariant::Latin1(_) => "latin1",
JsStrVariant::Utf16(_) => "utf16",
let encoding = match str {
JsStr::Latin1(_) => "latin1",
JsStr::Utf16(_) => "utf16",
JsStr::Rope(_) => "rope",
};
Ok(js_string!(encoding).into())
}
Expand All @@ -55,9 +56,10 @@ fn summary(_: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult<JsV
};

let storage = if string.is_static() { "static" } else { "heap" };
let encoding = match string.as_str().variant() {
JsStrVariant::Latin1(_) => "latin1",
JsStrVariant::Utf16(_) => "utf16",
let encoding = match string.as_str() {
JsStr::Latin1(_) => "latin1",
JsStr::Utf16(_) => "utf16",
JsStr::Rope(_) => "rope",
};

let summary = ObjectInitializer::new(context)
Expand Down
15 changes: 10 additions & 5 deletions core/engine/src/builtins/date/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::{JsStr, JsString, context::HostHooks, js_string, value::IntegerOrInfinity};
use boa_macros::js_str;
use boa_string::JsStrVariant;
use std::slice::Iter;
use std::str;
use std::{borrow::Cow, iter::Peekable};
Expand Down Expand Up @@ -753,22 +752,28 @@ pub(super) fn pad_six(t: u32, output: &mut [u8; 6]) -> JsStr<'_> {
/// [spec-format]: https://tc39.es/ecma262/#sec-date-time-string-format
pub(super) fn parse_date(date: &JsString, hooks: &dyn HostHooks) -> Option<i64> {
// All characters must be ASCII so we can return early if we find a non-ASCII character.
let owned_js_str = date.as_str();
let date = match owned_js_str.variant() {
JsStrVariant::Latin1(s) => {
let date = match date.as_str() {
JsStr::Latin1(s) => {
if !s.is_ascii() {
return None;
}
// SAFETY: Since all characters are ASCII we can safely convert this into str.
Cow::Borrowed(unsafe { str::from_utf8_unchecked(s) })
}
JsStrVariant::Utf16(s) => {
JsStr::Utf16(s) => {
let date = String::from_utf16(s).ok()?;
if !date.is_ascii() {
return None;
}
Cow::Owned(date)
}
JsStr::Rope(_) => {
let date = date.as_str().to_std_string().ok()?;
if !date.is_ascii() {
return None;
}
Cow::Owned(date)
}
};

// Date Time String Format: 'YYYY-MM-DDTHH:mm:ss.sssZ'
Expand Down
2 changes: 1 addition & 1 deletion core/engine/src/builtins/intl/segmenter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl SegmentIterator {
.downcast_ref::<Segmenter>()
.js_expect("segment iterator object should contain a segmenter")
.ok()?;
let mut segments = segmenter.native.segment(string.variant());
let mut segments = segmenter.native.segment(string.as_str());
// the first elem is always 0.
segments.next();
segments
Expand Down
12 changes: 5 additions & 7 deletions core/engine/src/builtins/intl/segmenter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
string::StaticJsStrings,
};
use boa_gc::{Finalize, Trace};
use boa_string::JsStrVariant;
use boa_string::JsStr;
use icu_collator::provider::CollationDiacriticsV1;
use icu_locale::Locale;
use icu_segmenter::{
Expand Down Expand Up @@ -63,12 +63,9 @@ impl NativeSegmenter {

/// Segment the passed string, returning an iterator with the index boundaries
/// of the segments.
pub(crate) fn segment<'l, 's>(
&'l self,
input: JsStrVariant<'s>,
) -> NativeSegmentIterator<'l, 's> {
pub(crate) fn segment<'l, 's>(&'l self, input: JsStr<'s>) -> NativeSegmentIterator<'l, 's> {
match input {
JsStrVariant::Latin1(input) => match self {
JsStr::Latin1(input) => match self {
Self::Grapheme(g) => {
NativeSegmentIterator::GraphemeLatin1(g.as_borrowed().segment_latin1(input))
}
Expand All @@ -79,7 +76,7 @@ impl NativeSegmenter {
NativeSegmentIterator::SentenceLatin1(s.as_borrowed().segment_latin1(input))
}
},
JsStrVariant::Utf16(input) => match self {
JsStr::Utf16(input) => match self {
Self::Grapheme(g) => {
NativeSegmentIterator::GraphemeUtf16(g.as_borrowed().segment_utf16(input))
}
Expand All @@ -90,6 +87,7 @@ impl NativeSegmenter {
NativeSegmentIterator::SentenceUtf16(s.as_borrowed().segment_utf16(input))
}
},
JsStr::Rope(rope) => self.segment(rope.flatten()),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/engine/src/builtins/intl/segmenter/segments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Segments {
// 8. Let startIndex be ! FindBoundary(segmenter, string, n, before).
// 9. Let endIndex be ! FindBoundary(segmenter, string, n, after).
let (range, is_word_like) = {
let mut seg_iter = segmenter.native.segment(string.variant());
let mut seg_iter = segmenter.native.segment(string.as_str());
std::iter::from_fn(|| seg_iter.next().map(|i| (i, seg_iter.is_word_like())))
.tuple_windows()
.find(|((i, _), (j, _))| (*i..*j).contains(&n))
Expand Down
11 changes: 7 additions & 4 deletions core/engine/src/builtins/number/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::{
};

use boa_macros::js_str;
use boa_string::JsStrVariant;

/// Builtin javascript 'isFinite(number)' function.
///
Expand Down Expand Up @@ -359,13 +358,17 @@ pub(crate) fn parse_float(
return Ok(JsValue::nan());
}

let value = match trimmed_string.variant() {
JsStrVariant::Latin1(s) => fast_float2::parse_partial::<f64, _>(s),
JsStrVariant::Utf16(s) => {
let value = match trimmed_string.as_str() {
JsStr::Latin1(s) => fast_float2::parse_partial::<f64, _>(s),
JsStr::Utf16(s) => {
// TODO: Explore adding direct UTF-16 parsing support to fast_float2.
let s = String::from_utf16_lossy(s);
fast_float2::parse_partial::<f64, _>(s.as_bytes())
}
JsStr::Rope(_) => {
let s = trimmed_string.as_str().to_std_string_lossy();
fast_float2::parse_partial::<f64, _>(s.as_bytes())
}
};

Ok(value.map_or_else(
Expand Down
Loading
Loading