Compare commits

...

21 Commits

Author SHA1 Message Date
Dmitry Volyntsev
92330d9edf
Merge 9c2a19eaac5d1a2b79e924f480fd0a4f3500b525 into 8807fedec55bc4dbdf7b4780d36bfc4b4fd6e5e2 2025-09-24 17:43:38 -04:00
Fabrice Bellard
8807fedec5 - added Atomics.pause (bnoordhuis)
- use the pause instruction for x86 and ARM64 in Atomics.pause()
2025-09-22 18:58:18 +02:00
Fabrice Bellard
f021d7714f - added resizable array buffers (bnoordhuis)
- fixed Atomics.wait, Atomics.notify, TypedArray.prototype.lastIndexOf
- fixed JS_PreventExtensions() with resizable typed arrays
2025-09-22 18:37:41 +02:00
Fabrice Bellard
44d03a823d fixed parsing of computed property name 2025-09-22 14:48:43 +02:00
Fabrice Bellard
1e19893c82 - added ArrayBuffer.prototype.transfer (Divy Srivastava)
- fixed transfer when the ArrayBuffer was allocated with a custom allocator
2025-09-21 16:41:02 +02:00
Fabrice Bellard
2d99c323a2 Iterator functions:
- removed memory leak
- don't close iterator when IteratorStepValue fails
- fixed  Iterator Wrap next() and return() arguments
- fixed Iterator.from()
2025-09-20 18:30:02 +02:00
Fabrice Bellard
cf0e179263 Iterator is an abstract class (bnoordhuis) 2025-09-20 17:05:13 +02:00
Fabrice Bellard
3dcca0d1d6 fix Iterator.prototype.constructor (initial patch by bnoordhuis) 2025-09-20 17:01:52 +02:00
Fabrice Bellard
b2ed2e91f5 added Iterator.prototype.[drop,filter,flatMap,map,take,every,find,forEach,some,reduce,[Symbol.toStringTag]] (saghul) 2025-09-20 16:47:43 +02:00
Fabrice Bellard
e924173c0f added Iterator.prototype.toArray and Iterator.from (bnoordhuis) 2025-09-20 16:27:45 +02:00
Fabrice Bellard
982b7aa14f added the Iterator object 2025-09-20 16:05:36 +02:00
Fabrice Bellard
0377dab4f2 removed uninitialized values - removed useless init 2025-09-20 14:31:14 +02:00
Fabrice Bellard
0cef7f0ddb set methods: removed memory leaks - fixed ordering of property access - fixed conversion to integer of 'size' in GetSetRecord() - added missing iterator close - factorized code 2025-09-20 14:21:39 +02:00
Fabrice Bellard
a1e073e444 added set methods (bnoordhuis) 2025-09-20 12:19:50 +02:00
Fabrice Bellard
de4d3927b8 removed memory leak (#441) 2025-09-18 10:42:13 +02:00
Fabrice Bellard
dc7af0ac42 updated release.sh 2025-09-18 10:28:33 +02:00
Fabrice Bellard
fa628f8c52 new release 2025-09-13 10:51:18 +02:00
Fabrice Bellard
391cd3feff Fix crash on failure to read bytecode (penneryu) 2025-09-13 10:22:24 +02:00
Fabrice Bellard
9f6c190731 more efficient handling of strings in JSON.stringify() 2025-09-10 18:40:10 +02:00
Fabrice Bellard
8a0a6e92d2 better pretty printing of strings - removed String.prototype.__quote() 2025-09-10 18:25:34 +02:00
Dmitry Volyntsev
9c2a19eaac Update JS_NewTypedArray() to C level API 2024-05-09 13:50:28 -07:00
10 changed files with 2525 additions and 468 deletions

View File

@ -1,3 +1,5 @@
2025-09-13:
- added JSON modules and import attributes - added JSON modules and import attributes
- added JS_PrintValue() API - added JS_PrintValue() API
- qjs: pretty print objects in print() and console.log() - qjs: pretty print objects in print() and console.log()
@ -12,6 +14,7 @@
accept JSON5 modules accept JSON5 modules
- added JS_FreePropertyEnum() and JS_AtomToCStringLen() API - added JS_FreePropertyEnum() and JS_AtomToCStringLen() API
- added Error.isError() - added Error.isError()
- misc bug fixes
2025-04-26: 2025-04-26:

2
TODO
View File

@ -62,5 +62,5 @@ Optimization ideas:
Test262o: 0/11262 errors, 463 excluded Test262o: 0/11262 errors, 463 excluded
Test262o commit: 7da91bceb9ce7613f87db47ddd1292a2dda58b42 (es5-tests branch) Test262o commit: 7da91bceb9ce7613f87db47ddd1292a2dda58b42 (es5-tests branch)
Result: 54/79414 errors, 1637 excluded, 6821 skipped Result: 48/81760 errors, 1631 excluded, 5564 skipped
Test262 commit: e7e136756cd67c1ffcf7c09d03aeb8ad5a6cec0c Test262 commit: e7e136756cd67c1ffcf7c09d03aeb8ad5a6cec0c

View File

@ -1 +1 @@
2025-04-26 2025-09-13

View File

@ -78,6 +78,8 @@ DEF(await, "await")
/* empty string */ /* empty string */
DEF(empty_string, "") DEF(empty_string, "")
/* identifiers */ /* identifiers */
DEF(keys, "keys")
DEF(size, "size")
DEF(length, "length") DEF(length, "length")
DEF(fileName, "fileName") DEF(fileName, "fileName")
DEF(lineNumber, "lineNumber") DEF(lineNumber, "lineNumber")
@ -189,6 +191,7 @@ DEF(timed_out, "timed-out")
DEF(ok, "ok") DEF(ok, "ok")
/* */ /* */
DEF(toJSON, "toJSON") DEF(toJSON, "toJSON")
DEF(maxByteLength, "maxByteLength")
/* class names */ /* class names */
DEF(Object, "Object") DEF(Object, "Object")
DEF(Array, "Array") DEF(Array, "Array")
@ -228,6 +231,9 @@ DEF(Map, "Map")
DEF(Set, "Set") /* Map + 1 */ DEF(Set, "Set") /* Map + 1 */
DEF(WeakMap, "WeakMap") /* Map + 2 */ DEF(WeakMap, "WeakMap") /* Map + 2 */
DEF(WeakSet, "WeakSet") /* Map + 3 */ DEF(WeakSet, "WeakSet") /* Map + 3 */
DEF(Iterator, "Iterator")
DEF(IteratorHelper, "Iterator Helper")
DEF(IteratorWrap, "Iterator Wrap")
DEF(Map_Iterator, "Map Iterator") DEF(Map_Iterator, "Map Iterator")
DEF(Set_Iterator, "Set Iterator") DEF(Set_Iterator, "Set Iterator")
DEF(Array_Iterator, "Array Iterator") DEF(Array_Iterator, "Array Iterator")

2780
quickjs.c

File diff suppressed because it is too large Load Diff

View File

@ -882,8 +882,8 @@ typedef enum JSTypedArrayEnum {
JS_TYPED_ARRAY_FLOAT64, JS_TYPED_ARRAY_FLOAT64,
} JSTypedArrayEnum; } JSTypedArrayEnum;
JSValue JS_NewTypedArray(JSContext *ctx, int argc, JSValueConst *argv, JSValue JS_NewTypedArray(JSContext *ctx, size_t length, const void *init,
JSTypedArrayEnum array_type); JSTypedArrayEnum type);
JSValue JS_GetTypedArrayBuffer(JSContext *ctx, JSValueConst obj, JSValue JS_GetTypedArrayBuffer(JSContext *ctx, JSValueConst obj,
size_t *pbyte_offset, size_t *pbyte_offset,
size_t *pbyte_length, size_t *pbyte_length,

View File

@ -174,7 +174,7 @@ cp Makefile VERSION TODO Changelog readme.txt LICENSE \
cp tests/*.js tests/*.patch tests/bjson.c $outdir/tests cp tests/*.js tests/*.patch tests/bjson.c $outdir/tests
cp examples/*.js examples/*.c $outdir/examples cp examples/*.js examples/*.c examples/*.json $outdir/examples
cp doc/quickjs.texi doc/quickjs.pdf doc/quickjs.html \ cp doc/quickjs.texi doc/quickjs.pdf doc/quickjs.html \
$outdir/doc $outdir/doc

View File

@ -64,12 +64,12 @@ Array.prototype.flatMap
Array.prototype.includes Array.prototype.includes
Array.prototype.values Array.prototype.values
ArrayBuffer ArrayBuffer
arraybuffer-transfer=skip arraybuffer-transfer
arrow-function arrow-function
async-functions async-functions
async-iteration async-iteration
Atomics Atomics
Atomics.pause=skip Atomics.pause
Atomics.waitAsync=skip Atomics.waitAsync=skip
BigInt BigInt
caller caller
@ -140,7 +140,7 @@ Intl.NumberFormat-v3=skip
Intl.RelativeTimeFormat=skip Intl.RelativeTimeFormat=skip
Intl.Segmenter=skip Intl.Segmenter=skip
IsHTMLDDA IsHTMLDDA
iterator-helpers=skip iterator-helpers
iterator-sequencing=skip iterator-sequencing=skip
json-modules json-modules
json-parse-with-source=skip json-parse-with-source=skip
@ -180,10 +180,10 @@ regexp-named-groups
regexp-unicode-property-escapes regexp-unicode-property-escapes
regexp-v-flag regexp-v-flag
RegExp.escape RegExp.escape
resizable-arraybuffer=skip resizable-arraybuffer
rest-parameters rest-parameters
Set Set
set-methods=skip set-methods
ShadowRealm=skip ShadowRealm=skip
SharedArrayBuffer SharedArrayBuffer
source-phase-imports-module-source=skip source-phase-imports-module-source=skip
@ -304,14 +304,10 @@ test262/test/built-ins/String/prototype/split/cstm-split-on-string-primitive.js
# spec updates it in this case) # spec updates it in this case)
test262/test/staging/sm/Array/frozen-dense-array.js test262/test/staging/sm/Array/frozen-dense-array.js
# does not match spec
test262/test/staging/sm/Iterator/from/wrap-next-not-object-throws.js
# not supported # not supported
test262/test/staging/sm/Set/difference.js
test262/test/staging/sm/Set/intersection.js
test262/test/staging/sm/Set/is-disjoint-from.js
test262/test/staging/sm/Set/is-subset-of.js
test262/test/staging/sm/Set/is-superset-of.js
test262/test/staging/sm/Set/symmetric-difference.js
test262/test/staging/sm/Set/union.js
test262/test/staging/sm/extensions/censor-strict-caller.js test262/test/staging/sm/extensions/censor-strict-caller.js
test262/test/staging/sm/JSON/parse-with-source.js test262/test/staging/sm/JSON/parse-with-source.js

View File

@ -5,8 +5,6 @@ test262/test/annexB/language/expressions/assignmenttargettype/callexpression-in-
test262/test/annexB/language/expressions/assignmenttargettype/callexpression-in-prefix-update.js:27: SyntaxError: invalid increment/decrement operand test262/test/annexB/language/expressions/assignmenttargettype/callexpression-in-prefix-update.js:27: SyntaxError: invalid increment/decrement operand
test262/test/annexB/language/expressions/assignmenttargettype/callexpression.js:33: SyntaxError: invalid assignment left-hand side test262/test/annexB/language/expressions/assignmenttargettype/callexpression.js:33: SyntaxError: invalid assignment left-hand side
test262/test/annexB/language/expressions/assignmenttargettype/cover-callexpression-and-asyncarrowhead.js:20: SyntaxError: invalid assignment left-hand side test262/test/annexB/language/expressions/assignmenttargettype/cover-callexpression-and-asyncarrowhead.js:20: SyntaxError: invalid assignment left-hand side
test262/test/built-ins/Atomics/notify/retrieve-length-before-index-coercion-non-shared-detached.js:34: TypeError: ArrayBuffer is detached
test262/test/built-ins/Atomics/notify/retrieve-length-before-index-coercion-non-shared-detached.js:34: strict mode: TypeError: ArrayBuffer is detached
test262/test/staging/sm/Date/UTC-convert-all-arguments.js:75: Test262Error: index 1: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true test262/test/staging/sm/Date/UTC-convert-all-arguments.js:75: Test262Error: index 1: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true
test262/test/staging/sm/Date/constructor-convert-all-arguments.js:75: Test262Error: index undefined: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true test262/test/staging/sm/Date/constructor-convert-all-arguments.js:75: Test262Error: index undefined: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true
test262/test/staging/sm/Date/non-iso.js:76: Test262Error: Expected SameValue(«NaN», «-40071559730000») to be true test262/test/staging/sm/Date/non-iso.js:76: Test262Error: Expected SameValue(«NaN», «-40071559730000») to be true
@ -26,19 +24,15 @@ test262/test/staging/sm/RegExp/regress-613820-3.js:12: Test262Error: Actual [aab
test262/test/staging/sm/RegExp/regress-613820-3.js:12: strict mode: Test262Error: Actual [aab, a, undefined, ab] and expected [aa, undefined, a, undefined] should have the same contents. test262/test/staging/sm/RegExp/regress-613820-3.js:12: strict mode: Test262Error: Actual [aab, a, undefined, ab] and expected [aa, undefined, a, undefined] should have the same contents.
test262/test/staging/sm/TypedArray/constructor-buffer-sequence.js:73: Error: Assertion failed: expected exception ExpectedError, got Error: Poisoned Value test262/test/staging/sm/TypedArray/constructor-buffer-sequence.js:73: Error: Assertion failed: expected exception ExpectedError, got Error: Poisoned Value
test262/test/staging/sm/TypedArray/prototype-constructor-identity.js:17: Test262Error: Expected SameValue(«2», «6») to be true test262/test/staging/sm/TypedArray/prototype-constructor-identity.js:17: Test262Error: Expected SameValue(«2», «6») to be true
test262/test/staging/sm/TypedArray/set-detached-bigint.js:27: Error: Assertion failed: expected exception SyntaxError, got RangeError: invalid array length
test262/test/staging/sm/TypedArray/set-detached.js:112: RangeError: invalid array length
test262/test/staging/sm/TypedArray/sort_modifications.js:12: Test262Error: Int8Array at index 0 for size 4 Expected SameValue(«0», «1») to be true test262/test/staging/sm/TypedArray/sort_modifications.js:12: Test262Error: Int8Array at index 0 for size 4 Expected SameValue(«0», «1») to be true
test262/test/staging/sm/async-functions/async-contains-unicode-escape.js:45: Error: Assertion failed: expected exception SyntaxError, no exception thrown test262/test/staging/sm/async-functions/async-contains-unicode-escape.js:45: Error: Assertion failed: expected exception SyntaxError, no exception thrown
test262/test/staging/sm/async-functions/await-error.js:12: Test262Error: Expected SameValue(«false», «true») to be true test262/test/staging/sm/async-functions/await-error.js:12: Test262Error: Expected SameValue(«false», «true») to be true
test262/test/staging/sm/async-functions/await-in-arrow-parameters.js:33: Error: Assertion failed: expected exception SyntaxError, no exception thrown - AsyncFunction:(a = (b = await/r/g) => {}) => {} test262/test/staging/sm/async-functions/await-in-arrow-parameters.js:33: Error: Assertion failed: expected exception SyntaxError, no exception thrown - AsyncFunction:(a = (b = await/r/g) => {}) => {}
test262/test/staging/sm/class/boundFunctionSubclassing.js:12: Test262Error: Expected SameValue(«false», «true») to be true test262/test/staging/sm/class/boundFunctionSubclassing.js:12: Test262Error: Expected SameValue(«false», «true») to be true
test262/test/staging/sm/class/compPropNames.js:26: Error: Expected syntax error: ({[1, 2]: 3})
test262/test/staging/sm/class/strictExecution.js:32: Error: Assertion failed: expected exception TypeError, no exception thrown test262/test/staging/sm/class/strictExecution.js:32: Error: Assertion failed: expected exception TypeError, no exception thrown
test262/test/staging/sm/class/superPropOrdering.js:83: Error: Assertion failed: expected exception TypeError, no exception thrown test262/test/staging/sm/class/superPropOrdering.js:83: Error: Assertion failed: expected exception TypeError, no exception thrown
test262/test/staging/sm/expressions/short-circuit-compound-assignment-const.js:97: TypeError: 'a' is read-only test262/test/staging/sm/expressions/short-circuit-compound-assignment-const.js:97: TypeError: 'a' is read-only
test262/test/staging/sm/expressions/short-circuit-compound-assignment-tdz.js:23: Error: Assertion failed: expected exception ReferenceError, got TypeError: 'a' is read-only test262/test/staging/sm/expressions/short-circuit-compound-assignment-tdz.js:23: Error: Assertion failed: expected exception ReferenceError, got TypeError: 'a' is read-only
test262/test/staging/sm/extensions/TypedArray-set-object-funky-length-detaches.js:55: RangeError: invalid array length
test262/test/staging/sm/generators/syntax.js:30: Error: Assertion failed: expected SyntaxError, but no exception thrown - function* g() { (function* yield() {}); } test262/test/staging/sm/generators/syntax.js:30: Error: Assertion failed: expected SyntaxError, but no exception thrown - function* g() { (function* yield() {}); }
test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-arguments.js:14: Test262Error: Expected SameValue(«"object"», «"function"») to be true test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-arguments.js:14: Test262Error: Expected SameValue(«"object"», «"function"») to be true
test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-eval.js:12: Test262Error: Expected SameValue(«"outer-gouter-geval-gtruefalseq"», «"outer-geval-gwith-gtruefalseq"») to be true test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-eval.js:12: Test262Error: Expected SameValue(«"outer-gouter-geval-gtruefalseq"», «"outer-geval-gwith-gtruefalseq"») to be true

View File

@ -86,7 +86,7 @@ function toStr(a)
case "undefined": case "undefined":
return "undefined"; return "undefined";
case "string": case "string":
return a.__quote(); return JSON.stringify(a);
case "number": case "number":
if (a == 0 && 1 / a < 0) if (a == 0 && 1 / a < 0)
return "-0"; return "-0";
@ -115,6 +115,41 @@ function bjson_test(a)
} }
} }
function bjson_test_arraybuffer()
{
var buf, array_buffer;
array_buffer = new ArrayBuffer(4);
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 4);
assert(array_buffer.resizable, false);
buf = bjson.write(array_buffer);
array_buffer = bjson.read(buf, 0, buf.byteLength);
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 4);
assert(array_buffer.resizable, false);
array_buffer = new ArrayBuffer(4, {maxByteLength: 4});
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 4);
assert(array_buffer.resizable, true);
buf = bjson.write(array_buffer);
array_buffer = bjson.read(buf, 0, buf.byteLength);
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 4);
assert(array_buffer.resizable, true);
array_buffer = new ArrayBuffer(4, {maxByteLength: 8});
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 8);
assert(array_buffer.resizable, true);
buf = bjson.write(array_buffer);
array_buffer = bjson.read(buf, 0, buf.byteLength);
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 8);
assert(array_buffer.resizable, true);
}
/* test multiple references to an object including circular /* test multiple references to an object including circular
references */ references */
function bjson_test_reference() function bjson_test_reference()
@ -171,6 +206,7 @@ function bjson_test_all()
assert(e instanceof TypeError); assert(e instanceof TypeError);
} }
bjson_test_arraybuffer();
bjson_test_reference(); bjson_test_reference();
} }