Commit graph

129 commits

Author SHA1 Message Date
Charlie Gordon
bbf36d5b84 Fix big endian serialization
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()`
2024-02-18 08:29:04 +01:00
Charlie Gordon
530ba6a631 handle missing test262 gracefully 2024-02-17 22:57:57 +01:00
Charlie Gordon
0a361b7c0f handle missing test262 gracefully 2024-02-17 22:56:54 +01:00
Charlie Gordon
74bdb4967c Improve tests
- split test_bigfloat.js from test_bignum.js
- make test_date() compatible with node
- document Date constructor string argument format:
  should add test cases for invalid strings
- test_argument_scope(): only test this syntax error in strict mode:
  `var f = function(a = eval("var arguments")) {};`
2024-02-17 21:54:19 +01:00
Charlie Gordon
85fb2caeae Fix UB signed integer overflow in js_math_imul
- 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
2024-02-17 21:15:29 +01:00
Ben Noordhuis
8df4327559 Fix UB left shift of negative number 2024-02-17 17:36:50 +01:00
Ben Noordhuis
3bb2ca360e Remove unnecessary ssize_t posix-ism
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.
2024-02-16 10:25:29 +01:00
Charlie Gordon
c06af876f6 Improve string concatenation hack
- 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.
2024-02-15 10:30:04 +01:00
Charlie Gordon
8e21b96738 pass node-js command line arguments to microbench 2024-02-15 09:59:50 +01:00
Charlie Gordon
95e0aa0526 Reverse e140122202
- 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 c3635861f6.
2024-02-13 09:45:58 +01:00
Charlie Gordon
1fe04149e9 Fix test262 error
- 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
2024-02-12 18:37:37 +01:00
Charlie Gordon
ef4e7b23f4 Fix compiler warnings 2024-02-12 18:35:27 +01:00
Charlie Gordon
92e339d14f Simplify and clarify URL quoting js_std_urlGet 2024-02-12 18:34:52 +01:00
Nick Vatamaniuc
636c946531
FreeBSD QuickJS Patch (#203) 2024-02-12 11:28:00 +01:00
Felix S
ae6fa8d3d2
Fix shell injection bug in std.urlGet (#61) 2024-02-12 11:20:25 +01:00
Sam
693449e34e
add gitignore for build objects (#84)
Signed-off-by: Samuel Hellawell <sshellawell@gmail.com>
Co-authored-by: Charlie Gordon <github@chqrlie.org>
2024-02-12 10:28:38 +01:00
Ben Noordhuis
e140122202 Fix sloppy mode arguments uninitialized value use
MemorySanitizer complained about uninitialized reads in
the indexed property code path in JS_GetPropertyValue()
with JS_CLASS_MAPPED_ARGUMENTS objects.
2024-02-11 23:54:19 +01:00
Ben Noordhuis
6dbf01bb1f Remove unsafe sprintf() and strcat() calls
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.
2024-02-11 21:58:14 +01:00
Charlie Gordon
6535064577 Fix undefined behavior (UBSAN) 2024-02-11 21:32:36 +01:00
Saúl Ibarra Corretgé
e53d622359 Fix UB in js_dtoa1 2024-02-11 20:59:17 +01:00
Ben Noordhuis
fd6e039770 Add UndefinedBehaviorSanitizer support 2024-02-11 20:37:24 +01:00
Ben Noordhuis
325ca194b7 Add MemorySanitizer support 2024-02-11 20:27:34 +01:00
Ben Noordhuis
626e0d4e60 Unbroke tests/test_test_bjson.js 2024-02-11 18:38:47 +01:00
Ben Noordhuis
2e1013429a Add more tests
- add regexp tests in tests/microbench.js
- add bjson_test_regexp in tests/test_test_bjson.js
2024-02-11 16:20:39 +01:00
Charlie Gordon
48deab1aeb Fix runtime bugs
- fix string leak in `js_printf_internal` on errors
- read `errno` before potential side effects in `js_os_stat`
2024-02-11 12:49:40 +01:00
Charlie Gordon
c9e6c56c70 Improve microbench
- remove import statements (invoke with qjs --std)
- fix compatibility issues with node
- add more loop styles
- add more string concatenation tests
- use === and !=== where appropriate
- fix sort timing log
- add `-r ref_file` command line option to specify reference file
- add .gitignore file with target file patterns
2024-02-11 12:11:53 +01:00
Charlie Gordon
2c793e5097 Fix test262o error
- excude test262o/test/suite/ch15/15.5/15.5.4/15.5.4.9/15.5.4.9_CE.js:
  Test262 Error: String.prototype.localeCompare considers ö (\u006f\u0308) = ö (\u00f6).
2024-02-10 20:54:29 +01:00
Charlie Gordon
37bd4ae62d Strip trailing spaces 2024-02-10 16:19:17 +01:00
Fabrice Bellard
6f480abbc8 avoid using INT64_MAX in double comparisons because it cannot be exactly represented as a double (bnoordhuis) 2024-02-03 15:48:57 +01:00
Fabrice Bellard
1ed38eef33 fixed MingW64 install on Windows (absop) (github issue #230) 2024-02-03 15:48:09 +01:00
Fabrice Bellard
00967aac24 fixed Promise return in the REPL by using a wrapper object in async std.evalScript() (github issue #231) 2024-02-03 15:47:42 +01:00
Fabrice Bellard
c6cc6a9a5e export JS_GetModuleNamespace (github issue #34) 2024-01-27 13:27:32 +01:00
Fabrice Bellard
cd666a851f simplified and fixed arrow function parsing (github issue #226) 2024-01-27 13:12:54 +01:00
Fabrice Bellard
090685a8c2 update test results 2024-01-27 13:12:37 +01:00
Fabrice Bellard
67723c93e4 fixed js_std_await() in case 'obj' is not a promise (github issue #222) 2024-01-22 18:03:35 +01:00
Fabrice Bellard
9e561d5c2e fixed and simplified setTimeout() by using an integer timer handle (github issue #218) 2024-01-19 10:20:34 +01:00
Fabrice Bellard
84058766e9 added js_std_await() and use it to wait for the evaluation of a module (github issue #219) 2024-01-19 10:19:58 +01:00
Fabrice Bellard
d6c7d169de update Changelog 2024-01-19 10:18:32 +01:00
Fabrice Bellard
3f81070e57 new release 2024-01-13 11:16:02 +01:00
Fabrice Bellard
6e651e86e5 allow override of PREFIX, CROSS_PREFIX, CFLAGS and LDFLAGS in Makefile (humenda) 2024-01-13 11:15:28 +01:00
Fabrice Bellard
efdb722f02 fixed JS_GetScriptOrModuleName() in direct or indirect eval code 2024-01-13 11:15:06 +01:00
Fabrice Bellard
9a4379daf6 native cosmopolitan build 2024-01-11 15:29:19 +01:00
Fabrice Bellard
e80917bad4 fixed uninitialized harnessbuf 2024-01-11 15:28:41 +01:00
Fabrice Bellard
c9509664ab update test results 2024-01-11 15:28:12 +01:00
Fabrice Bellard
e66ce48872 more portable and Windows version for getTimezoneOffset() (github issue #122) 2024-01-11 15:26:39 +01:00
Fabrice Bellard
195c42b9fb added os.getpid() 2024-01-11 15:25:28 +01:00
Fabrice Bellard
10fc744ae4 regexp: fixed the zero advance logic in quantifiers (github issue #158) 2024-01-10 14:36:19 +01:00
Fabrice Bellard
f25e5d4094 optional chaining fixes (github issue #103) 2024-01-09 19:15:40 +01:00
Fabrice Bellard
e1e65aca91 fixed Date.toLocaleString() (kuzmas) 2024-01-08 19:02:30 +01:00
Fabrice Bellard
af308614a8 fixed regexp case insensitive flag 2024-01-08 18:42:29 +01:00