Commit graph

73 commits

Author SHA1 Message Date
The Ghost of FOSS' Future
31447efe69
Update qjs.c 2025-01-09 00:51:59 +00:00
The Ghost of FOSS' Future
02c03f6a01
Update qjs.c 2025-01-09 00:48:26 +00:00
The Ghost of FOSS' Future
78a733fdc3
Update qjs.c 2025-01-09 00:47:30 +00:00
The Ghost of FOSS' Future
c5a8c04c50
Update qjs.c 2025-01-09 00:45:48 +00:00
The Ghost of FOSS' Future
5fd2efe534
Update qjs.c 2025-01-09 00:43:27 +00:00
The Ghost of FOSS' Future
2cb4872308
Update qjs.c 2025-01-09 00:40:50 +00:00
The Ghost of FOSS' Future
c47ebab939
Update qjs.c 2025-01-09 00:39:11 +00:00
The Ghost of FOSS' Future
7f9a72d70c
Update qjs.c 2025-01-09 00:36:32 +00:00
The Ghost of FOSS' Future
ecce83d642
Update qjs.c 2025-01-09 00:34:58 +00:00
The Ghost of FOSS' Future
cb6fce1b84
Update qjs.c 2025-01-09 00:34:19 +00:00
The Ghost of FOSS' Future
178998f808
Update qjs.c 2025-01-09 00:33:37 +00:00
The Ghost of FOSS' Future
68d1773417
Update qjs.c 2025-01-09 00:32:51 +00:00
The Ghost of FOSS' Future
e5fb17e956
Update qjs.c 2025-01-09 00:30:29 +00:00
The Ghost of FOSS' Future
0440d400af
Update qjs.c 2025-01-09 00:26:20 +00:00
The Ghost of FOSS' Future
2639ec1199
Update qjs.c 2025-01-09 00:24:29 +00:00
The Ghost of FOSS' Future
47a857309f
Update qjs.c 2025-01-08 23:01:43 +00:00
The Ghost of FOSS' Future
168dfe4d09
Update qjs.c 2025-01-08 23:00:34 +00:00
The Ghost of FOSS' Future
2cb01b10a4
Update qjs.c 2025-01-08 22:59:06 +00:00
The Ghost of FOSS' Future
c8d48b3937
Merge branch 'quickjs-ng:master' into master 2025-01-08 22:45:11 +00:00
Saúl Ibarra Corretgé
97ea19dc81 Simplify exiting interpreter with exception
- Avoid keeping the exception object around
- Avoid passing the responsibility of freeing the exeption object to the
  caller
2025-01-08 21:37:49 +01:00
Saúl Ibarra Corretgé
4b8057d512 Exit qjs on unhandled promise rejections
Fixes: https://github.com/quickjs-ng/quickjs/issues/790
2025-01-07 21:27:17 +01:00
The Ghost of FOSS' Future
710866995b
add more polyfills 2025-01-06 19:28:30 -06:00
The Ghost of FOSS' Future
5d1cb14683
move globals back 2025-01-06 15:55:44 -06:00
The Ghost of FOSS' Future
f9809db69a
Add files via upload 2025-01-06 15:50:00 -06:00
The Ghost of FOSS' Future
4d17eb56ad
Update qjs.c 2025-01-06 15:31:15 -06:00
The Ghost of FOSS' Future
36c5ea0dae
moves repl polyfills to repl script 2025-01-06 15:24:12 -06:00
The Ghost of FOSS' Future
44fa5dbf60
Update qjs.c 2025-01-06 14:25:39 -06:00
Ben Noordhuis
99c02eb451
Update stack limit in ASan builds (#778)
Otherwise recursive calls keep going until they trip ASan checks.

Remove the `__ASAN__` and `__UBSAN__` defines; no longer necessary.

Remove `globalThis.__running_with_sanitizer__` from qjs; likewise.

Fixes: https://github.com/quickjs-ng/quickjs/issues/671
Fixes: https://github.com/quickjs-ng/quickjs/issues/775
Fixes: https://github.com/quickjs-ng/quickjs/issues/776
2024-12-30 11:29:22 +01:00
KaruroChori
374915ad0c
Rename some internal symbols to avoid collisions 2024-12-15 11:01:16 +01:00
Saúl Ibarra Corretgé
ce03c998c4
Add ability to create standalone binaries with qjs
Ref: https://github.com/quickjs-ng/quickjs/issues/438
Closes: https://github.com/quickjs-ng/quickjs/pull/441
2024-12-03 22:59:11 +01:00
Saúl Ibarra Corretgé
92577d33ff Rename __argv to execArgv 2024-12-03 07:05:38 +01:00
Saúl Ibarra Corretgé
5cfb0ec260 Expose raw argv in CLI
`scriptArgs` only contains arguments that the CLI didn't parse, the
script might want to dig into all the arguments.
2024-12-02 21:17:16 +01:00
Saúl Ibarra Corretgé
f7f70fc579 Fix leak when interpreter exits due to exception
Fixes: https://github.com/quickjs-ng/quickjs/issues/720
2024-11-25 11:07:07 +01:00
Ben Noordhuis
df81c9940f
Make qjs --std switch include bjson module (#640) 2024-10-29 22:56:00 +01:00
Saúl Ibarra Corretgé
0c8aeb1d50 Eval CLI included files as scripts
After 8cd59bf7c4 any file included by qjs
with -I that would parse as a module is eval'd as so, which is usually
not the intent, but rather to define some global functions.
2024-10-24 22:25:13 +02:00
Saúl Ibarra Corretgé
cc11a829e8
Prefix stdlib modules with "qjs:"
Fixes: https://github.com/quickjs-ng/quickjs/issues/616
2024-10-24 22:24:03 +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é
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é
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é
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é
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é
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é
b5d2210096 Document -D/--dump-flags in CLI output 2024-09-06 23:19:11 +02:00
Ben Noordhuis
5a50ce3b08
Export bjson module (#478)
I find it convenient to have access to JS_ReadObject and JS_WriteObject
from JS land. That's precisely the functionality that tests/bjson.c
provides, ergo, move it into quickjs-libc.c
2024-08-11 11:04:08 +02:00
Tom Lienard
d3da56b630 Sync TLA implementation with upstream
Fixes: https://github.com/quickjs-ng/quickjs/issues/339
2024-06-07 15:46:44 +02:00
Saúl Ibarra Corretgé
6cb1301305 Accept "kmg" suffixes for memory limits
Switch the default in the CLI to kilobytes too.
2024-05-06 11:22:16 +02:00
Saúl Ibarra Corretgé
e5ae6cf106 Fix handling of memory limit
Default to 0, which is "disabled", just like the stack limit.
2024-05-06 11:22:16 +02:00
Saúl Ibarra Corretgé
2050bc782a Fix CLI memory stats output 2024-05-05 19:12:42 +02:00