Skip to content

Commit

Permalink
更新到2019-07-21版本
Browse files Browse the repository at this point in the history
  • Loading branch information
llgoer committed Jul 21, 2019
1 parent 257524f commit a556e1d
Show file tree
Hide file tree
Showing 32 changed files with 2,772 additions and 3,133 deletions.
13 changes: 13 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
2019-07-21:

- updated test262 tests
- updated to Unicode version 12.1.0
- fixed missing Date object in qjsc
- fixed multi-context creation
- misc ES2020 related fixes
- simplified power and division operators in bignum extension
- fixed several crash conditions

2019-07-09:

- first public release
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ CFLAGS+=-fsanitize=address
LDFLAGS+=-fsanitize=address
endif
ifdef CONFIG_WIN32
LDEXPORT=-export-dynamic
LDEXPORT=
else
LDEXPORT=-rdynamic
endif
Expand Down Expand Up @@ -226,7 +226,7 @@ qjscalc.c: qjsbnc qjscalc.js
./qjsbnc -c -o $@ qjscalc.js

ifneq ($(wildcard unicode/UnicodeData.txt),)
$(OBJDIR)/libunicode.o $(OBJDIR)/libunicode.m32.o $(OBJDIR)/libunicode.m32s.o $(OBJDIR)/libunicode.bn.o \
$(OBJDIR)/libunicode.o $(OBJDIR)/libunicode.m32.o $(OBJDIR)/libunicode.m32s.o $(OBJDIR)/libunicode.bn.o $(OBJDIR)/libunicode.bn.m32.o \
$(OBJDIR)/libunicode.nolto.o $(OBJDIR)/libunicode.bn.nolto.o: libunicode-table.h

libunicode-table.h: unicode_gen
Expand Down Expand Up @@ -289,7 +289,7 @@ regexp_test: libregexp.c libunicode.c cutils.c
jscompress: jscompress.c
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ jscompress.c

unicode_gen: unicode_gen.c cutils.c libunicode.c
unicode_gen: unicode_gen.c cutils.c libunicode.c unicode_gen_def.h
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ unicode_gen.c cutils.c

clean:
Expand Down Expand Up @@ -318,7 +318,8 @@ endif
# example of static JS compilation
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-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \
-fno-date

hello.c: qjsc $(HELLO_SRCS)
./qjsc -e $(HELLO_OPTS) -o $@ $(HELLO_SRCS)
Expand All @@ -334,7 +335,8 @@ endif
# example of static JS compilation with modules
HELLO_MODULE_SRCS=examples/hello_module.js
HELLO_MODULE_OPTS=-fno-string-normalize -fno-map -fno-promise -fno-typedarray \
-fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy -m
-fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \
-fno-date -m
examples/hello_module: qjsc libquickjs$(LTOEXT).a $(HELLO_MODULE_SRCS)
./qjsc $(HELLO_MODULE_OPTS) -o $@ $(HELLO_MODULE_SRCS)

Expand Down Expand Up @@ -362,9 +364,12 @@ clean_doc:
doc/%.pdf: doc/%.texi
texi2pdf --clean -o $@ -q $<

doc/%.html: doc/%.texi
doc/%.html.pre: doc/%.texi
makeinfo --html --no-headers --no-split --number-sections -o $@ $<

doc/%.html: doc/%.html.pre
sed -e 's|</style>|</style>\n<meta name="viewport" content="width=device-width, initial-scale=1.0">|' < $< > $@

###############################################################################
# tests

Expand Down
12 changes: 6 additions & 6 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- fix regexp skip in js_parse_skip_parens_token()
- 64-bit atoms in 64-bit mode?
- rename CONFIG_ALL_UNICODE, CONFIG_BIGNUM, CONFIG_ATOMICS, CONFIG_CHECK_JSVALUE ?
- unify coding style and naming conventions
Expand All @@ -11,7 +12,6 @@
and use the same wrappers in all phases
- use more generic method for line numbers in resolve_variables and resolve_labels
- bignum:
- fix div/pow div by zero exception in doc & code in bigint mode
- fix Atomics support

Memory:
Expand Down Expand Up @@ -48,7 +48,7 @@ Optimizations:
- optimize destructuring assignments for global and local variables
- implement some form of tail-call-optimization
- debugger keyword support
- optmize OP_apply
- optimize OP_apply
- optimize f(...b)

Extensions:
Expand Down Expand Up @@ -77,7 +77,7 @@ REPL:
- save history
- close all predefined methods in repl.js and jscalc.js

Test262o: 0/11266 errors, 459 excluded
Test262: 0/55855 errors, 504 excluded, 1559 skipped
Test262bn: 0/57176 errors, 724 excluded, 675 skipped
test262 commit: 94b1e80ab3440413df916cd56d29c5a2fa2ac451
Test262o: 0/11262 errors, 463 excluded
Test262: 51/56682 errors, 787 excluded, 6289 skipped
Test262bn: 56/58017 errors, 1007 excluded, 5398 skipped
test262 commit: 51d1abadce1de0b38594b7c9972ee60762f35dd0
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2019-07-09
2019-07-21
46 changes: 16 additions & 30 deletions doc/jsbignum.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified doc/jsbignum.pdf
Binary file not shown.
41 changes: 14 additions & 27 deletions doc/jsbignum.texi
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,12 @@ The operator is looked up with the following name:
@item /
@code{Symbol.operatorDiv}

@item / (math mode)
@code{Symbol.operatorMathDiv}

@item %
@code{Symbol.operatorMod}

@item % (math mode)
@code{Symbol.operatorMathMod}

@item ^ (math mode)
@code{Symbol.operatorMathPow}

@item **
@code{Symbol.operatorPow}

Expand Down Expand Up @@ -266,29 +260,24 @@ The @code{+} operator also accepts strings as input and behaves like
standard Javascript in this case.

The binary operator @code{%} returns the truncated remainder of the
division.
division. When the result is an Integer type, a dividend of zero yields a
RangeError exception.

The binary operator @code{%} in math mode returns the Euclidian
remainder of the division i.e. it is always positive.

The binary operator @code{/} returns a float.

The binary operator @code{/} in math mode returns a float if one of
the operands is float. Otherwise, @code{BigInt[Symbol.operatorMathDiv]} is
invoked (and returns a fraction for example).

When the result is an Integer type, a dividend of zero yields a
RangeError exception.
the operands is float. Otherwise, @code{BigInt[Symbol.operatorDiv]} is
invoked.

The returned type of @code{a ** b} or @code{a ^ b} (math mode) is
Float if @math{a} or @math{b} are Float. If @math{a} and @math{b} are
integers:
The returned type of @code{a ** b} is Float if @math{a} or @math{b}
are Float. If @math{a} and @math{b} are integers:
@itemize
@item @math{a = 0} and @math{b < 0} generates a RangeError exception
@item @math{b < 0} returns a Float in bigint mode. In math mode, @code{BigInt[Symbol.operatorPow]} is invoked.

@item @math{|a| \geq 2} and @math{b < 0} returns a Float in bigint mode. In math mode, @code{BigInt[Symbol.operatorMathPow]} is invoked (and returns a fraction for example)

@item otherwise an integer is returned.
@item @math{b >= 0} returns an integer.
@end itemize

The unary @code{-} and unary @code{+} return the same type as their
Expand Down Expand Up @@ -798,21 +787,23 @@ is returned, no rounding is performed.
A new @emph{math mode} is enabled with the @code{"use math"}
directive. @code{"use bigint"} is implied in math mode. With this
mode, writing mathematical expressions is more intuitive, exact
results (fractions) can be computed for all operators and floating
results (e.g. fractions) can be computed for all operators and floating
point literals have the @code{BigFloat} type by default.

It propagates the same way as the @emph{strict mode}. In
this mode:

@itemize

@item The @code{^} operator is a similar to the power operator (@code{**}), except that @code{a ^ b} invokes @code{BigInt[Symbol.operatorMathPow]} if @math{a} and @math{b} are integers and @math{|a| \geq 2} and @math{b < 0}.
@item The @code{^} operator is a similar to the power operator (@code{**}).

@item The power operator (both @code{^} and @code{**}) grammar is modified so that @code{-2^2} is allowed and yields @code{-4}.

@item The logical xor operator is still available with the @code{^^} operator.

@item The division operator invokes @code{BigInt[Symbol.operatorMathDiv]} in case both operands are integers.
@item The division operator invokes @code{BigInt[Symbol.operatorDiv]} in case both operands are integers.

@item The power operator invokes @code{BigInt[Symbol.operatorPow]} in case both operands are integers and the exponent is strictly negative.

@item The modulo operator returns the Euclidian remainder (always positive) instead of the truncated remainder.

Expand All @@ -824,19 +815,15 @@ this mode:

@subsection @code{Symbol} constructor

The following global symbols are added for the operator overloading:
The following global symbol is added for the operator overloading:
@table @code
@item operatorMathDiv
@item operatorMathMod
@item operatorMathPow
@end table

@section Remaining issues

@enumerate

@item New functions (e.g. @code{Math.div} and @code{Math.mod}) could be added to be able to call the normal division and modulo operators when in math mode.

@item A new floating point literal suffix could be added for @code{Number} literals.

@end enumerate
Expand Down
13 changes: 7 additions & 6 deletions doc/quickjs.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified doc/quickjs.pdf
Binary file not shown.
Loading

0 comments on commit a556e1d

Please sign in to comment.