- DUMP_XXX defined as nothing or 0 produces unconditional output
- DUMP_XXX defined as a bitmask produces conditional output based
on command line option -d<bitmask>
- add `JS_SetDumpFlags()` to select active dump options
- accept -d[<hex mask>] and --dump[=<hex mask>] to specify active
dump options, generalize command line option handling
- improve DUMP_READ_OBJECT output, fix indentation issue
In the pathological case shown in
https://github.com/quickjs-ng/quickjs/issues/367 both the object and the
registry will be destroyed as part of the GC phase of JS_FreeRuntime.
When the GC sweep happens it's possible we are holding on to a corpse so
avoid calling the registry callback in that case.
This is similar to how Weak{Map,Set} deal with iterators being freed as
part of a cycle.
Fixes: https://github.com/quickjs-ng/quickjs/issues/367
It was a wrapper around gcc's __builtin_expect macro but it was only
used in three places and not in a way that suggests it really helps
branch prediction on modern (or even not so modern) CPUs.
Refs: https://github.com/quickjs-ng/quickjs/issues/369
- avoid crashing on invalid atoms in `JS_AtomGetStrRT`
- do not dump objects and function_bytecode during
`JS_GC_PHASE_REMOVE_CYCLES` phase
- fix crash in `print_lines` on null source
* Improve REPL directive support
- use . on column 0 as directive prefix
- use `directives` object properties for genericity
- accept non ambiguous directive abbreviations
- reject invalid directive with extra characters
- simplify `handle_directive` and `handle_cmd`
- document ".help" instead of "\h"
- document ".load"
CMAKE_BUILD_TYPE only applies on single-configuration generators: https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
For multi-configuration generators like Visual Studio (or Xcode) --config needs to be used in order to build that specific configuration.
* Improve completion in REPL
- refine `get_context_object` to avoid throwing errors (eg: q.<TAB>)
- do not call `eval` in `get_context_object` to avoid throwing errors
and reduce bloat caused by variable closures.
- support completion of directives
* Optimize `JS_GetPropertyInt64` and `JS_TryGetPropertyInt64`
- add `js_get_fast_array_element()` to special case arrays and typed arrays
- use `js_get_fast_array_element()` in `JS_GetPropertyValue()`,
`JS_TryGetPropertyInt64()` and `JS_GetPropertyInt64()`.
- simplify `js_array_at()`
- change error message for `Object.create` invalid property descriptor
- disable v8 test cases for deprecated legacy RegExp static properties
and invalid left hand side error type
- update v8.txt
- fix v8.sh behavior for single tests
Translate IC opcodes to their non-IC variants before writing them out.
Before this commit they were not byte-swapped properly, breaking the
ability to load serialized bytecode containing ICs on systems with
different endianness. Inline caches are recomputed as needed now.
A pleasing side effect of this change is that serialized bytecode is,
on average, a little smaller because fewer atoms are duplicated now.
* Fix more error cases
- fix more cases of missing `sf->cur_pc`.
- use more precise error messages for number conversion methods
- add test cases in test_builtin.js
- updated v8 test results
* Improve consistency of JS_NewFloat64 API
- `JS_NewFloat64()` always creates a `JS_TAG_FLOAT64` value
- internal `js_float64()` always creates a `JS_TAG_FLOAT64` value
- add `js_int64` internal function for consistency
- rename `float_is_int32` as `double_is_int32`
- handle `INT32_MIN` in `double_is_int32`, use (somewhat) faster alternative
- add `js_number(d)` to create a `JS_TAG_FLOAT64` or a `JS_TAG_INT` value
if possible
- add `JS_NewNumber()` API for the same purpose
- use non testing constructor for infinities in `js_atof2`
- always store internal time value as a float64
- merge `JS_NewBigInt64_1` into `JS_NewBigInt64`
- use comparisons instead of `(int32_t)` casts (implementation defined behavior)
* Improve string parsing and JSON parsing
- fix JSON parsing of non ASCII string contents
- more precise string parsing errors
- more precise JSON parsing errors
- add `JS_ParseState::buf_start` to compute line/column
- fix HTML comment detection at start of source code
- improve v8 Failure messages (pulled and modified `formatFailureText` from **mjsunit.js**)
- ignore more v8 tests
After much tinkering with libuv's CI, I finally figured out that ASLR
is the root cause for the ASan and MSan failures. Newer kernels use
bigger PIE slides and the sanitizer runtimes don't know how to handle
those (yet - looks like it's been fixed upstream.)
Refs: https://github.com/quickjs-ng/quickjs/pull/315
Refs: https://github.com/libuv/libuv/pull/4365
* make `Object.prototype` an immutable prototype object
* throw an exception on `Object.setPrototypeOf(Object.prototype, xxx)`
* do not throw an exception for `Reflect.setPrototypeOf(Object.prototype, xxx)`