Skip to content

Commit a556e1d

Browse files
author
llgoer
committed
更新到2019-07-21版本
1 parent 257524f commit a556e1d

32 files changed

+2772
-3133
lines changed

Changelog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2019-07-21:
2+
3+
- updated test262 tests
4+
- updated to Unicode version 12.1.0
5+
- fixed missing Date object in qjsc
6+
- fixed multi-context creation
7+
- misc ES2020 related fixes
8+
- simplified power and division operators in bignum extension
9+
- fixed several crash conditions
10+
11+
2019-07-09:
12+
13+
- first public release

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ CFLAGS+=-fsanitize=address
113113
LDFLAGS+=-fsanitize=address
114114
endif
115115
ifdef CONFIG_WIN32
116-
LDEXPORT=-export-dynamic
116+
LDEXPORT=
117117
else
118118
LDEXPORT=-rdynamic
119119
endif
@@ -226,7 +226,7 @@ qjscalc.c: qjsbnc qjscalc.js
226226
./qjsbnc -c -o $@ qjscalc.js
227227

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

232232
libunicode-table.h: unicode_gen
@@ -289,7 +289,7 @@ regexp_test: libregexp.c libunicode.c cutils.c
289289
jscompress: jscompress.c
290290
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ jscompress.c
291291

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

295295
clean:
@@ -318,7 +318,8 @@ endif
318318
# example of static JS compilation
319319
HELLO_SRCS=examples/hello.js
320320
HELLO_OPTS=-fno-string-normalize -fno-map -fno-promise -fno-typedarray \
321-
-fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy
321+
-fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \
322+
-fno-date
322323

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

@@ -362,9 +364,12 @@ clean_doc:
362364
doc/%.pdf: doc/%.texi
363365
texi2pdf --clean -o $@ -q $<
364366

365-
doc/%.html: doc/%.texi
367+
doc/%.html.pre: doc/%.texi
366368
makeinfo --html --no-headers --no-split --number-sections -o $@ $<
367369

370+
doc/%.html: doc/%.html.pre
371+
sed -e 's|</style>|</style>\n<meta name="viewport" content="width=device-width, initial-scale=1.0">|' < $< > $@
372+
368373
###############################################################################
369374
# tests
370375

TODO

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- fix regexp skip in js_parse_skip_parens_token()
12
- 64-bit atoms in 64-bit mode?
23
- rename CONFIG_ALL_UNICODE, CONFIG_BIGNUM, CONFIG_ATOMICS, CONFIG_CHECK_JSVALUE ?
34
- unify coding style and naming conventions
@@ -11,7 +12,6 @@
1112
and use the same wrappers in all phases
1213
- use more generic method for line numbers in resolve_variables and resolve_labels
1314
- bignum:
14-
- fix div/pow div by zero exception in doc & code in bigint mode
1515
- fix Atomics support
1616

1717
Memory:
@@ -48,7 +48,7 @@ Optimizations:
4848
- optimize destructuring assignments for global and local variables
4949
- implement some form of tail-call-optimization
5050
- debugger keyword support
51-
- optmize OP_apply
51+
- optimize OP_apply
5252
- optimize f(...b)
5353

5454
Extensions:
@@ -77,7 +77,7 @@ REPL:
7777
- save history
7878
- close all predefined methods in repl.js and jscalc.js
7979

80-
Test262o: 0/11266 errors, 459 excluded
81-
Test262: 0/55855 errors, 504 excluded, 1559 skipped
82-
Test262bn: 0/57176 errors, 724 excluded, 675 skipped
83-
test262 commit: 94b1e80ab3440413df916cd56d29c5a2fa2ac451
80+
Test262o: 0/11262 errors, 463 excluded
81+
Test262: 51/56682 errors, 787 excluded, 6289 skipped
82+
Test262bn: 56/58017 errors, 1007 excluded, 5398 skipped
83+
test262 commit: 51d1abadce1de0b38594b7c9972ee60762f35dd0

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2019-07-09
1+
2019-07-21

doc/jsbignum.html

Lines changed: 16 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/jsbignum.pdf

-563 Bytes
Binary file not shown.

doc/jsbignum.texi

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,12 @@ The operator is looked up with the following name:
102102
@item /
103103
@code{Symbol.operatorDiv}
104104

105-
@item / (math mode)
106-
@code{Symbol.operatorMathDiv}
107-
108105
@item %
109106
@code{Symbol.operatorMod}
110107

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

114-
@item ^ (math mode)
115-
@code{Symbol.operatorMathPow}
116-
117111
@item **
118112
@code{Symbol.operatorPow}
119113

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

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

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

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

276271
The binary operator @code{/} in math mode returns a float if one of
277-
the operands is float. Otherwise, @code{BigInt[Symbol.operatorMathDiv]} is
278-
invoked (and returns a fraction for example).
279-
280-
When the result is an Integer type, a dividend of zero yields a
281-
RangeError exception.
272+
the operands is float. Otherwise, @code{BigInt[Symbol.operatorDiv]} is
273+
invoked.
282274

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

289-
@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)
290-
291-
@item otherwise an integer is returned.
280+
@item @math{b >= 0} returns an integer.
292281
@end itemize
293282

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

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

807796
@itemize
808797

809-
@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}.
798+
@item The @code{^} operator is a similar to the power operator (@code{**}).
810799

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

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

815-
@item The division operator invokes @code{BigInt[Symbol.operatorMathDiv]} in case both operands are integers.
804+
@item The division operator invokes @code{BigInt[Symbol.operatorDiv]} in case both operands are integers.
805+
806+
@item The power operator invokes @code{BigInt[Symbol.operatorPow]} in case both operands are integers and the exponent is strictly negative.
816807

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

@@ -824,19 +815,15 @@ this mode:
824815

825816
@subsection @code{Symbol} constructor
826817

827-
The following global symbols are added for the operator overloading:
818+
The following global symbol is added for the operator overloading:
828819
@table @code
829-
@item operatorMathDiv
830820
@item operatorMathMod
831-
@item operatorMathPow
832821
@end table
833822

834823
@section Remaining issues
835824

836825
@enumerate
837826

838-
@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.
839-
840827
@item A new floating point literal suffix could be added for @code{Number} literals.
841828

842829
@end enumerate

doc/quickjs.html

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/quickjs.pdf

143 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)