* Change plain buffers to inherit from Uint8Array. This affects a lot of
small things like Object.prototype.toString() output, enumeration of plain
buffers, etc. It also changes JSON serialization for plain buffers because
the index properties are enumerable as with Uint8Array instances.
* Disable JSON stringify fastpath for plain buffers for now so that the
virtual index properties get serialized correctly.
* Remove ArrayBuffer non-standard virtual properties.
* Remove DataView non-standard virtual properties.
* Move .byteLength, .byteOffset, .BYTES_PER_ELEMENT, and .buffer into
inherited getters as required in ES6. However, the .length property
remains a virtual own property for now (it too is an inherited getter
in ES6).
* Move ArrayBuffer.allocPlain() and ArrayBuffer.plainOf() to
Uint8Array.allocPlain() and Uint8Array.plainOf() to match the
semantics change for plain buffers.
* Fix Node.js buffer .slice() behavior, the returned Node.js buffer
would have ArrayBuffer.isView == 0 which doesn't match the revised
Node.js behavior (Buffers being Uint8Array instances)
* Reject ArrayBuffers with a view offset/length in Node.js Buffer .slice()
rather than accept such ArrayBuffers without actually respecting the
view offset/length.
* Allow a plain buffer or a lightfunc as a constructor "replacement object"
return value.
* Comment on duk_buffer_to_string() safety w.r.t. potentially pushing
Symbol values.
* Went through all duk_push_(l)string() call sites too.
* Minor footprint optimization for pushing empty strings (use more
compact internal helper).
This mimics the Ecmascript behavior better and allows normalization to be used
for very large (positive or negative) components, just like in Ecmascript code.
Rename hour -> hours, minute -> minutes, second -> seconds, millisecond
-> milliseconds to better match Ecmascript APIs.
* Strings with 0xFF byte prefix are considered special symbols: they have
typeof "symbol" but still mostly behave as strings (e.g. allow ToString)
so that existing code dealing with internal keys, especially inside
Duktape, can work with fewer changes.
* Strings with 0x80 byte prefix are global symbols, e.g. Symbol.for('foo')
creates the byte representatio: 0x80 "foo"
* Strings with 0x81 byte prefix are unique symbols; the 0x81 byte is followed
by the Symbol description, and an internal string component ensuring
uniqueness is separated by a 0xFF byte (which can never appear anywhere in
an extended UTF-8 string). The unique suffix is up to Duktape internals,
currently two 32-bit counters are used. For example:
0x81 "mySymbol" 0xFF "0-17".
* Well-known symbols use the 0x81 prefix but lack a unique suffix, so their
format is 0x81 <description> 0xFF.
* ES6 distinguishes between an undefined symbol description and an empty
string symbol description. This distinction is not currently visible via
Ecmascript bindings but may be visible in the future. Append an extra
0xFF to the unique suffix when the description is undefined, i.e.
0x81 0xFF <unique suffix> 0xFF.
* Allow duplicates keys, even in strict mode (ES6).
* Add identifier reference shorthand: { Math }.
* Add method definition shorthand: { foo(a,b) { return a + b; } }.
* Eval/program code no longer has the CONSTRUCTABLE flag which was
previously set. Calling an eval/program function as a constructor
makes no sense and wasn't really supported previously. This change
has no compliance impact because eval/program code doesn't exist as
an unexecuted function in Ecmascript.
* Eval/program code no longer has a NAMEBINDING flag which was previously
set. The revised behavior is cleaner because eval/program code must
not have a name binding. However, the flag is only consulted if NEWENV
is also set, and NEWENV is never set for eval/program code. So this
change has no other effect other than affecting dumped bytecode.
* Anonymous functions don't have an own '.name' property but inherit
an empty string .name from Function.prototype.
* new Function() returns a function whose name is 'anonymous'.
* RegExp.prototype is no longer a RegExp instance, so e.g.
Object.prototype.toString.call(RegExp.prototype) now returns
[object Object].
* .source, .global, .ignoreCase, .multiline (and new ES6 properties
.sticky, .unicode, .flags) are inherited getters instead of actual
properties in the RegExp instance.
* RegExp constructor uses .flags rather than reading .global,
.ignoreCase, and .multiline when the argument is a RegExp instance.
Shifting signed values is implementation defined behavior so use unsigned
shifts and casts to sign extend (e.g. (duk_idx_t) (duk_int8_t) (x >> 24)).
Also avoid signed shift for lightfunc magic macro.
In ES6, Object.keys(), Object.freeze(), Object.isExtensible(), etc. no
longer reject non-object values with a TypeError, but instead either
ToObject coerce them or treat them as non-extensible objects with no
own properties, depending on the call.
Previously _Varmap was kept if any slow path accesses were made. Improve this
behavior so that, in the absence of eval() etc, safe slow path accesses are
allowed while still dropping the _Varmap. A safe slow path access is one that
doesn't match any of the statically declared variables in the function so that
(again assuming no new variables are declared by e.g. eval()) the varmap won't
be needed at runtime.
Allow dropping of _Formals even in presence of eval() or a potentially
dangerous slow path access if _Formals is empty *and* _Formals.length matches
nargs so that .length computation works out even without _Formals.
Also reduce initial bytecode allocation from 2kB to 256 bytes when
DUK_USE_PREFER_SIZE is defined (in absence of a more specific define).
String output must either (a) eval() back as an equivalent object, OR
(b) eval() to a SyntaxError.
Previous Duktape output, conformant to ES5/ES5.1, matched FunctionDeclaration
syntax but didn't parse back as an equivalent function.
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.