| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
For various reasons, they no longer appear anyway.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
It has caught some minor bugs.
|
| |
|
| |
|
| |
|
|
|
|
| |
It's fine to zero-fill this.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.)
|
| |
|
| |
|
|
|
|
| |
Lack of cbool is a pain. I'm sticking with JS_BOOL for now.
|
|
|
|
|
|
| |
it doesn't really do what you would expect, better use JS_Is* functions
(also, it broke 32-bit builds)
|
|
|
|
|
|
|
|
|
| |
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...
|
| |
|
| |
|
|
|
|
|
|
|
| |
* optimize toJS set
* change defineProperty wrappers to return an enum
If we're going to wrap defineProperty, then let's do it properly.
|
| |
|
|
|
|
|
|
|
| |
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.)
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
We were calling the wrong getTypePtr.
Also, fix some manual tests.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Fixes setTimeout etc. not working on client.
|
| |
|
| |
|
|
|
|
| |
fromJS is enough
|
|
|
|
|
|
| |
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.)
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
no idea why JS_NewCFunction3 is not public...
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
welp, it doesn't really seem to make things faster...
|
| |
|
|
|
|
| |
Implements the [Replaceable] WebIDL property.
|
|
git-subtree-dir: lib/monoucha0
git-subtree-mainline: b56abad0883c0b4179f9c329a7169bb544fac4a5
git-subtree-split: 33efaee783c2adb20df019a8bc924411c4a97e7f
|