* Faster float encode, rely on the already done cast rather than
building the float representation (as for half floats).
* Faster checkbreak in decoding. More unlikely macros for decode.
* Faster uint32 decode.
* Decode integers in range [-0x80000000,0xffffffff] into fastints
when they are encoded with minimal length.
* Rework duk_require_stack() handling, avoid it for primitives and
only do it in non-primitive code paths (= array and map, and on
initial decode entry).
* Prototype of full decode switch table.
* Comment trivia.
* Fix some compiler warnings.
* Rename hobject helper functions for property entry access.
* Add helpers for looking up _Formals and _Varmap without inheritance.
* Add duk_xget_owndataprop() + variants for internal property lookups
without inheritance or side effects.
* Date built-in fix for .setTime(), .setYear(), etc on a frozen Date
instance. These should be allowed because they operate on an internal
slot which is not under normal property access control. Previously
the operations were incorrectly rejected with a TypeError.
* Changes to internal property definition and lookup here and there.
Mostly the changes should be no-op because e.g. inheritance only
matters if the internal property might be missing (which is not
usually the case).
When array size is limited to 16 bits, some internal operations which
don't support abandoning the array could try to grow it beyond 16 bits
rather than abandoning the array part. This caused an assertion failure
and also potentially memory unsafe behavior.
Changes:
* When growing the property table, sanity check entry and array sizes.
If the new values won't fit in the duk_hobject structure (which may
happen with 16-bit fields), fail the grow attempt with an internal
error. This avoids field truncation and potentially memory unsafe
behavior as a result.
* Rework array part growth vs. abandon code to avoid the GH-2023 issue.
* Add support for keeping array part when possible into
Object.defineProperty().
* Add support for abandoning array part when using internal variants
for defining properties (such as in Array .map()).
* Executor compile warning fix.
* Debug logging trivia, downgrade a noisy log entry.
* Fix compile warning in duk_cmdline.c.
When bytecode files are loaded, there are no memory safety guarantees
for invalid inputs. Reject bytecode files unless -b is given to
explicitly allow automatic bytecode file detection.
* Use emscripten-core/emsdk for emcc init.
* Better emcc cache warming in init so that emcc targets then build
without compiling library bc files.
* Reduce I/O for STDIN_ZIP case by copying duktape-releases from repo
snapshots.
While setting up an environment for running the catch clause, the
bytecode executor could trigger a memory allocation and thus a GC
within "error handling" state.
Fix this by splitting catch clause handling into two parts:
- Part 1: unwind activation(s) and catcher(s) until the desired
catcher is found (this should be side effect free). Then write
the error value and longjmp type to the value stack (at idx_base),
and set a calling scope flag to indicate we need to run part 2 too.
Finally, deactivate the "catch active" flag of the catcher.
- Part 2: runs after we're out of error handling and inside a new
setjmp. Setup the environment needed to run the catch clause and
execute it with the bytecode executor. If an error (such as out
of memory) happens here, it propagates out (or into a finally
clause) because the catcher no longer has "catch active" set.
It's as if the throw came from inside the catch code.
(Part 2 is only needed if a catch clause needs an environment for
the catch variable; currently this is always the case.)
Also add a sanity check to mark-and-sweep object compaction: in case
mark-and-sweep was called inside error handling (which should ideally
never happen), refuse to compact objects which causes side effects.
Also rename debug format code %!C to %!X, and add %!C (duk_catcher *)
and %!A (duk_activation *) format codes so that activations and
catchers can be debug printed conveniently.
* Add DUK_USE_NATIVE_STACK_CHECK config option.
* Add internal duk_native_stack_check() helper which checks and
throws if DUK_USE_NATIVE_STACK_CHECK() indicates we're out of
stack space.
* Add initial call sites for duk_native_stack_check(). These are
in addition to existing recursion limit checks.
* Add stack check example to cmdline example and 'duk' build on
Linux. Disabled by default for now.