Ben Noordhuis
46155806fc
Replace JS_NewInt32() calls with js_int32()
2023-11-29 23:38:01 +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
Ben Noordhuis
5c3077e091
Implement RegExp serialization ( #153 )
...
JS_WriteObject() and JS_ReadObject() now support RegExp objects.
2023-11-29 08:50:53 +01:00
Ben Noordhuis
a6e73ca73c
Handle serialization endianness transparently ( #152 )
...
Change JS_WriteObject() and JS_WriteObject2() to write little-endian
data and update JS_ReadObject() to byte-swap data when running on a
big-endian system.
Obsoletes the JS_WRITE_OBJ_BSWAP flag, it is now a no-op.
Fixes: https://github.com/quickjs-ng/quickjs/issues/125
2023-11-28 22:49:01 +01:00
Saúl Ibarra Corretgé
5c136edbcf
Implement WeakRef
2023-11-28 13:26:33 +01:00
Saúl Ibarra Corretgé
1df9615638
Generalize weakref handling logic
2023-11-28 13:26:33 +01:00
Ben Noordhuis
b5148b212e
Implement static class initializer blocks ( #144 )
...
Spec compliance bug: "await" is illegal inside initializer blocks
_except_ when used as an identifier in a function expression, like so:
class C {
static {
var f = function await() {}
}
}
It is somewhat complicated to make the parser understand the distinction
and such code is probably rare or non-existent so I decided to leave
well enough alone for now.
2023-11-26 21:11:48 +01:00
Ben Noordhuis
51633afe56
Remove no-op OP_swap+OP_swap bytecode sequence ( #143 )
...
Observed in generated code for static initializers. We could in theory
track and correct it in js_parse_class() but doing it as a peephole
optimization is both easier and more general.
2023-11-26 16:54:43 +01:00
Ben Noordhuis
8df335a7b9
Expose class name to static initializers ( #139 )
...
Fixes: https://github.com/quickjs-ng/quickjs/issues/138
2023-11-26 01:09:18 +01:00
Saúl Ibarra Corretgé
d74b2e7ec1
Squelch a -Wcast-function-type warnings
...
Ref: https://github.com/quickjs-ng/quickjs/issues/131
2023-11-26 00:08:48 +01:00
Saúl Ibarra Corretgé
7776cc3b75
Fix getting array buffer when building Uint8Array
2023-11-25 00:42:44 +01:00
Saúl Ibarra Corretgé
27287519aa
Fix implicit enum conversion
...
Ref: https://github.com/quickjs-ng/quickjs/issues/131
2023-11-25 00:00:45 +01:00
Saúl Ibarra Corretgé
8f2993bd68
Add APIs to build a Uint8Array from binary data directly
2023-11-24 23:05:39 +01:00
Saúl Ibarra Corretgé
268cde8270
Add API to build Date objects
2023-11-24 23:05:27 +01:00
Ben Noordhuis
22a3d80740
Implement Map.groupBy
2023-11-24 11:30:21 +01:00
Ben Noordhuis
3e54403b08
Implement Object.groupBy
2023-11-24 11:30:21 +01:00
Divy Srivastava
a8a5ecb095
Specialize bytecode for default ctor ( #112 )
2023-11-24 01:27:18 +01:00
Saúl Ibarra Corretgé
5e4d45a9d4
Add -ng suffix to CLI output
2023-11-23 00:07:26 +01:00
Ben Noordhuis
165128257f
Fix AsyncGenerator.prototype.return error handling ( #109 )
...
A poisoned .constructor property is observable and the resulting
exception should be delivered to the catch handler, not silently
dropped, otherwise the generator hangs.
2023-11-21 23:57:10 +01:00
Saúl Ibarra Corretgé
8d496b3e3c
Add queueMicrotask
...
Ref: https://github.com/quickjs-ng/quickjs/issues/16
2023-11-21 23:43:17 +01:00
Divy Srivastava
1fcb573e6b
Implement ArrayBuffer.prototype.transfer ( #101 )
2023-11-21 19:29:23 +01:00
Ben Noordhuis
9e8d278161
Use ReferenceError from right realm/context ( #107 )
...
The "this is not initialized" ReferenceError for a class C defined in
context B but instantiated in context A should be an instance of the
ReferenceError from A, not B.
2023-11-21 19:24:15 +01:00
Ben Noordhuis
7c9cf46f97
Make Date methods argument coercion spec compliant ( #104 )
2023-11-21 15:04:38 +01:00
Divy Srivastava
7aabea9db0
Implement Error causes ( #103 )
2023-11-21 14:59:26 +01:00
Ben Noordhuis
d8ea7df950
Reject date strings with negative year zero ( #100 )
2023-11-21 11:43:45 +01:00
Saúl Ibarra Corretgé
5ce2957e23
Make JS_NewClassID thread aware
...
It's as thread-safe as JSRuntime, which isn't thread-safe, but multiple
threads can now allocate them on different runtimes without a problem.
2023-11-21 07:02:34 +01:00
Ben Noordhuis
b56a82d19f
Normalize inputs to String.prototype.localeCompare ( #97 )
...
NFC-normalize the inputs, otherwise strings like "Å" and "A\u030A"
(latin A with combining diacritical mark) don't compare equal.
2023-11-21 00:00:54 +01:00
Saúl Ibarra Corretgé
a721bda7b5
Drop CONFIG_ALL_UNICODE and enable it by default
2023-11-20 10:52:04 +01:00
Ben Noordhuis
bef2a12566
DRY surrogate pair handling ( #95 )
2023-11-20 09:46:02 +01:00
Ben Noordhuis
d1960d1bfe
Implement RegExp 'd' flag ( #86 )
2023-11-20 09:45:44 +01:00
Ben Noordhuis
4727e40ac8
Retrieve RegExp 'g' flag in spec conformant way ( #92 )
2023-11-19 17:26:03 +01:00
Ben Noordhuis
5af98ca858
Remove non-standard Date.__date_clock method ( #88 )
2023-11-18 19:15:05 +01:00
Ben Noordhuis
8ba4f4b824
Remove dead code ( #87 )
2023-11-18 19:14:24 +01:00
Saúl Ibarra Corretgé
ea068d9a70
Add performance.{now,timeOrigin}
...
Ref: https://github.com/quickjs-ng/quickjs/issues/16
2023-11-18 11:16:35 +01:00
Ben Noordhuis
d88e9df9de
Implement TypedArray.prototype.findLast{Index} ( #73 )
2023-11-17 11:56:22 +01:00
Ben Noordhuis
7e955f6f4c
Implement Array.prototype.findLast{Index} ( #70 )
2023-11-17 11:54:21 +01:00
Ben Noordhuis
90d8c6bae0
Fix uninitialized memory access ( #68 )
...
An alternative fix is to zero the `values` and `count` fields in
JS_NewObjectFromShape() irrespective of the object's class_id but
handling it in JS_GetPropertyValue() feels cleaner.
Fixes: https://github.com/quickjs-ng/quickjs/issues/63
2023-11-17 00:12:10 +01:00
Ben Noordhuis
48fc4bb26d
Update Array.prototype[Symbol.unscopables] ( #65 )
...
Add change-array-by-copy methods to Array.prototype[Symbol.unscopables].
2023-11-16 13:05:51 +01:00
Ben Noordhuis
feebfbc6ee
Add Array.prototype.toSpliced ( #64 )
2023-11-16 13:04:53 +01:00
Ben Noordhuis
d2e632e77a
Allow symbols as WeakMap and WeakSet keys ( #58 )
2023-11-16 09:07:59 +01:00
Saúl Ibarra Corretgé
9749a90cc6
Skip stack checks whenbuilding with ASAN
2023-11-14 12:44:16 +01:00
Ben Noordhuis
f404980ec0
Add fused get_loc0_loc1 opcode ( #55 )
...
get_loc0 and get_loc1 are individually very frequent opcodes _and_ they
are very often paired together, making them ideal candidates for opcode
fusion.
Reduces microbench.js running time by about 4%.
2023-11-13 00:54:13 +01:00
Ben Noordhuis
920cfc679a
Add copyright notices ( #51 )
...
I believe we made enough substantial changes to have a credible claim to
copyright holdership.
2023-11-12 22:42:07 +01:00
Ben Noordhuis
e8ff1f4a3a
Remove broken SHORT_OPCODES=0 build mode ( #49 )
2023-11-12 13:35:41 +01:00
Ben Noordhuis
a92e74acac
Remove broken OPTIMIZE=0 build mode ( #47 )
2023-11-12 13:34:08 +01:00
Ben Noordhuis
162a8b7409
Remove trailing whitespace ( #46 )
...
Not purely cosmetic because it breaks navigation with { and } in the
One True Editor.
2023-11-12 10:01:40 +01:00
Ben Noordhuis
15f798db27
Implement Array.prototype.with ( #45 )
2023-11-11 23:35:46 +01:00
Ben Noordhuis
a19b07af37
Implement Array.prototype.toSorted ( #44 )
2023-11-11 21:51:02 +01:00