Saúl Ibarra Corretgé
3a96b9cb6f
Support private brand checks
...
Fixes: https://github.com/quickjs-ng/quickjs/issues/541
Ref: 3ab1c2b314
2024-09-24 18:37:02 +02:00
Saúl Ibarra Corretgé
c963112349
Fix use of js_malloc_usable_size
...
Make sure the one set in the malloc functions is used rather than the
default one, since it will likely use a different allocator.
For some reason, this didn't cause a problem on macOS, but it does in
Linux. Opsie! Added some CI to prevent these kinds of bugs.
2024-09-24 18:36:23 +02:00
Saúl Ibarra Corretgé
1defa63c73
Add version to navigator.userAgent ( #542 )
...
A la Deno and Bun.
2024-09-24 18:28:14 +02:00
Saúl Ibarra Corretgé
c25aad7b49
Add ability to (de)serialize symbols
...
Fixes: https://github.com/quickjs-ng/quickjs/issues/481
2024-09-24 10:01:08 +02:00
Saúl Ibarra Corretgé
d9a43d5a82
Provide a description for unitialized values in JS_ToStringInternal
...
After 56da486312
it's possible existing
code relied on the current exception not being null to dump it, and the
dumped value just said "[unsupported type]". This change provides a more
descriptive value.
2024-09-24 09:56:34 +02:00
Saúl Ibarra Corretgé
647e32c047
Ignore diff for generated files
...
Avoids annoyingly having to skip through them when doing git diff.
2024-09-23 23:36:54 +02:00
Saúl Ibarra Corretgé
d3c340373e
Now working on 0.7.0
2024-09-21 21:34:30 +02:00
Saúl Ibarra Corretgé
a815d1b7b6
Set version to 0.6.0
2024-09-20 21:26:07 +02:00
Andrew Johnson
fe5be3cad9
Add JS_SetLength API function
2024-09-20 09:49:51 +02:00
Saúl Ibarra Corretgé
6ce2dcc938
Add ability to compile the CLI with mimalloc
...
Some (unscientific) benchmark results:
| Benchmark (Higher scores are better) | QuickJS | QuickJS (mimalloc) |
|---------------------------------------|-------------------|--------------------|
| Richards | 1217 | 1229 |
| DeltaBlue | 1192 | 1297 |
| Crypto | 1195 | 1191 |
| RayTrace | 1477 | 2186 |
| EarleyBoyer | 2441 | 3246 |
| RegExp | 275 | 315 |
| Splay | 2461 | 3765 |
| NavierStokes | 2156 | 2119 |
| Score | 1318 | 1553 |
Running the V8 benchmark suite (version 7) on an M1 MacBook Pro.
Fixes: https://github.com/quickjs-ng/quickjs/issues/142
2024-09-20 09:49:01 +02:00
Saúl Ibarra Corretgé
cfeeff91db
Refactor JSMallocFunctions to simplify the implementation
...
Rather than having the user take care of JSMallocState, take care of the
bookkeeping internally (and make JSMallocState non-public since it's no
longer necessary) and keep the allocation functions to the bare minimum.
This has the advantage that using a different allocator is just a few
lines of code, and there is no need to copy the default implementation
just to moficy the call to the allocation function.
Fixes: https://github.com/quickjs-ng/quickjs/issues/285
2024-09-19 20:49:09 +02:00
Saúl Ibarra Corretgé
5f5170796e
regexp: fixed the zero advance logic in quantifiers
...
Ref: 10fc744ae4
2024-09-14 22:00:48 +02:00
Saúl Ibarra Corretgé
56da486312
Add JS_HasException
...
Ref: db9dbd0a2b
Ref: 5417ab0159
2024-09-14 21:58:58 +02:00
Ben Noordhuis
8557bd0a0a
Add Set.prototype.isSupersetOf ( #532 )
2024-09-14 00:19:20 +02:00
Saúl Ibarra Corretgé
f5c388d693
Fix regexp case insensitive flag ( #531 )
...
Ref: af308614a8
2024-09-13 23:50:44 +02:00
Saúl Ibarra Corretgé
ac958f1d2f
Optional chaining fixes
...
Ref: f25e5d4094
2024-09-13 23:27:35 +02:00
Ben Noordhuis
0990875ae8
Add Set.prototype.isSubsetOf ( #529 )
2024-09-13 22:58:47 +02:00
Saúl Ibarra Corretgé
9bb8a68390
Delete tests/test262.patch
...
We don't use it.
2024-09-13 21:40:43 +02:00
Ben Noordhuis
12940d7877
Add Set.prototype.isDisjointFrom ( #528 )
2024-09-13 21:04:09 +02:00
Saúl Ibarra Corretgé
fb70e0994b
Simplify realloc
...
Call to our free wrapper when size is 0.
2024-09-11 22:09:27 +02:00
Saúl Ibarra Corretgé
5a41aaa6a3
Use calloc rather than malloc + memset
2024-09-11 22:09:27 +02:00
Saúl Ibarra Corretgé
5765855089
Silence noisy (and useless) MSVC warnings
2024-09-11 20:15:53 +02:00
Saúl Ibarra Corretgé
d6b4c7d24f
Actuall fix zero-length gnu_printf format string warning
...
Turns out it cannot be disabled through the pragma.
2024-09-11 19:49:52 +02:00
Saúl Ibarra Corretgé
4be1bcdb5e
Disable stack checks when running with ASAN in Debug builds
...
Fixes: https://github.com/quickjs-ng/quickjs/issues/502
2024-09-11 10:32:30 +02:00
Saúl Ibarra Corretgé
dc6745a4b8
Mark required link libraries as PUBLIC ( #520 )
...
This way dependent projects only need to add this:
```
link_libraries(qjs)
```
or
```
target_link_libraries(mytarget qjs)
```
And CMake will link the resulting target with the libraries that qjs
needs too.
2024-09-10 23:42:31 +02:00
Saúl Ibarra Corretgé
6dd2ce308a
Fix JS_DetectModule if the first statement is an await
2024-09-10 23:12:21 +02:00
zeromake
902cc2cf0e
Add native module support on Windows
2024-09-10 22:47:40 +02:00
Saúl Ibarra Corretgé
ada24f33f3
Make a RelWithDebInfo build when testing with ASAN in the CI
...
Traces should be more useful if we keep debug data in.
2024-09-10 22:19:36 +02:00
Saúl Ibarra Corretgé
7ad980704c
Report async failures via exit code
...
Fixes: https://github.com/quickjs-ng/quickjs/issues/340
2024-09-10 21:42:01 +02:00
Saúl Ibarra Corretgé
5bf35450cd
Use an integer as the timer handle
...
Port of
9e561d5c2e
but adapted.
2024-09-09 23:42:53 +02:00
Saúl Ibarra Corretgé
54afb19745
Make the timeout test more resilient
...
Since we don't keep timers sorted by deadline but by insertion order,
the test is flaky in slow environments (GHA seemingly). Increase the
timeouts to give it a bigger chance of success.
ASan / UBSan builds are notoriously slow, so skip the test in those.
2024-09-09 22:42:51 +02:00
Saúl Ibarra Corretgé
194c45c4b5
Include winsock2.h before windows.h
...
Fixes a compilation warning.
2024-09-09 22:41:47 +02:00
Saúl Ibarra Corretgé
3ae4c0764f
Mark non-exported functions as static
...
MSVC throws a warning.
2024-09-09 22:41:47 +02:00
Ben Noordhuis
b751ed5026
Add Set.prototype.intersection ( #511 )
2024-09-09 22:08:24 +02:00
Ben Noordhuis
6ba2448751
Add Set.prototype.symmetricDifference ( #507 )
2024-09-09 19:39:30 +02:00
Saúl Ibarra Corretgé
61c8fe6fb0
Run FinalizationRegistry callback in the job queue
...
The spec says HostMakeJobCallback has to be used on the callback: https://tc39.es/ecma262/multipage/managing-memory.html#sec-finalization-registry-cleanup-callback
That makes the following (arguably contrived) example run forever until
memory is exhausted.
```js
let count = 0;
function main() {
console.log(`main! ${++count}`);
const registry = new FinalizationRegistry(() => {
globalThis.foo = main();
});
registry.register([]);
registry.register([]);
return registry;
}
main();
console.log(count);
```
That is unlike V8, which runs 0 times. This can be explained by the
difference in GC implementations and since FinRec makes GC observable,
here we are!
Fixes: https://github.com/quickjs-ng/quickjs/issues/432
2024-09-09 11:32:36 +02:00
Saúl Ibarra Corretgé
c740aa07c1
Fix zero-length gnu_printf format string warning
...
```
src/quickjs/quickjs.c: In function ‘JS_ReadString’:
src/quickjs/quickjs.c:34274:26: warning: zero-length gnu_printf format string [-Wformat-zero-length]
34274 | bc_read_trace(s, ""); // hex dump and indentation
| ^~
src/quickjs/quickjs.c: In function ‘JS_ReadFunctionBytecode’:
src/quickjs/quickjs.c:34334:30: warning: zero-length gnu_printf format string [-Wformat-zero-length]
34334 | bc_read_trace(s, ""); // hex dump + indent
```
Ref: https://github.com/quickjs-ng/quickjs/issues/502
2024-09-09 11:18:02 +02:00
Saúl Ibarra Corretgé
ad834a1445
Fix Error.prepareStackTrace tests on Windows
...
- Reset state before doing assertions since they also throw errors
- Make the path check independent of the path separator
2024-09-08 21:50:20 +02:00
Ben Noordhuis
7513260d9a
Add Set.prototype.difference ( #504 )
2024-09-07 09:44:55 +02:00
Saúl Ibarra Corretgé
da591954a8
Add ability to specify dump flags with an env variable
...
Useful for CI for example.
2024-09-06 23:52:54 +02:00
Saúl Ibarra Corretgé
89d9305582
Fix DUMP_MODULE_RESOLVE flag checks
...
Make sure to always check if the flag is enabled.
2024-09-06 23:19:47 +02:00
Saúl Ibarra Corretgé
b5d2210096
Document -D/--dump-flags in CLI output
2024-09-06 23:19:11 +02:00
Ben Noordhuis
8e81a88a18
Add Set.prototype.union ( #499 )
2024-09-06 09:24:21 +02:00
Saúl Ibarra Corretgé
77884360d6
Silence format-zero-length warning
2024-09-05 23:24:57 +02:00
Saúl Ibarra Corretgé
048f4278c0
Fix misleading indentation compilation errors
2024-09-05 23:24:57 +02:00
Saúl Ibarra Corretgé
114b8a4095
Enable all debug flags when compiling in debug mode
...
They still need to be individually enabled either via API or with the -D
CLI flag, but there is no need to modify the code and re-compile.
2024-09-05 23:24:57 +02:00
Ben Noordhuis
8c58e01928
Fix FinalizationRegistry with primitive held value ( #496 )
...
Apparently test262 does not test FinalizationRegistry#register() with
held values that are not objects.
Fixes: https://github.com/quickjs-ng/quickjs/issues/494
2024-09-04 12:32:32 +02:00
Ben Noordhuis
9bc41a8a00
Add Float16Array ( #491 )
2024-09-03 20:32:17 +02:00
Ben Noordhuis
0e5e9c2c49
Fix broken DUMP_BYTECODE debug option ( #489 )
...
Broken in commit 1baa6763f8
when unicode_from_utf8 was renamed to
utf8_decode_len.
2024-08-25 11:53:30 +02:00
Ben Noordhuis
568ac13ff5
Optimize js_map_write, don't loop twice ( #488 )
2024-08-23 17:53:17 +02:00