Commit graph

352 commits

Author SHA1 Message Date
Rob Loach
412c0011bb android: In NDK, malloc_usable_size() was renamed to dlmalloc_usable_size() 2024-01-29 22:28:58 +01:00
Guilherme Bernal
6868fb9e25 feat: Added functions to get access to module exports 2024-01-18 18:42:37 +01:00
Ben Noordhuis
e995085d0c Fix evaluation order of computed properties
The evaluation order is observable. Align with what test262 expects.
2024-01-16 12:43:35 +01:00
Jason
48e4c63a0e
Add support for compiling with Microsoft Visual Studio C++ (MSVC) (#246) 2024-01-16 12:42:05 +01:00
Andries Hiemstra
5f6171c722
removed some unused vars (#245) 2024-01-04 16:55:56 +01:00
Ben Noordhuis
4b138c8923
Run V8 spec conformance test suite (#243)
The shell script runs the tests and diffs stdout against v8.txt.
Lines added/removed means tests were broken/fixed.

Future work is to a) fix failing tests, and b) enable more tests.

A number are disabled for various reasons and mjsunit subdirectories are
currently skipped. Need to decide on a case-by-case basis what is and
isn't relevant to us.

At the moment about 430 tests are run of which approx. 80% pass.
2024-01-02 07:47:40 +01:00
Ben Noordhuis
9f9bf3c9ab
Fix for/in iteration over proxy objects (#241) 2023-12-30 22:47:32 +01:00
Ben Noordhuis
b5d6cea20e
Fix Reflect typed array element conversion (#240) 2023-12-30 10:45:33 +01:00
Ben Noordhuis
05fb3d9dc8
Fix Reflect with detached ArrayBuffer (#239) 2023-12-29 15:10:45 +01:00
Ben Noordhuis
64c9ac5392
Fix run-test262 dynamic import (#237)
Make basename imports resolve relative to the file under test.
2023-12-27 10:19:58 +01:00
Nathan Rajlich
440fc1b96b
Fix getTimezoneOffset() when tm_gmtoff is not available (#224) 2023-12-24 09:34:14 +01:00
Saúl Ibarra Corretgé
2fb838c803 Fix UB in js_dtoa1 2023-12-23 00:11:41 +01:00
Fabrice Bellard
fad030bef2 reduced JS_MAX_LOCAL_VARS (github issue #123) 2023-12-23 00:11:41 +01:00
Saúl Ibarra Corretgé
bfb4b35722 Fix: 'for of' expression cannot start with 'async'
Ref: 7cefa7b121
2023-12-23 00:11:41 +01:00
Saúl Ibarra Corretgé
7ef2ed6363 Remove incorrect await in async yield*
Ref: 43420235d5
2023-12-23 00:11:41 +01:00
Saúl Ibarra Corretgé
0a640f5040 Add container_of macro
Ref: c3599515c8
2023-12-23 00:11:41 +01:00
Fabrice Bellard
c1a3b64382 Safer typed array finalizer 2023-12-23 00:11:41 +01:00
Saúl Ibarra Corretgé
b8402ad388 Fix js_strtod with large integers
Ref: a96f440746
2023-12-23 00:11:41 +01:00
Nathan Rajlich
119f2c1b4c
Add support for cmake -DDEBUG_LEAKS=1 (#230)
I want to do a Release build (so that assert is disabled), but still
log leaks. This adds the option to enable that through CMake.
2023-12-22 21:30:10 +01:00
Nathan Rajlich
f94fbe2f8a Make performance configurable 2023-12-22 12:11:29 +01:00
Ben Noordhuis
f0ef9e1593
Implement RegExp 'v' flag, part 1 (#229)
This commit implements the flag itself and teaches the regex engine to
reject previously accepted patterns when in unicodeSets mode.

Refs: https://github.com/quickjs-ng/quickjs/issues/228
2023-12-21 19:37:31 +01:00
Saúl Ibarra Corretgé
d1852b5ea2 Remove unnecessary casts
Follow-up to https://github.com/quickjs-ng/quickjs/pull/195
2023-12-20 09:02:28 +01:00
Saúl Ibarra Corretgé
c29ae8d08c Now working on 0.4.0 2023-12-19 22:58:20 +01:00
Saúl Ibarra Corretgé
2d0b6d8ade Set version to 0.3.0 2023-12-19 22:46:31 +01:00
Saúl Ibarra Corretgé
4c929c5b6b Implement Error.stackTraceLimit
We default to 10 with a max cap of 64.

Ref: https://v8.dev/docs/stack-trace-api
2023-12-19 22:45:36 +01:00
Saúl Ibarra Corretgé
555d837334 Implement Error.prepareStackTrace support
Based on V8's API: https://v8.dev/docs/stack-trace-api.

Bits picked from Frida: 78fd25fed8

Closes: https://github.com/quickjs-ng/quickjs/issues/134
2023-12-19 15:36:44 +01:00
Ben Noordhuis
471e821570
Fix typo in #undef (#222) 2023-12-16 15:11:28 +01:00
Saúl Ibarra Corretgé
8934101a67 Drop non-standard Error properties 2023-12-16 01:09:49 +01:00
Ben Noordhuis
5cbf8727a6
Retain function source code in serialized bytecode (#218)
Also fix a small memory leak in the output from `qjsc -e`.

Fixes: https://github.com/quickjs-ng/quickjs/issues/217
2023-12-16 01:01:26 +01:00
Saúl Ibarra Corretgé
7474b28036 Remove unused member from JSContext 2023-12-16 00:44:31 +01:00
Ben Noordhuis
35e6bfceb1
Partially port bellard/quickjs@58f374ef42 (#214)
This commit merges JS_SetPropertyGeneric into JS_SetPropertyInternal2
and obsoletes commit b51b510 and partially obsoletes commit 8baafc4;
detachment and negative zero handling now fall out naturally.
2023-12-15 00:03:18 +01:00
Ben Noordhuis
ba8b80f112
Remove broken JS_READ_OBJ_ROM_DATA flag (#216)
This JS_ReadObject() flag no longer works for bytecode. The IC opcodes
are patched during execution.

Fixes: https://github.com/quickjs-ng/quickjs/issues/206
Refs: https://github.com/quickjs-ng/quickjs/pull/120
2023-12-14 15:25:29 +01:00
Saúl Ibarra Corretgé
e5812862f9 Fix 'return' handling with 'yield' in 'for of' or with finally blocks
Ref: 4bb8c35da7
2023-12-14 11:49:14 +01:00
Saúl Ibarra Corretgé
39901e2b86 Fix async generator in case of exception in implicit await in the 'return' statement
Ref: 57105c7f23
2023-12-14 11:49:14 +01:00
Fabrice Bellard
864a66459b Raise an error if a private method is added twice to an object 2023-12-14 11:49:14 +01:00
Ben Noordhuis
b51b5100b0
Handle negative zero typed array indices correctly (#212)
`ta["-0"] = 42` is a thing and not just any thing but a decidedly weird
thing: it completes successful, sets no property, but still evaluates
the value for side effects.
2023-12-14 11:12:55 +01:00
Ben Noordhuis
5168db1965
Handle TypedArray detach during iteration (#209)
Per spec: detaching the TA mid-iteration is allowed.

TypedArray.prototype.sort should not throw an exception when that
happens and now no longer does.
2023-12-13 08:55:01 +01:00
Ben Noordhuis
8baafc46bd
Don't throw OOB exception for detached typed array (#208)
`a[42] = 1` where a is a detached typed array should not throw but
`Object.defineProperty()` still should. Add a check and a flag that
distinguishes between the two cases.
2023-12-12 23:14:33 +01:00
Ben Noordhuis
b478329cdd
Remove JSFunctionBytecode.has_debug flag (#207)
And merge the debug struct into JSFunctionBytecode because it is now
always present.

Refs: https://github.com/quickjs-ng/quickjs/pull/193#pullrequestreview-1774511177
2023-12-12 00:10:52 +01:00
Saúl Ibarra Corretgé
030a0ddf3f Add navigator.userAgent to qjs CLI 2023-12-11 22:46:01 +01:00
Ben Noordhuis
bace4f635e
Record source column positions (#193)
And:
- display them in stack traces
- expose them as Function.prototype.columnNumber

OP_line_num is renamed to OP_source_loc and the pc2line data structure
is extended with the column number in zigzag encoding.

The bytecode version number BC_VERSION is incremented because pc2line
data is read and written by JS_ReadObject() and JS_WriteObject() when
it is present.

Fixes: https://github.com/quickjs-ng/quickjs/issues/149
2023-12-11 22:36:13 +01:00
Ben Noordhuis
40771c9103
Disable flaky test on Cygwin (#202)
Unclear why sending a SIGQUIT signal sometimes works and sometimes
doesn't but it's probably some kind of race condition in Cygwin's
emulation layer.

Fixes: https://github.com/quickjs-ng/quickjs/issues/184
2023-12-11 22:02:32 +01:00
Saúl Ibarra Corretgé
de44a37ae9 Fix not rebuilding source 2023-12-11 09:59:32 +01:00
Ben Noordhuis
dbed7be3cb
Handle TypedArray detach during iteration (#201)
Per spec: detaching the TA mid-iteration is allowed and should not
not throw an exception.

In the case of TypedArray.prototype.set, because iteration over the
source array is observable, we cannot bail out early when the TA is
first detached.
2023-12-11 09:22:02 +01:00
Ben Noordhuis
f7f1906989
Switch to SIGTERM in child process test (#203)
The hope is that switching from SIGQUIT to SIGTERM will resolve the
test's flakiness on Cygwin.

Refs: https://github.com/quickjs-ng/quickjs/issues/184
2023-12-11 09:21:19 +01:00
Ben Noordhuis
315096461b
Implement TypedArray.prototype.with (#200) 2023-12-10 21:25:31 +01:00
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