Commit graph

143 commits

Author SHA1 Message Date
Ben Noordhuis
7e955f6f4c
Implement Array.prototype.findLast{Index} (#70) 2023-11-17 11:54:21 +01:00
Saúl Ibarra Corretgé
da3688f33d
Build examples on CMake (#67) 2023-11-17 10:45:04 +01:00
Ben Noordhuis
90d8c6bae0
Fix uninitialized memory access (#68)
An alternative fix is to zero the `values` and `count` fields in
JS_NewObjectFromShape() irrespective of the object's class_id but
handling it in JS_GetPropertyValue() feels cleaner.

Fixes: https://github.com/quickjs-ng/quickjs/issues/63
2023-11-17 00:12:10 +01:00
Saúl Ibarra Corretgé
98d9147fb2 Fix hello_module example 2023-11-16 13:59:03 +01:00
Ben Noordhuis
48fc4bb26d
Update Array.prototype[Symbol.unscopables] (#65)
Add change-array-by-copy methods to Array.prototype[Symbol.unscopables].
2023-11-16 13:05:51 +01:00
Ben Noordhuis
feebfbc6ee
Add Array.prototype.toSpliced (#64) 2023-11-16 13:04:53 +01:00
Saúl Ibarra Corretgé
ab534123a6 Add CMake install targets 2023-11-16 11:02:18 +01:00
Saúl Ibarra Corretgé
e0170867b4 Set dev as the current version suffix 2023-11-16 09:24:43 +01:00
Ben Noordhuis
d2e632e77a
Allow symbols as WeakMap and WeakSet keys (#58) 2023-11-16 09:07:59 +01:00
Saúl Ibarra Corretgé
0b09109151
Add shared library target to CMake (#60) 2023-11-14 22:29:00 +01:00
Saúl Ibarra Corretgé
cc3e062484 Simplify NAN boxing macro setting 2023-11-14 21:57:24 +01:00
Saúl Ibarra Corretgé
9749a90cc6 Skip stack checks whenbuilding with ASAN 2023-11-14 12:44:16 +01:00
Saúl Ibarra Corretgé
b98df4d994 Run 262 tests when building with {a,ub}san 2023-11-14 12:44:16 +01:00
Saúl Ibarra Corretgé
7926755704 Leave symbols in for Release CMake builds too 2023-11-13 13:02:44 +01:00
Ben Noordhuis
f404980ec0
Add fused get_loc0_loc1 opcode (#55)
get_loc0 and get_loc1 are individually very frequent opcodes _and_ they
are very often paired together, making them ideal candidates for opcode
fusion.

Reduces microbench.js running time by about 4%.
2023-11-13 00:54:13 +01:00
Saúl Ibarra Corretgé
ba9569c76f Drop MinGW CI using Makefile 2023-11-12 23:15:41 +01:00
Saúl Ibarra Corretgé
1ccb36eee8 Add ASAN/MSAN/UBSAN support to CMake 2023-11-12 23:15:41 +01:00
Saúl Ibarra Corretgé
94b85a0784
Test Debug and Release CMake build types on CI (#52) 2023-11-12 23:04:46 +01:00
Ben Noordhuis
920cfc679a
Add copyright notices (#51)
I believe we made enough substantial changes to have a credible claim to
copyright holdership.
2023-11-12 22:42:07 +01:00
Ben Noordhuis
1e3893d25e
Remove duplicate test (#50) 2023-11-12 13:35:52 +01:00
Ben Noordhuis
e8ff1f4a3a
Remove broken SHORT_OPCODES=0 build mode (#49) 2023-11-12 13:35:41 +01:00
Ben Noordhuis
a92e74acac
Remove broken OPTIMIZE=0 build mode (#47) 2023-11-12 13:34:08 +01:00
Ben Noordhuis
162a8b7409
Remove trailing whitespace (#46)
Not purely cosmetic because it breaks navigation with { and } in the
One True Editor.
2023-11-12 10:01:40 +01:00
Ben Noordhuis
15f798db27
Implement Array.prototype.with (#45) 2023-11-11 23:35:46 +01:00
Ben Noordhuis
a19b07af37
Implement Array.prototype.toSorted (#44) 2023-11-11 21:51:02 +01:00
Ben Noordhuis
cfe4251c9a
Implement String.prototype.toWellFormed (#43)
Reworks isWellFormed to be consistent style-wise with toWellFormed.
2023-11-11 21:50:46 +01:00
Saúl Ibarra Corretgé
afee50e89e Fix compilation warning
~~~
/home/runner/work/quickjs/quickjs/qjs.c:506:28: error: ‘best[3]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  506 |                 if (i == 0 || best[j] > ms)
      |                     ~~~~~~~^~~~~~~~~~~~~~~
/home/runner/work/quickjs/quickjs/qjs.c:506:28: error: ‘best[2]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/runner/work/quickjs/quickjs/qjs.c:506:28: error: ‘best[1]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
~~~
2023-11-11 18:33:51 +01:00
Saúl Ibarra Corretgé
c17371b42a Don't set global compilation flags on CMake 2023-11-11 18:33:51 +01:00
Ben Noordhuis
0720b068ca
Implement String.prototype.isWellFormed (#41) 2023-11-11 13:47:22 +01:00
Saúl Ibarra Corretgé
0dc99e4ac2 Don't use -Werror by default on CMake 2023-11-10 22:06:23 +01:00
Saúl Ibarra Corretgé
f603aef16b Export library incldue directories 2023-11-10 22:03:50 +01:00
Saúl Ibarra Corretgé
087f66247c Drop unused definition 2023-11-10 21:57:01 +01:00
Saúl Ibarra Corretgé
68f7b1be3c Fix CMake generated artifact location 2023-11-10 21:42:40 +01:00
Ben Noordhuis
7b64da2325
Improve BigInt hashing (#38)
Fixes: https://github.com/quickjs-ng/quickjs/issues/35
2023-11-10 21:01:09 +01:00
Ben Noordhuis
8d62210e7d
Remove non-standard BigInt methods (#37)
Fixes: https://github.com/quickjs-ng/quickjs/issues/20
2023-11-10 20:10:52 +01:00
Saúl Ibarra Corretgé
55e845c5dd Add JS_GetVersion 2023-11-10 16:48:49 +01:00
Ben Noordhuis
38f88c0898
Remove CONFIG_BIGNUM, always enable BigInt (#34)
Fixes: https://github.com/quickjs-ng/quickjs/issues/17
2023-11-10 16:09:54 +01:00
Ole André Vadla Ravnås
3c144fd553 Add JS_GetAnyOpaque() to support polymorphism
To be able to check if the class ID is one of multiple known ones, where
the data has a common structure.
2023-11-10 11:01:22 +01:00
Ben Noordhuis
ae17b8522d
Remove operator overloading (#32)
Part of https://github.com/quickjs-ng/quickjs/issues/17
2023-11-10 10:23:40 +01:00
Saúl Ibarra Corretgé
39e834fc18 Add initial CMake support 2023-11-09 17:52:33 +01:00
Ben Noordhuis
e449cb08ef
Remove BigFloat (#31)
Part of https://github.com/quickjs-ng/quickjs/issues/17
2023-11-08 22:23:06 +01:00
Saúl Ibarra Corretgé
c1ed688610 Drop non-standard JSON extension
Ref: https://github.com/quickjs-ng/quickjs/issues/20
2023-11-08 22:14:25 +01:00
Ben Noordhuis
5d5b3cc21f
Remove BigDecimal (#29)
Part of https://github.com/quickjs-ng/quickjs/issues/17
2023-11-08 21:07:16 +01:00
Ben Noordhuis
558a2ac761 Exit on sanitizer trap, don't recover
Fixes: https://github.com/quickjs-ng/quickjs/issues/22
2023-11-08 19:17:13 +01:00
Ben Noordhuis
8956d6bbd3 Fix UB unaligned load 2023-11-08 19:17:13 +01:00
Ben Noordhuis
0068db8a11 Avoid UB when checking if float fits in int32 2023-11-08 19:17:13 +01:00
Saúl Ibarra Corretgé
2f51cbc4e6 Add CI for MinGW on Windows 2023-11-08 11:12:54 +01:00
Saúl Ibarra Corretgé
4f02ab8cfa
Fix use-after-free on error during module evaluation
E.g. if during evaluation of module A, we start loading module B and
an error occurs. This results in a call to js_free_modules() with
JS_FREE_MODULE_NOT_EVALUATED, and since module A isn't yet evaluated,
it gets freed prematurely.

To solve this we improve js_free_modules() to ensure `eval_mark` is not
set. Once js_evaluate_module() returns for module A, it will notice that
an exception occurred and call js_free_modules() with
JS_FREE_MODULE_NOT_EVALUATED. Since `eval_mark` has been cleared by then,
module A gets cleaned up as well.

Co-authored-by: Ole André Vadla Ravnås <oleavr@gmail.com>
2023-11-07 22:23:09 +01:00
Ben Noordhuis
a3a57febed
Implement Array.prototype.toReversed (#19) 2023-11-07 17:31:33 +01:00
Saúl Ibarra Corretgé
e2ae8746ca
Drop support for "use strip"
Ref: https://github.com/quickjs-ng/quickjs/issues/20
2023-11-07 00:29:11 +01:00