Commit Graph

31 Commits

Author SHA1 Message Date
Dmitry Volyntsev
e4495dbd88 Add JS_GetVersion() 2024-05-09 18:48:29 -07:00
Charlie Gordon
d378a9f3a5
Improve js_os_exec (#295)
- use $(shell) make command to test if closefrom() is available
- use closefrom() if available in js_os_exec()
- limit the fallback loop to 1024 handles to avoid costly loop on linux alpine.
PR inspired by @nicolas-duteil-nova
2024-05-10 01:57:55 +02:00
Renáta Hodován
01454caf78
OSS-Fuzz targets improvements (#267)
* Move fuzz target sources from the oss-fuzz repository here

* Add support to build libFuzzer targets
* Simplify the fuzz_eval and fuzz_compile targets

The use of JS_NewContext instead of JS_NewContextRaw spares to call
JS_AddIntrinsic<XYZ> functions from the fuzz target, since the public
JS_NewContext API does exactly the same.

* Simplify the fuzz_regexp target

fuzz_regexp doesn't need to be dependant on libquickjs since the
runtime and the context - that were provided by libquickjs - were
only created to call two simple functions implemented in libquickjs
which could be mimicked by the fuzzer.
The removal of runtime and context objects implicated further
simplifications, like the omission of their one-time creation.
Finally, writing the result of the regexp operations into a file
is also superfluous, since it's not used by anybody.

* Recreate and destroy JS runtime and context in fuzz_eval and fuzz_compile targets

Before this patch, the test executions were not independent,
since all the executed tests used the same JavaScript runtime and
context, causing irreproducible failure reports.

* Enable bignumber support in eval and compile targets

Big numbers are used by the input corpus, but the targets were not
able to interpret them since they were not compiled into them.
This change improved the inital coverage of the fuzz_eval target with
21% and the coverage of the fuzz_compile target with 25% when using
the official corpus.

* Ensure std and os modules are available in the fuzz_eval and fuzz_compile targets
* Add fuzzer dictionary with builtin and variable names. Furthermore, added a JS script that collects all the builtin
names from the executing engine. 
* Move common fuzzer code into one place
* Enable to define the LIB_FUZZING_ENGINE variable to ease the oss-fuzz integration
* Add README to fuzzers
2024-05-08 18:19:48 +02:00
Charlie Gordon
8180d3dd87 Improve microbench.js
- ensure handler behavior does not depend on n argument
- load and save reference file in node.js
- add -s filename option to name the output reference file
- add targets in Makefile for tests and bencharks using node.js
- fix incorrect timings when not using high resolution timer
- use performance timer in node.js
- output performance factor instead of percentage
- use smaller threshold by default
- add benchmarks for:
    date_parse(), prop_update(), prop_clone(), array_slice()
    global_func_call(),
2024-02-26 00:14:31 +01:00
Charlie Gordon
b70e764427 Rewrite set_date_fields to match the ECMA specification
- use `double` arithmetic where necessary to match the spec
- use `volatile` to ensure correct order of evaluation
  and prevent FMA code generation
- reject some border cases.
- avoid undefined behavior in `double` -> `int64_t` conversions
- improved tests/test_builtin.js `assert` function to compare
  values more reliably.
- added some tests in `test_date()`
- disable some of these tests on win32 and cygwin targets
2024-02-21 21:22:10 +01:00
Charlie Gordon
97ae6f39e6 Add benchmarks target
- assuming quickjs-benchmarks is cloned in the parent directory,
- compile quickjs-benchmarks targets and run the benchmarks
2024-02-19 01:13:07 +01:00
Charlie Gordon
c24a865a29 Improve run-test262
- add -t to show timings
- add -C to select compact progress meter
- default to compact progress meter if not attached to console
- set agent stack size to 2MB
- compute module filename relative to current path
- ignore `testdir` for -d and -f options
- return non zero status on errors changes
2024-02-18 15:00:04 +01:00
Charlie Gordon
0a361b7c0f handle missing test262 gracefully 2024-02-17 22:56:54 +01:00
Charlie Gordon
74bdb4967c Improve tests
- split test_bigfloat.js from test_bignum.js
- make test_date() compatible with node
- document Date constructor string argument format:
  should add test cases for invalid strings
- test_argument_scope(): only test this syntax error in strict mode:
  `var f = function(a = eval("var arguments")) {};`
2024-02-17 21:54:19 +01:00
Charlie Gordon
85fb2caeae Fix UB signed integer overflow in js_math_imul
- Use uint32_t arithmetics and Standard conformant conversion to
  avoid UB in js_math_imul.
- add builtin tests
- use specific object directories for SAN targets
2024-02-17 21:15:29 +01:00
Charlie Gordon
c06af876f6 Improve string concatenation hack
- add more cases of in place string concatenation
  this temporary hack improves the microbench timing by 30% but
  has little impact on the test262 timings.
2024-02-15 10:30:04 +01:00
Nick Vatamaniuc
636c946531
FreeBSD QuickJS Patch (#203) 2024-02-12 11:28:00 +01:00
Ben Noordhuis
fd6e039770 Add UndefinedBehaviorSanitizer support 2024-02-11 20:37:24 +01:00
Ben Noordhuis
325ca194b7 Add MemorySanitizer support 2024-02-11 20:27:34 +01:00
Charlie Gordon
c9e6c56c70 Improve microbench
- remove import statements (invoke with qjs --std)
- fix compatibility issues with node
- add more loop styles
- add more string concatenation tests
- use === and !=== where appropriate
- fix sort timing log
- add `-r ref_file` command line option to specify reference file
- add .gitignore file with target file patterns
2024-02-11 12:11:53 +01:00
Charlie Gordon
37bd4ae62d Strip trailing spaces 2024-02-10 16:19:17 +01:00
Fabrice Bellard
1ed38eef33 fixed MingW64 install on Windows (absop) (github issue #230) 2024-02-03 15:48:09 +01:00
Fabrice Bellard
00967aac24 fixed Promise return in the REPL by using a wrapper object in async std.evalScript() (github issue #231) 2024-02-03 15:47:42 +01:00
Fabrice Bellard
6e651e86e5 allow override of PREFIX, CROSS_PREFIX, CFLAGS and LDFLAGS in Makefile (humenda) 2024-01-13 11:15:28 +01:00
Fabrice Bellard
9a4379daf6 native cosmopolitan build 2024-01-11 15:29:19 +01:00
Fabrice Bellard
9b587c461b call js_std_free_handlers() in the code generated by qjsc (github issue #96) 2023-12-22 11:07:00 +01:00
Fabrice Bellard
a610598df6 added -fwrapv to CFLAGS to ensure that signed overflows have a well defined behavior 2023-12-13 19:00:17 +01:00
Fabrice Bellard
3106401991 keep LTO 2023-12-05 16:52:36 +01:00
Fabrice Bellard
cdeca4de42 updated to unicode 15.0.0 2023-12-05 16:51:16 +01:00
bellard
94010edb57 the BigInt support is now always included 2023-12-04 19:26:32 +01:00
bellard
b5e62895c6 2021-03-27 release 2021-03-27 11:17:31 +01:00
bellard
204682fb87 2020-11-08 release take 2 2020-11-08 14:44:20 +01:00
bellard
b1f67dfc1a 2020-11-08 release 2020-11-08 14:30:56 +01:00
bellard
8900766099 2020-07-05 release 2020-09-06 19:07:30 +02:00
bellard
0e8fffd4de 2020-01-19 release 2020-09-06 18:57:11 +02:00
bellard
91459fb672 2020-01-05 release 2020-09-06 18:53:08 +02:00