Rename and reuse a previously internal duk_push_object_internal() which just
pushes a bare object (= object without an internal prototype) which is useful
for various dict / tracking map purposes.
* Remove 'enumerate' trap.
* Use 'ownKeys' trap for "for-in" too, as specified in ES7.
* Add enumerability check for 'ownKeys' result when used in for-in or
Object.keys(). Because there's no support for 'getOwnPropertyDescriptor'
trap yet, the check will always operate directly on the target object.
* Callstack index is required for most debug commands which accept one
* Index comes before other parameters, e.g. Eval has the signature:
REQ 0x1e <index> <code>
* Eval accepts null for the callstack index, indicating an indirect
eval.
Side effects may include finalizers which operate on the object and may thus
invalidate the 'e_idx' we've looked up. Fix by operating with NORZ macros and
using a single refzero check.
Also provide explicit fast / slow (small) variants for fastint downgrade
check: it doesn't make sense to inline the very large check except in the
hot paths of executor and call handling. Elsewhere it's better to save
footprint and thus code cache.
Uses Kahan summation combined with normalization to avoid overflow and
minimize rounding errors. The algorithm is based on V8's implementation
(without actually sharing any code).
Also some small performance optimization, e.g. when getting enumerates keys
(Object.keys() et al) write the keys into a preallocated dense array which is
allocated directly to size.
These can be used whenever we're 100% certain that the value stack index
exists and the type matches expected type. When these are true, a
duk_hstring, duk_hbuffer, or duk_hobject pointer fetch can be inlined to
small code.
The non-standard (default) variant allows non-BMP codepoints which get
encoded as extended UTF-8. The standard variant should use ToUint16()
coercion so that e.g. 0x123456 emits 0x3456.
The previous (buggy) code used ToUint32() + CESU-8 encoding in that case
which caused two codepoints (CESU-8) to be emitted for a codepoint (this
would actually be correct behavior for String.fromCodePoint()).
Fix the bug by using ToUint16() coercion when the standard behavior is
enabled.
Make duk_error_raw() noreturn but return void, and then define duk_error()
as a macro: (duk_error_raw(...), 0). This avoids MSVC warnings for duk_error()
being noreturn but still returning a value in its prototype.
Same changes for other throwers.