about summary refs log tree commit diff stats
path: root/lib/monoucha0
Commit message (Collapse)AuthorAgeFilesLines
* fromjs, jstypes: do not disable warningsbptato12 days2-10/+7
| | | | For various reasons, they no longer appear anyway.
* quickjs: fix lre_exec without JSContext opaquebptato2025-05-111-3/+8
|
* fromjs: switch back res to `var' from `out'bptato2025-05-102-74/+51
| | | | | | | | The original goal was to comply the Uninit warning, but this is now a futile effort as Uninit is no longer planned to be the default in Nim. Setting `res' to its type's default value is therefore just a waste of cycles when it's already zero-initialized.
* Enable ProveInit warningbptato2025-05-102-4/+3
| | | | It has caught some minor bugs.
* javascript: clean up getMemoryUsagebptato2025-05-071-26/+29
|
* libregexp: fix lre_check_timeout return valuebptato2025-05-041-1/+1
|
* Update QuickJS-NG to 0.10.0bptato2025-05-0415-9800/+4217
|
* jsregex: remove use of newSeqUninitializedbptato2025-04-301-5/+4
| | | | It's fine to zero-fill this.
* quickjs: remove pointless overloadbptato2025-04-111-4/+0
|
* quickjs: disable JSValueConst distinction in release modebptato2025-04-111-12/+23
| | | | | | | | | Regrettably, Nim implements converters using procedures instead of templates, so with JSValueConst it will gladly generate a gazillion pointless function calls for the linker to optimize away. Since JSValueConst itself is just a development tool, it's fine to disable in release mode.
* jserror: simplify custom error creationbptato2025-03-295-63/+56
| | | | | | | The old API was needlessly complex and suggested that it could only be used for DOMException (which is not the case). (Also optimized out code lookup from the DOMException constructor.)
* Monoucha version 0.10.0bptato2025-03-284-62/+25
|
* jsutils: add toJSValueConstArray, toJSValueConstOpenArraybptato2025-03-211-1/+8
|
* Update libregexp/libunicode bindingsbptato2025-03-203-14/+18
| | | | Lack of cbool is a pain. I'm sticking with JS_BOOL for now.
* quickjs: remove JSValue comparison overloadbptato2025-03-201-2/+6
| | | | | | it doesn't really do what you would expect, better use JS_Is* functions (also, it broke 32-bit builds)
* Re-add JSValueConstbptato2025-03-1210-255/+312
| | | | | | | | | This time, I've also ported over the consistency check to prevent some ownership bugs. Unfortunately, the check is very limited, and it is still possible to double-free or leak JSValues. I think it would be possible to make coverage 100%, but only with ARC...
* Update QuickJS-NG to 0.9.0bptato2025-03-1112-3895/+3906
|
* javascript: simplify a bitbptato2025-03-111-6/+3
|
* tojs: misc cleanupbptato2025-03-072-40/+66
| | | | | | | * optimize toJS set * change defineProperty wrappers to return an enum If we're going to wrap defineProperty, then let's do it properly.
* Update docsbptato2025-03-071-2/+0
|
* javascript: remove ishtmldda from registerTypebptato2025-03-064-11/+6
| | | | | | | It's simpler and more efficient to handle this in the DOM. (The interface was also confusing/broken in that it only really accepted one htmldda class.)
* javascript: generate gc_mark functionsbptato2025-03-061-11/+41
| | | | | Not having them is a bad omen; I think the only reason this hasn't caused an issue yet is that only a few types embed JSValues.
* Fix a testbptato2025-02-211-0/+2
|
* Update docsbptato2025-02-201-186/+197
|
* javascript: fix finalizers with non-RootRef derived objectsbptato2025-02-203-7/+11
| | | | | | We were calling the wrong getTypePtr. Also, fix some manual tests.
* fromjs, javascript: optimize out class name registrybptato2025-02-193-28/+21
| | | | | | | | Instead of hashing the class name for isInstanceOf, we now just reuse the Nim type pointer -> JSClassID map, which should be more efficient. This removes getClass and hasClass; these can be replaced by just reusing the class ID returned from registerType.
* tojs: clean up getTypePtrbptato2025-02-191-19/+31
|
* javascript: fix multiple registerType statements on same typebptato2025-02-151-2/+2
| | | | Fixes setTimeout etc. not working on client.
* quickjs: fix some bindingsbptato2025-02-151-1/+11
|
* javascript: small cleanupbptato2025-02-081-115/+95
|
* javascript: remove fromJSThis error messagesbptato2025-02-081-25/+23
| | | | fromJS is enough
* tojs: more type erasurebptato2025-02-081-33/+20
| | | | | | Starting to think that the eventual ORC Monoucha port should just restrict registerType to RootObj-derived objects. (Then we could always use the type field to dispatch on incref/decref.)
* javascript, jsopaque: call finalizers without corresponding JSValuebptato2025-02-054-25/+40
| | | | | | | | | | | | Previously, nim_finalize_for_js only called a finalizer if the opaque Nim object already had a corresponding JSValue. This was probably an oversight (at least I had no idea this worked this way), so now we always call the finalizer. The upshot is that this means that finalizers can now receive a nil runtime in this case, so finalizers not prepared for this might break. The solution is to either explicitly nil-check the runtime, or to ensure that such objects always get converted to a JSValue first.
* javascript: derive ctor functions from parent ctor functionsbptato2025-02-024-7/+19
| | | | no idea why JS_NewCFunction3 is not public...
* javascript: inline makeCtorJSCallAndRetbptato2025-02-021-10/+5
|
* jsopaque: add catch atombptato2025-02-011-0/+1
|
* javascript, tojs: fix an ownership bugbptato2025-01-313-8/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was breaking acid3 - occasionally. Fun times! The bug occurred in a case where a Nim object failed to transfer ownership to JS when 1. Nim object created 2. Nim drops reference, but JS keeps it 3. JS drops reference, but Nim keeps it (because of another Nim object holding onto it) 4. JS acquires reference, Nim drops it because in 4, JS got two references (per toJS behavior), and Nim didn't get any. The actual acid3 test, reduced: L1 d = document.createTextNode("iteration " + i + " at " + d); Text JS1 -> Nim1 Anchor 0 L2 document.createElement('a') Text JS1 -> Nim1 Anchor JS1 -> Nim1 L3 .appendChild(d); Text JS1 -> Nim2 Anchor JS1 <- Nim1 <-> Nim1 L4 d = d.parentNode; Text JS1 <- Nim1 Anchor JS2 -> Nim1 <-> Nim1 ^^^ bug! After this patch, the last line looks like Anchor JS1 -> Nim2 <-> Nim1 (I haven't been able to reduce the bug to a test case that doesn't have to run for seconds :/ triggering the GC manually doesn't cut it for some reason.) As noted in the comments, the implementation isn't optimal. I've described a hack there that could be used to increase performance; we'll see if it's actually needed.
* javascript: fix .jsget on JSValuebptato2025-01-281-5/+10
| | | | | | | | | | | | | | Since toJS doesn't create a new value, `node' must be dup'd if it is a JSValue. Also, forbid .jsset on JSValue as it was broken as well and it's not obvious what the intention is when using it. (Probably it should free the old value, but did the user think of setting it? :P) I can see why I made toJS not dup the value - to make returning consistent with Nim's semantics - but it really makes things confusing... implicitly behaving as lent might be better, albeit less convenient.
* javascript: clean up & optimizebptato2025-01-221-307/+217
| | | | welp, it doesn't really seem to make things faster...
* javascript: allow sink parametersbptato2025-01-222-0/+18
|
* javascript: add .jsrget, .jsrfgetbptato2025-01-221-53/+125
| | | | Implements the [Replaceable] WebIDL property.
* Add 'lib/monoucha0/' from commit '33efaee783c2adb20df019a8bc924411c4a97e7f'bptato2025-01-1850-0/+85771
git-subtree-dir: lib/monoucha0 git-subtree-mainline: b56abad0883c0b4179f9c329a7169bb544fac4a5 git-subtree-split: 33efaee783c2adb20df019a8bc924411c4a97e7f