summaryrefslogtreecommitdiff
path: root/quickjs.c
Commit message (Collapse)AuthorAge
...
* more bignum cleanupFabrice Bellard2025-03-19
|
* compilation fixFabrice Bellard2025-03-18
|
* removed bignum support and qjscalc - added optimized BigInt implementationFabrice Bellard2025-03-18
|
* simplified the handling of closuresFabrice Bellard2025-03-13
|
* added missing stack overflow check in JSON.stringify()Fabrice Bellard2025-03-13
|
* allow regexp interruption (e.g. with Ctrl-C in the REPL)Fabrice Bellard2025-03-13
|
* fix crash when add_property() fails on build arguments (penneryu)Fabrice Bellard2025-03-13
|
* JS_SetPropertyInternal(): avoid recursing thru the prototypes if the ↵Fabrice Bellard2025-03-13
| | | | property is found in a prototype
* fixed date parsing in case there is more than nine initial digits (initial ↵Fabrice Bellard2025-03-13
| | | | patch by nickva)
* Use malloc_usable_size() on any OS based on GNU libcPino Toscano2024-07-21
| | | | | malloc_usable_size() is a GNU extension in GNU libc; hence, use it every time GNU libc is used, rather than only on Linux.
* Fix `JS_HasException()` when `null` is thrown (#313)Kasper Isager Dalsgarð2024-07-17
| | | Use `JS_UNINITIALIZED` instead of `JS_NULL` when no exception is pending, so `null` can be thrown and distinguished from no exception pending.
* Fix GC leak in `js_proxy_get()` (#302)Dmitry Volyntsev2024-07-15
| | | Fixes #277
* Add `js_resolve_proxy` (#293)Charlie Gordon2024-05-09
| | | | - simplify `JS_IsArray` for proxy chains - remove `js_proxy_isArray`
* Add `JS_StrictEq()`, `JS_SameValue()`, and `JS_SameValueZero()` (#264)Kasper Isager Dalsgarð2024-05-09
| | | | | | * add `JS_StrictEq()`, `JS_SameValue()`, and `JS_SameValueZero()` all accepting `JSValueConst` * make `js_strict_eq` accept `JSValueConst`, remove uses of this function internally and replace them with `js_strict_eq2` instead.
* Expose `JS_SetUncatchableError()` (#262)Kasper Isager Dalsgarð2024-05-09
| | | | | * Expose `JS_SetUncatchableError()` * Remove unnecessary `JS_SetUncatchableError` declaration
* Add `JS_HasException()` (#265)Kasper Isager Dalsgarð2024-05-08
|
* Add `JS_NewTypedArray()` (#272)Dmitry Volyntsev2024-05-08
|
* Improve class parser (#289)Charlie Gordon2024-05-05
| | | | | - accept `class P { async = 1 }}` - accept `class P { static = 1 }}` etc. - Fixes #261
* fix class method with name get (#258)Richard Davison2024-05-05
| | | Co-authored-by: Richard Davison <ridaviso@amazon.com>
* Improve libunicode and libregexp headers (#288)Charlie Gordon2024-05-05
| | | | | | | - move all `lre_xxx` functions to libunicode - use flags table `lre_ctype_bits` instead of bitmaps - simplify `lre_is_space`, `lre_js_is_ident_first` and `lre_js_is_ident_next` - simplify `simple_next_token`, handle UTF-8 correctly - simplify `is_let`, remove dead code
* Fix endianness handling in `js_dataview_getValue` / `js_dataview_setValue`Charlie Gordon2024-03-23
|
* Improve error handlingCharlie Gordon2024-03-23
| | | | | | | - detect and report invalid duplicate parameter names - throw RangeError for too many function arguments - throw RangeError for invalid string length - prevent `-Wcast-function-type` warnings
* Improve `JSON.stringify`Charlie Gordon2024-03-23
| | | | | | | | - changed error messages - clarify `toJSON` method usage - simplify boxed objects handling - for ECMA conformity, BigInt objects need a toJSON method in the prototype chain including boxed objects
* Use more explicit magic values for array methodsCharlie Gordon2024-03-23
|
* Simplify redundant initializers for `JS_NewBool()`Charlie Gordon2024-03-23
|
* Fix compilation with -DCONFIG_BIGNUMCharlie Gordon2024-03-22
| | | | | - disable BigDecimal convertion in `JS_ReadBigNum` - fix some error messages
* Improve Date.parse, small fixesCharlie Gordon2024-03-22
| | | | | | | | - add `minimum_length` to enforce array length validation - add `JS_NewDate()` API - add `[Symbol.toStringTag]` property in the global object - simplify `string_get_milliseconds` - support more timezone abbrevs using `string_get_tzabbr` and array
* Prevent UB on memcpy and floating point conversionsCharlie Gordon2024-03-03
| | | | | | | - 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-03
| | | | | | | | | | - 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
* Improve Number.prototype.toString for radix other than 10Charlie Gordon2024-03-02
| | | | | | | - 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-02-25
| | | | | | | | - 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-02-22
| | | | | | - `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-02-21
| | | | | | | | | | | | - 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-02-21
| | | | | | | | | 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-02-20
| | | | | | | | | - 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-02-19
| | | | | - rename is_utf16 structure member to is_unicode - rename flag LRE_FLAG_UTF16 as LRE_FLAG_UNICODE
* Fix big endian serializationCharlie Gordon2024-02-18
| | | | | | | | | | | | | | | | 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-02-17
| | | | | | | - 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-02-17
|
* Remove unnecessary ssize_t posix-ismBen Noordhuis2024-02-16
| | | | | | | | 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-02-15
| | | | | | - 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-02-13
| | | | | | | - 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-02-12
| | | | | | - 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-02-11
| | | | | | 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-02-11
| | | | | 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-02-11
|
* Fix UB in js_dtoa1Saúl Ibarra Corretgé2024-02-11
|
* Fix runtime bugsCharlie Gordon2024-02-11
| | | | | - fix string leak in `js_printf_internal` on errors - read `errno` before potential side effects in `js_os_stat`
* Strip trailing spacesCharlie Gordon2024-02-10
|
* avoid using INT64_MAX in double comparisons because it cannot be exactly ↵Fabrice Bellard2024-02-03
| | | | represented as a double (bnoordhuis)