summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Intl/Segmenter.cpp
AgeCommit message (Collapse)Author
2023-02-16LibJS: Use iterative text segmentation algorithms for Intl.SegmenterTimothy Flynn
This uses the find-next and find-previous APIs instead of storing all indices as a vector.
2023-02-15LibUnicode+LibJS: Move text segmentation algorithms to their own filesTimothy Flynn
These algorithms are quite chonky, and more APIs around them are to be added, so let's move them to their own files for a bit of organization.
2023-01-08LibJS+Everywhere: Make PrimitiveString and Utf16String fallibleTimothy Flynn
This makes construction of Utf16String fallible in OOM conditions. The immediate impact is that PrimitiveString must then be fallible as well, as it may either transcode UTF-8 to UTF-16, or create a UTF-16 string from ropes. There are a couple of places where it is very non-trivial to propagate the error further. A FIXME has been added to those locations.
2022-12-14LibJS: Remove Object(Object& prototype) footgunAndreas Kling
This constructor was easily confused with a copy constructor, and it was possible to accidentally copy-construct Objects in at least one way that we dicovered (via generic ThrowCompletionOr construction). This patch adds a mandatory ConstructWithPrototypeTag parameter to the constructor to disambiguate it.
2022-12-14LibJS: Convert Object::create() to NonnullGCPtrLinus Groh
2022-12-07LibJS: Replace standalone js_string() with PrimitiveString::create()Linus Groh
Note that js_rope_string() has been folded into this, the old name was misleading - it would not always create a rope string, only if both sides are not empty strings. Use a three-argument create() overload instead.
2022-08-27LibJS: Move intrinsics to the realmLinus Groh
Intrinsics, i.e. mostly constructor and prototype objects, but also things like empty and new object shape now live on a new heap-allocated JS::Intrinsics object, thus completing the long journey of taking all the magic away from the global object. This represents the Realm's [[Intrinsics]] slot in the spec and matches its existing [[GlobalObject]] / [[GlobalEnv]] slots in terms of architecture. In the majority of cases it should now be possibly to fully allocate a regular object without the global object existing, and in fact that's what we do now - the realm is allocated before the global object, and the intrinsics between both :^)
2022-08-23LibJS+LibWeb: Reduce use of GlobalObject as an intermediaryLinus Groh
- Prefer VM::current_realm() over GlobalObject::associated_realm() - Prefer VM::heap() over GlobalObject::heap() - Prefer Cell::vm() over Cell::global_object() - Prefer Wrapper::vm() over Wrapper::global_object() - Inline Realm::global_object() calls used to access intrinsics as they will later perform a direct lookup without going through the global object
2022-08-23LibJS: Replace GlobalObject with VM in Intl AOs [Part 1/19]Linus Groh
Instead of passing a GlobalObject everywhere, we will simply pass a VM, from which we can get everything we need: common names, the current realm, symbols, arguments, the heap, and a few other things. In some places we already don't actually need a global object and just do it for consistency - no more `auto& vm = global_object.vm();`! This will eventually automatically fix the "wrong realm" issue we have in some places where we (incorrectly) use the global object from the allocating object, e.g. in call() / construct() implementations. When only ever a VM is passed around, this issue can't happen :^) I've decided to split this change into a series of patches that should keep each commit down do a somewhat manageable size.
2022-08-23LibJS+LibWeb: Replace GlobalObject with Realm in create() functionsLinus Groh
This is a continuation of the previous two commits. As allocating a JS cell already primarily involves a realm instead of a global object, and we'll need to pass one to the allocate() function itself eventually (it's bridged via the global object right now), the create() functions need to receive a realm as well. The plan is for this to be the highest-level function that actually receives a realm and passes it around, AOs on an even higher level will use the "current realm" concept via VM::current_realm() as that's what the spec assumes; passing around realms (or global objects, for that matter) on higher AO levels is pointless and unlike for allocating individual objects, which may happen outside of regular JS execution, we don't need control over the specific realm that is being used there.
2022-05-03LibJS: Remove implicit wrapping/unwrapping of completion recordsLinus Groh
This is an editorial change in the ECMA-262 spec, with similar changes in some proposals. See: - https://github.com/tc39/ecma262/commit/7575f74 - https://github.com/tc39/proposal-array-grouping/commit/df899eb - https://github.com/tc39/proposal-shadowrealm/commit/9eb5a12 - https://github.com/tc39/proposal-shadowrealm/commit/c81f527
2022-01-31LibJS: Implement the Intl CreateSegmentDataObject AOIdan Horowitz
2022-01-31LibJS: Implement the Intl.Segmenter FindBoundary AOIdan Horowitz
2022-01-30LibJS: Start implementing Intl.SegmenterIdan Horowitz