about summary refs log tree commit diff stats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Prevent UB on memcpy and floating point conversionsCharlie Gordon2024-03-135-18/+26
| | | | | | | - add `memcpy_no_ub` that accepts null pointers for 0 count - prevent 0 length allocation in `js_worker_postMessage` - use safer test for `int` value in `JS_NewFloat64`, `JS_ToArrayLengthFree` and `js_typed_array_indexOf`
* Improve Date.parseCharlie Gordon2024-03-131-31/+106
| | | | | | | | | | - accept many more alternative date/time formats - add test cases in tests/test_builtin.js - match month and timezone names case insensitively - accept AM and PM markers - recognize US timezone names - skip parenthesized stuff - fix almost all v8 test cases
* man: rewrite in Nimbptato2024-03-131-0/+4
| | | | | | | | | | | | Depending on Perl just for this is silly. Now we use libregexp for filtering basically the same things as w3mman2html did. This required another patch to QuickJS to avoid pulling in the entire JS engine, but in return, we can now run regexes without a dummy JS context global variable. Also, man.nim now tries to find a man command on the system even if it's not in /usr/bin/man.
* Update chamebptato2024-03-031-0/+0
|
* quickjs: fix build without CONFIG_BIGNUMbptato2024-03-021-0/+8
| | | | broken in upstream :(
* Improve Number.prototype.toString for radix other than 10Charlie Gordon2024-03-021-9/+98
| | | | | | | - fix the conversions for integers and exact fractions - approximate approach for other cases. - bypass floating point conversions for JS_TAG_INT values - avoid divisions for base 10 integer conversions
* Improve Date.parseCharlie Gordon2024-03-021-224/+305
| | | | | | | | - rewrite Date.parse() with separate parsers - return `NaN` for out of bounds field values as specified - accept up to 9 decimals for millisecond fraction but truncate at 3 - accept many more alternative date/time formats - add test cases in tests/test_builtin.js
* Fix Map hash bugCharlie Gordon2024-03-021-2/+2
| | | | | | - `map_hash_key` must generate the same key for JS_INT and JS_FLOAT64 with the same value - add test cases in tests/test_builtin.js
* Rewrite `set_date_fields` to match the ECMA specificationCharlie Gordon2024-03-021-28/+52
| | | | | | | | | | | | - use `double` arithmetic where necessary to match the spec - use `volatile` to ensure correct order of evaluation and prevent FMA code generation - reject some border cases. - avoid undefined behavior in `double` -> `int64_t` conversions - improved tests/test_builtin.js `assert` function to compare values more reliably. - added some tests in `test_date()` - disable some of these tests on win32 and cygwin targets
* Add C API function JS_GetClassID()Tyler Rockwood2024-03-022-0/+12
| | | | | | | | | If you want to extend a built-in class you need it's class ID and there is no robust way to get that without this accessor. * add JS_INVALID_CLASS_ID constant for invalid class ID. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* Improve surrogate handling readabilityCharlie Gordon2024-03-023-124/+150
| | | | | | | | | - add inline function to test and convert surrogates is_surrogate(c), is_hi_surrogate(c), is_lo_surrogate(c), get_hi_surrogate(c), get_lo_surrogate(c), from_surrogate(hi, lo) - use names for BC header offsets and lengths in libregexp.c - remove strict aliasing violations in `lre_exec_backtrack()` - pass all context variables to XXX_CHAR macros in `lre_exec_backtrack()`
* Rename regex flag and field utf16 -> unicodeCharlie Gordon2024-03-023-61/+62
| | | | | - rename is_utf16 structure member to is_unicode - rename flag LRE_FLAG_UTF16 as LRE_FLAG_UNICODE
* Fix big endian serializationCharlie Gordon2024-03-022-61/+58
| | | | | | | | | | | | | | | | Big endian serialization was broken because: - it partially relied on `WORDS_ENDIAN` (unconditionally undef'd in cutils.h) - endianness was not handled at all in the bc reader. Modifications: - remove `WORDS_ENDIAN` - use `bc_put_u32()` / `bc_put_u64()` in `JS_WriteBigInt()` - use `bc_get_u32()` / `bc_get_u64()` in `JS_ReadBigInt()` - handle host endianness in `bc_get_u16()`, `bc_get_u32()`, `bc_get_u64()` and `JS_ReadFunctionBytecode()` - handle optional littleEndian argument as specified in `js_dataview_getValue()` and `js_dataview_setValue()`
* Fix UB signed integer overflow in js_math_imulCharlie Gordon2024-03-021-5/+7
| | | | | | | - Use uint32_t arithmetics and Standard conformant conversion to avoid UB in js_math_imul. - add builtin tests - use specific object directories for SAN targets
* Fix UB left shift of negative numberBen Noordhuis2024-03-021-1/+1
|
* Remove unnecessary ssize_t posix-ismBen Noordhuis2024-03-021-1/+1
| | | | | | | | ssize_t is not always available and the cast it was used in wasn't necessary in the first place, the value already has the right type. Note that the field malloc_limit is an int64_t in JSMemoryUsage whereas it is a size_t in JSMallocState.
* Improve string concatenation hackCharlie Gordon2024-03-022-78/+96
| | | | | | - add more cases of in place string concatenation this temporary hack improves the microbench timing by 30% but has little impact on the test262 timings.
* Reverse e140122202cc24728b394f8f90fa2f4a2d7c397eCharlie Gordon2024-03-021-2/+0
| | | | | | | - remove temporary fix for MemorySanitizer: setting p->u.array.count to 0 silenced a warning in JS_GetPropertyValue on a hacky test agains the length of fast_array object. This hack was removed by commit c3635861f63931255c7a953bccbb0e2e90cc75aa.
* Fix test262 errorCharlie Gordon2024-03-021-2/+8
| | | | | | - force evaluation order in `set_date_fields` - fix evaluation error in test262/test/built-ins/Date/UTC/fp-evaluation-order.js:19: unexpected error: Test262Error: precision in MakeDate Expected SameValue(«34448384», «34447360») to be true
* Fix sloppy mode arguments uninitialized value useBen Noordhuis2024-03-021-0/+2
| | | | | | MemorySanitizer complained about uninitialized reads in the indexed property code path in JS_GetPropertyValue() with JS_CLASS_MAPPED_ARGUMENTS objects.
* Remove unsafe sprintf() and strcat() callsBen Noordhuis2024-03-021-22/+24
| | | | | Prep work for enabling the sanitizers on macos CI since they are marked as deprecated and cause the build to fail when -Werror is enabled.
* Fix undefined behavior (UBSAN)Charlie Gordon2024-03-021-2/+4
|
* Fix UB in js_dtoa1Saúl Ibarra Corretgé2024-03-021-1/+3
|
* Fix runtime bugsCharlie Gordon2024-03-021-13/+9
| | | | | - fix string leak in `js_printf_internal` on errors - read `errno` before potential side effects in `js_os_stat`
* Strip trailing spacesCharlie Gordon2024-03-0214-760/+760
|
* avoid using INT64_MAX in double comparisons because it cannot be exactly ↵Fabrice Bellard2024-03-021-2/+3
| | | | represented as a double (bnoordhuis)
* fixed Promise return in the REPL by using a wrapper object in async ↵Fabrice Bellard2024-03-021-2/+14
| | | | std.evalScript() (github issue #231)
* export JS_GetModuleNamespace (github issue #34)Fabrice Bellard2024-03-022-7/+6
|
* simplified and fixed arrow function parsing (github issue #226)Fabrice Bellard2024-03-021-46/+57
|
* new releaseFabrice Bellard2024-03-021-1/+1
|
* fixed JS_GetScriptOrModuleName() in direct or indirect eval codeFabrice Bellard2024-03-021-11/+24
|
* quickjs: reduce diff with upstreambptato2024-03-022-61/+18
| | | | | | * the uint8array thing is probably from txiki.js, but we never used it * upstream now has JS_GetClassID, importing that instead... (so this commit won't build :/)
* Update Chagashibptato2024-02-261-0/+0
|
* Update Chagashibptato2024-02-231-0/+0
|
* Replace Chakasu with Chagashibptato2024-02-222-0/+0
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* Update chamebptato2024-02-211-0/+0
|
* Update chamebptato2024-02-081-0/+0
|
* Update chamebptato2024-02-071-0/+0
|
* Incremental renderingbptato2024-02-071-0/+0
| | | | | | | | | | | | Yay! Admittedly, it is not very useful in its current form, except maybe on very slow networks. The problem is that renderDocument is *slow*, so we only run it when onload fails to consume all bytes from the network in a single pass. Even then, we are guaranteed to get a FOUC, since CSS is only downloaded in finishLoad(). Well, I think it's cool, anyway.
* Update chamebptato2024-02-071-0/+0
| | | | | | | | * Update chame to the latest version * Get rid of nodeType usage * Add atoms * Re-implement DOM attributes * document.write
* fix bug in prev commitbptato2024-02-051-1/+1
| | | | it's 0, not 1 :(
* regex: fix 8-bit narrow strings in JSbptato2024-02-051-25/+39
| | | | | The previous approach to add UTF-8 support to libregexp was broken. This time, we use a separate flag (cbuf_len == 3) to indicate UTF-8 input.
* quickjs: patch libunicode.h to use LRE_BOOLbptato2024-01-151-2/+2
| | | | | | | This way it actually compiles :) (QJS includes cutils.h too, so BOOL works there. We don't, so this is the easiest fix.)
* native cosmopolitan buildFabrice Bellard2024-01-111-16/+5
|
* more portable and Windows version for getTimezoneOffset() (github issue #122)Fabrice Bellard2024-01-111-9/+24
|
* regexp: fixed the zero advance logic in quantifiers (github issue #158)Fabrice Bellard2024-01-112-74/+42
|
* optional chaining fixes (github issue #103)Fabrice Bellard2024-01-112-7/+111
|
* fixed Date.toLocaleString() (kuzmas)Fabrice Bellard2024-01-111-1/+1
|
* fixed regexp case insensitive flagFabrice Bellard2024-01-114-196/+374
|
* fixed next token parsing after a function definition (github issue #77)Fabrice Bellard2024-01-111-27/+51
|