From 0e8fffd4de4a10f498f46cd0e99f53da6a523542 Mon Sep 17 00:00:00 2001 From: bellard <6490144+bellard@users.noreply.github.com> Date: Sun, 6 Sep 2020 18:57:11 +0200 Subject: [PATCH] 2020-01-19 release --- Changelog | 12 + Makefile | 34 +- TODO | 5 +- VERSION | 2 +- doc/jsbignum.html | 766 +++----- doc/jsbignum.pdf | Bin 199698 -> 153319 bytes doc/jsbignum.texi | 617 ++----- doc/quickjs.html | 15 +- doc/quickjs.pdf | Bin 162866 -> 162954 bytes doc/quickjs.texi | 9 +- examples/pi_bigdecimal.js | 18 +- libbf.c | 1128 +++++++----- libbf.h | 119 +- qjs.c | 26 +- qjsc.c | 24 +- qjscalc.js | 1439 ++++++++------- quickjs-atom.h | 26 +- quickjs-libc.c | 15 + quickjs-opcode.h | 3 - quickjs.c | 3222 +++++++++++++++++++--------------- quickjs.h | 18 +- repl.js | 34 +- test262_errors.txt | 13 + tests/test_bignum.js | 167 +- tests/test_op_overloading.js | 207 +++ tests/test_qjscalc.js | 18 +- 26 files changed, 4298 insertions(+), 3639 deletions(-) create mode 100644 tests/test_op_overloading.js diff --git a/Changelog b/Changelog index 73b1250..637dce1 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,15 @@ +2020-01-19: + +- keep CONFIG_BIGNUM in the makefile +- added os.chdir() +- qjs: added -I option +- more memory checks in the bignum operations +- modified operator overloading semantics to be closer to the TC39 + proposal +- suppressed "use bigint" mode. Simplified "use math" mode +- BigDecimal: changed suffix from 'd' to 'm' +- misc bug fixes + 2020-01-05: - always compile the bignum code. Added '--bignum' option to qjs. diff --git a/Makefile b/Makefile index e402d6b..88e605b 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ # # QuickJS Javascript Engine # -# Copyright (c) 2017-2019 Fabrice Bellard -# Copyright (c) 2017-2019 Charlie Gordon +# Copyright (c) 2017-2020 Fabrice Bellard +# Copyright (c) 2017-2020 Charlie Gordon # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -47,6 +47,8 @@ prefix=/usr/local #CONFIG_PROFILE=y # use address sanitizer #CONFIG_ASAN=y +# include the code for BigInt/BigFloat/BigDecimal and math mode +CONFIG_BIGNUM=y OBJDIR=.obj @@ -94,6 +96,9 @@ ifdef CONFIG_WERROR CFLAGS+=-Werror endif DEFINES:=-D_GNU_SOURCE -DCONFIG_VERSION=\"$(shell cat VERSION)\" +ifdef CONFIG_BIGNUM +DEFINES+=-DCONFIG_BIGNUM +endif CFLAGS+=$(DEFINES) CFLAGS_DEBUG=$(CFLAGS) -O0 CFLAGS_SMALL=$(CFLAGS) -Os @@ -153,9 +158,13 @@ endif all: $(OBJDIR) $(OBJDIR)/quickjs.check.o $(OBJDIR)/qjs.check.o $(PROGS) -QJS_LIB_OBJS=$(OBJDIR)/quickjs.o $(OBJDIR)/libregexp.o $(OBJDIR)/libunicode.o $(OBJDIR)/libbf.o $(OBJDIR)/cutils.o $(OBJDIR)/quickjs-libc.o +QJS_LIB_OBJS=$(OBJDIR)/quickjs.o $(OBJDIR)/libregexp.o $(OBJDIR)/libunicode.o $(OBJDIR)/cutils.o $(OBJDIR)/quickjs-libc.o -QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(OBJDIR)/qjscalc.o $(QJS_LIB_OBJS) +QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(QJS_LIB_OBJS) +ifdef CONFIG_BIGNUM +QJS_LIB_OBJS+=$(OBJDIR)/libbf.o +QJS_OBJS+=$(OBJDIR)/qjscalc.o +endif LIBS=-lm ifndef CONFIG_WIN32 @@ -215,7 +224,7 @@ libquickjs.a: $(patsubst %.o, %.nolto.o, $(QJS_LIB_OBJS)) $(AR) rcs $@ $^ endif # CONFIG_LTO -repl.c: $(QJSC) repl.js +repl.c: $(QJSC) repl.js $(QJSC) -c -o $@ -m repl.js qjscalc.c: $(QJSC) qjscalc.js @@ -301,7 +310,10 @@ endif HELLO_SRCS=examples/hello.js HELLO_OPTS=-fno-string-normalize -fno-map -fno-promise -fno-typedarray \ -fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \ - -fno-date -fno-module-loader -fno-bigint + -fno-date -fno-module-loader +ifdef CONFIG_BIGNUM +HELLO_OPTS+=-fno-bigint +endif hello.c: $(QJSC) $(HELLO_SRCS) $(QJSC) -e $(HELLO_OPTS) -o $@ $(HELLO_SRCS) @@ -372,20 +384,30 @@ test: qjs ./qjs tests/test_loop.js ./qjs tests/test_std.js ifndef CONFIG_DARWIN +ifdef CONFIG_BIGNUM ./qjs --bignum tests/test_bjson.js +else + ./qjs tests/test_bjson.js +endif ./qjs examples/test_point.js endif +ifdef CONFIG_BIGNUM + ./qjs --bignum tests/test_op_overloading.js ./qjs --bignum tests/test_bignum.js ./qjs --qjscalc tests/test_qjscalc.js +endif ifdef CONFIG_M32 ./qjs32 tests/test_closure.js ./qjs32 tests/test_op.js ./qjs32 tests/test_builtin.js ./qjs32 tests/test_loop.js ./qjs32 tests/test_std.js +ifdef CONFIG_BIGNUM + ./qjs32 --bignum tests/test_op_overloading.js ./qjs32 --bignum tests/test_bignum.js ./qjs32 --qjscalc tests/test_qjscalc.js endif +endif stats: qjs qjs32 ./qjs -qd diff --git a/TODO b/TODO index dbb4612..33a9b9d 100644 --- a/TODO +++ b/TODO @@ -73,6 +73,5 @@ REPL: Test262o: 0/11262 errors, 463 excluded Test262o commit: 7da91bceb9ce7613f87db47ddd1292a2dda58b42 (es5-tests branch) -Test262: 4/67619 errors, 913 excluded, 1660 skipped -Test262bn: 4/69722 errors, 846 excluded, 672 skipped -test262 commit: 19fd4bea797646ae9bbfc9d325f14052ca370b54 +Test262: 17/69942 errors, 855 excluded, 581 skipped +test262 commit: 28b4fcca4b1b1d278dfe0cc0e69c7d9d59b31aab diff --git a/VERSION b/VERSION index 242aa92..ceac556 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2020-01-05 +2020-01-19 diff --git a/doc/jsbignum.html b/doc/jsbignum.html index c60dc45..096dc04 100644 --- a/doc/jsbignum.html +++ b/doc/jsbignum.html @@ -1,7 +1,8 @@ - +
+