Commit graph

356 commits

Author SHA1 Message Date
Ben Noordhuis
83dfc635f1
Implement TypedArray.prototype.toSorted (#199) 2023-12-10 21:23:52 +01:00
Ben Noordhuis
05f00a87f7
Implement TypedArray.prototype.toReversed (#198) 2023-12-10 21:21:21 +01:00
Fabrice Bellard
baf50f9236 fixed duplicate static private setter/getter test 2023-12-10 21:03:48 +01:00
Fabrice Bellard
e8b97048d4 Symbol.species is no longer used in TypedArray constructor from a TypedArray 2023-12-10 21:03:48 +01:00
Fabrice Bellard
46996ff258 fixed delete super.x error 2023-12-10 21:03:48 +01:00
Ben Noordhuis
67d90092fe Add regression test for previous commit 2023-12-10 21:03:48 +01:00
Fabrice Bellard
30e4767e67 fixed lexical scope of 'this' with eval (github issue #192) 2023-12-10 21:03:48 +01:00
Ben Noordhuis
f1b7b6da71
Replace JSValueConst with JSValue (#195)
JSValueConst was only used for the now removed CONFIG_CHECK_JSVALUE
build mode. It is kept around as an alias for JSValue in quickjs.h to
avoid breaking everyone's source builds but remove it everywhere else.
2023-12-10 15:15:42 +01:00
Ben Noordhuis
4d57997ee7
Remove CONFIG_CHECK_JSVALUE build mode (#194)
It doesn't produce a working build and I'm somewhat skeptical that
its purported goal of catching reference counting bugs still works.
2023-12-10 13:50:26 +01:00
Ben Noordhuis
4c1b9f8c7f
Fix OP_FMT_none_loc bytecode dumping (#192)
Commit f404980 ("Add fused get_loc0_loc1 opcode") introduced an
off-by-one (sometimes negative) array index bug because OP_get_loc1_loc1
replaced OP_get_loc0 as the first OP_FMT_none_loc opcode.
2023-12-09 23:46:54 +01:00
Ben Noordhuis
f6ed206bd5
Change regexp flags field from uint8 to uint16 (#185)
I need the extra bits to store the 'v' flag as described in
https://github.com/tc39/proposal-regexp-v-flag
2023-12-09 16:47:05 +01:00
Ben Noordhuis
6bd3d5660e
Use JS_ToBigIntFree() instead of JS_ToBigInt() (#190)
Reduces reference count juggling in the happy path and, to a lesser
extent, in error paths.
2023-12-09 14:54:54 +01:00
Ben Noordhuis
4fc814311a
Remove js_new_bf() (#189)
And replace the open-coded JS_NewBigInt() logic at its one call site
with the real thing.
2023-12-09 14:54:33 +01:00
Ben Noordhuis
d17129035d
Remove duplicate JS_GetBigInt call (#188) 2023-12-09 14:54:13 +01:00
Ben Noordhuis
f7d2169999
Rename LRE_FLAG_UTF16 to LRE_FLAG_UNICODE (#186)
Prep work for https://github.com/tc39/proposal-regexp-v-flag a.k.a.
UnicodeSets.
2023-12-08 10:58:00 +01:00
Ben Noordhuis
42b708622c
Use named constant for regexp bytecode size field (#183) 2023-12-07 23:00:32 +01:00
Saúl Ibarra Corretgé
9539e3cc65 Fix private field setters
Ref: 55a4878a60
2023-12-07 22:21:48 +01:00
Felipe Gasper
9de152667f
Add NetBSD support (#177) 2023-12-07 15:48:31 +01:00
Saúl Ibarra Corretgé
7542b14c5b Fix Makefile rebuilding every target 2023-12-07 11:34:52 +01:00
Saúl Ibarra Corretgé
622ce2cc9d Detect JOBS in a more portable way 2023-12-07 10:59:11 +01:00
Saúl Ibarra Corretgé
ffa73c8f18 fixup! 2023-12-07 09:38:09 +01:00
Saúl Ibarra Corretgé
3f66b08b9c Simplify Makefile 2023-12-07 09:38:09 +01:00
Saúl Ibarra Corretgé
e7e938fa50 Update LICENSE
So GH renders it correctly.
2023-12-06 00:00:15 +01:00
Saúl Ibarra Corretgé
2d05150e35 Now working on 0.3.0 2023-12-05 23:27:23 +01:00
Saúl Ibarra Corretgé
a393ebc2f8 Set version to 0.2.0 2023-12-05 23:18:22 +01:00
Saúl Ibarra Corretgé
99f12f4f2f Implement FinalizationRegistry 2023-12-05 22:41:57 +01:00
Saúl Ibarra Corretgé
18b30961ee DRY malloc_usable_size 2023-12-05 12:34:02 +01:00
Saúl Ibarra Corretgé
8128e66145 Add FreeBSD support 2023-12-05 12:34:02 +01:00
Saúl Ibarra Corretgé
478bcf74f2 Add OpenBSD support 2023-12-05 12:34:02 +01:00
Felipe Gasper
56738d8b4b
Add Cygwin compatibility 2023-12-03 18:15:07 +01:00
Ben Noordhuis
9c2614c2fa
Fix building with tcc (#170)
- tcc doesn't support 128 bits integral types, use 64 bits math instead

- suppress some unreachable code warnings
2023-12-03 13:36:51 +01:00
bellard
148a205b71 Fix UB in bf_set_ui()
Ref: https://github.com/bellard/quickjs/issues/131
2023-12-02 16:05:10 +01:00
Nick Vatamaniuc
6b3bed1740
Fix stack overflow in CVE-2023-31922 (#157)
isArray and proxy isArray can call each other indefinitely in a mutually
recursive loop.

Add a stack overflow check in the js_proxy_isArray function before calling
`JS_isArray(ctx, s->target)`.

Original issue: https://github.com/bellard/quickjs/issues/178
CVE: https://nvd.nist.gov/vuln/detail/CVE-2023-31922
2023-12-01 16:31:36 +01:00
Saúl Ibarra Corretgé
bf1facaea3 Always enable stack checking
Seems to work in Emscripten and it can be disabled with
JS_SetMaxStackSize(rt, 0).
2023-12-01 15:29:18 +01:00
Ben Noordhuis
a5b9e54151
Re-enable stack depth checks under ASan (#161)
The default 256 kb stack is too small to run some of the test262 tests
when ASAN is enabled.

Double it to 512 kb and ensure threads created by quickjs have big
enough stacks.
2023-11-30 22:18:23 +01:00
Saúl Ibarra Corretgé
0745c3a12b Add Emscripten target to CI
No testing, just making sure it compiles, and keeps on doing so.

Ref: https://github.com/quickjs-ng/quickjs/issues/75
2023-11-30 21:29:51 +01:00
Saúl Ibarra Corretgé
6f5cda46e7 Test Debug and Release on ClangCL 2023-11-30 09:28:39 +01:00
Saúl Ibarra Corretgé
bfd8c381cb Add support for building with ClangCL on Windows
Since ClangCL is compatible with MSVC this should get us almost there.

Ref: https://clang.llvm.org/docs/MSVCCompatibility.html
2023-11-30 01:23:09 +01:00
Ben Noordhuis
3f10651dc1
Prohibit freezing/sealing module namespace objects (#160) 2023-11-30 00:42:36 +01:00
Ben Noordhuis
b6b70e471c
Add os.cputime() (#159)
And use it in microbench to get slightly more accurate results.
2023-11-30 00:05:48 +01:00
Ben Noordhuis
a140e1cf2c
Make -DDUMP_BYTECODE=64 print executed bytecode (#158)
Basically a poor man's bytecode tracer.
2023-11-29 23:53:01 +01:00
Ben Noordhuis
39c8acd312 Replace JS_DupValue() calls with js_dup() 2023-11-29 23:38:01 +01:00
Ben Noordhuis
f1d6e9e5ff Replace JS_NewBool() calls with js_bool() 2023-11-29 23:38:01 +01:00
Ben Noordhuis
a28d1b822c Replace JS_NewUint32() calls with js_uint32() 2023-11-29 23:38:01 +01:00
Ben Noordhuis
087441559e Replace JS_NewFloat64() calls with js_float64() 2023-11-29 23:38:01 +01:00
Ben Noordhuis
46155806fc Replace JS_NewInt32() calls with js_int32() 2023-11-29 23:38:01 +01:00
Linus Groh
3b034b84d9
Fix null pointer arithmetic UB in libregexp (#136)
This is a patch I originally wrote for the Kiesel JS engine:
https://codeberg.org/kiesel-js/kiesel/src/branch/main/patches/libregexp.patch
2023-11-29 14:43:02 +01:00
Ben Noordhuis
f181b3e54f
Remove dead code (#155) 2023-11-29 10:13:13 +01:00
Marcin Kolny
699744562e Enable support for GCC compler v < 4.9
GCCv4.8 and lower doesn't ship with stdatomic implementation
(even though they don't define __STD_NO_ATOMICS__ for c11).
If the code is compiled with GCCv4.8 and older, we use builtin
GCC atomic operations instead.

The patch was initially proposed in quickjs's mailing group:
https://www.freelists.org/post/quickjs-devel/PATCH-support-for-older-gcc-versions-whitespace-changes-excluded
2023-11-29 09:22:27 +01:00
Divy Srivastava
6b78c7f3e1
Implement polymorphic inline caches (#120) 2023-11-29 09:12:02 +01:00