Skip to content

Commit 7c312df

Browse files
committed
2020-09-06 release
1 parent 8900766 commit 7c312df

26 files changed

+898
-462
lines changed

Changelog

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2020-09-06:
2+
3+
- added logical assignment operators
4+
- added IsHTMLDDA support
5+
- faster for-of loops
6+
- os.Worker now takes a module filename as parameter
7+
- qjsc: added -D option to compile dynamically loaded modules or workers
8+
- misc bug fixes
9+
110
2020-07-05:
211

312
- modified JS_GetPrototype() to return a live value

TODO

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ REPL:
7474
Test262o: 0/11262 errors, 463 excluded
7575
Test262o commit: 7da91bceb9ce7613f87db47ddd1292a2dda58b42 (es5-tests branch)
7676

77-
Test262: 30/71095 errors, 870 excluded, 549 skipped
78-
Test262 commit: 281eb10b2844929a7c0ac04527f5b42ce56509fd
77+
Test262: 30/71748 errors, 868 excluded, 474 skipped
78+
Test262 commit: 24c67328062383079ada85f4d253eb0526fd209b

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2020-07-05
1+
2020-09-06

cutils.c

+16-5
Original file line numberDiff line numberDiff line change
@@ -258,19 +258,30 @@ int unicode_from_utf8(const uint8_t *p, int max_len, const uint8_t **pp)
258258
return c;
259259
}
260260
switch(c) {
261-
case 0xc0 ... 0xdf:
261+
case 0xc0: case 0xc1: case 0xc2: case 0xc3:
262+
case 0xc4: case 0xc5: case 0xc6: case 0xc7:
263+
case 0xc8: case 0xc9: case 0xca: case 0xcb:
264+
case 0xcc: case 0xcd: case 0xce: case 0xcf:
265+
case 0xd0: case 0xd1: case 0xd2: case 0xd3:
266+
case 0xd4: case 0xd5: case 0xd6: case 0xd7:
267+
case 0xd8: case 0xd9: case 0xda: case 0xdb:
268+
case 0xdc: case 0xdd: case 0xde: case 0xdf:
262269
l = 1;
263270
break;
264-
case 0xe0 ... 0xef:
271+
case 0xe0: case 0xe1: case 0xe2: case 0xe3:
272+
case 0xe4: case 0xe5: case 0xe6: case 0xe7:
273+
case 0xe8: case 0xe9: case 0xea: case 0xeb:
274+
case 0xec: case 0xed: case 0xee: case 0xef:
265275
l = 2;
266276
break;
267-
case 0xf0 ... 0xf7:
277+
case 0xf0: case 0xf1: case 0xf2: case 0xf3:
278+
case 0xf4: case 0xf5: case 0xf6: case 0xf7:
268279
l = 3;
269280
break;
270-
case 0xf8 ... 0xfb:
281+
case 0xf8: case 0xf9: case 0xfa: case 0xfb:
271282
l = 4;
272283
break;
273-
case 0xfc ... 0xfd:
284+
case 0xfc: case 0xfd:
274285
l = 5;
275286
break;
276287
default:

doc/jsbignum.html

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/jsbignum.pdf

8 Bytes
Binary file not shown.

doc/quickjs.html

+18-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/quickjs.pdf

243 Bytes
Binary file not shown.

doc/quickjs.texi

+15-8
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Load as ES6 script (default=autodetect).
120120

121121
@item --bignum
122122
Enable the bignum extensions: BigDecimal object, BigFloat object and
123-
the @code{"use bigint"} and @code{"use math"} directives.
123+
the @code{"use math"} directive.
124124

125125
@item -I file
126126
@item --include file
@@ -167,6 +167,12 @@ Set the C name of the generated data.
167167
@item -m
168168
Compile as Javascript module (default=autodetect).
169169

170+
@item -D module_name
171+
Compile a dynamically loaded module and its dependencies. This option
172+
is needed when your code uses the @code{import} keyword or the
173+
@code{os.Worker} constructor because the compiler cannot statically
174+
find the name of the dynamically loaded modules.
175+
170176
@item -M module_name[,cname]
171177
Add initialization code for an external C module. See the
172178
@code{c_module} example.
@@ -184,7 +190,7 @@ Disable selected language features to produce a smaller executable file.
184190

185191
@item -fbignum
186192
Enable the bignum extensions: BigDecimal object, BigFloat object and
187-
the @code{"use bigint"} and @code{"use math"} directives.
193+
the @code{"use math"} directive.
188194

189195
@end table
190196

@@ -764,13 +770,14 @@ Cancel a timer.
764770
Return a string representing the platform: @code{"linux"}, @code{"darwin"},
765771
@code{"win32"} or @code{"js"}.
766772

767-
@item Worker(source)
773+
@item Worker(module_filename)
768774
Constructor to create a new thread (worker) with an API close to the
769-
@code{WebWorkers}. @code{source} is a string containing the module
770-
source which is executed in the newly created thread. Threads normally
771-
don't share any data and communicate between each other with
772-
messages. Nested workers are not supported. An example is available in
773-
@file{tests/test_worker.js}.
775+
@code{WebWorkers}. @code{module_filename} is a string specifying the
776+
module filename which is executed in the newly created thread. As for
777+
dynamically imported module, it is relative to the current script or
778+
module path. Threads normally don't share any data and communicate
779+
between each other with messages. Nested workers are not supported. An
780+
example is available in @file{tests/test_worker.js}.
774781

775782
The worker class has the following static properties:
776783

libregexp.c

+17-3
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,8 @@ int lre_parse_escape(const uint8_t **pp, int allow_utf16)
569569
}
570570
}
571571
break;
572-
case '0' ... '7':
572+
case '0': case '1': case '2': case '3':
573+
case '4': case '5': case '6': case '7':
573574
c -= '0';
574575
if (allow_utf16 == 2) {
575576
/* only accept \0 not followed by digit */
@@ -1410,7 +1411,9 @@ static int re_parse_term(REParseState *s, BOOL is_backward_dir)
14101411
}
14111412
}
14121413
goto normal_char;
1413-
case '1' ... '9':
1414+
case '1': case '2': case '3': case '4':
1415+
case '5': case '6': case '7': case '8':
1416+
case '9':
14141417
{
14151418
const uint8_t *q = ++p;
14161419

@@ -1434,7 +1437,7 @@ static int re_parse_term(REParseState *s, BOOL is_backward_dir)
14341437
}
14351438
goto normal_char;
14361439
}
1437-
return re_parse_error(s, "back reference out of range in reguar expression");
1440+
return re_parse_error(s, "back reference out of range in regular expression");
14381441
}
14391442
emit_back_reference:
14401443
last_atom_start = s->byte_code.size;
@@ -2533,6 +2536,17 @@ int lre_get_flags(const uint8_t *bc_buf)
25332536
return bc_buf[RE_HEADER_FLAGS];
25342537
}
25352538

2539+
/* Return NULL if no group names. Otherwise, return a pointer to
2540+
'capture_count - 1' zero terminated UTF-8 strings. */
2541+
const char *lre_get_groupnames(const uint8_t *bc_buf)
2542+
{
2543+
uint32_t re_bytecode_len;
2544+
if ((lre_get_flags(bc_buf) & LRE_FLAG_NAMED_GROUPS) == 0)
2545+
return NULL;
2546+
re_bytecode_len = get_u32(bc_buf + 3);
2547+
return (const char *)(bc_buf + 7 + re_bytecode_len);
2548+
}
2549+
25362550
#ifdef TEST
25372551

25382552
BOOL lre_check_stack_overflow(void *opaque, size_t alloca_size)

libregexp.h

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ uint8_t *lre_compile(int *plen, char *error_msg, int error_msg_size,
4444
void *opaque);
4545
int lre_get_capture_count(const uint8_t *bc_buf);
4646
int lre_get_flags(const uint8_t *bc_buf);
47+
const char *lre_get_groupnames(const uint8_t *bc_buf);
4748
int lre_exec(uint8_t **capture,
4849
const uint8_t *bc_buf, const uint8_t *cbuf, int cindex, int clen,
4950
int cbuf_type, void *opaque);

libunicode.c

+22-4
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,22 @@ static int unicode_decomp_entry(uint32_t *res, uint32_t c,
527527
} else {
528528
d = unicode_decomp_data + unicode_decomp_table2[idx];
529529
switch(type) {
530-
case DECOMP_TYPE_L1 ... DECOMP_TYPE_L7:
530+
case DECOMP_TYPE_L1:
531+
case DECOMP_TYPE_L2:
532+
case DECOMP_TYPE_L3:
533+
case DECOMP_TYPE_L4:
534+
case DECOMP_TYPE_L5:
535+
case DECOMP_TYPE_L6:
536+
case DECOMP_TYPE_L7:
531537
l = type - DECOMP_TYPE_L1 + 1;
532538
d += (c - code) * l * 2;
533539
for(i = 0; i < l; i++) {
534540
if ((res[i] = unicode_get16(d + 2 * i)) == 0)
535541
return 0;
536542
}
537543
return l;
538-
case DECOMP_TYPE_LL1 ... DECOMP_TYPE_LL2:
544+
case DECOMP_TYPE_LL1:
545+
case DECOMP_TYPE_LL2:
539546
{
540547
uint32_t k, p;
541548
l = type - DECOMP_TYPE_LL1 + 1;
@@ -551,7 +558,11 @@ static int unicode_decomp_entry(uint32_t *res, uint32_t c,
551558
}
552559
}
553560
return l;
554-
case DECOMP_TYPE_S1 ... DECOMP_TYPE_S5:
561+
case DECOMP_TYPE_S1:
562+
case DECOMP_TYPE_S2:
563+
case DECOMP_TYPE_S3:
564+
case DECOMP_TYPE_S4:
565+
case DECOMP_TYPE_S5:
555566
l = type - DECOMP_TYPE_S1 + 1;
556567
d += (c - code) * l;
557568
for(i = 0; i < l; i++) {
@@ -582,7 +593,14 @@ static int unicode_decomp_entry(uint32_t *res, uint32_t c,
582593
case DECOMP_TYPE_B18:
583594
l = 18;
584595
goto decomp_type_b;
585-
case DECOMP_TYPE_B1 ... DECOMP_TYPE_B8:
596+
case DECOMP_TYPE_B1:
597+
case DECOMP_TYPE_B2:
598+
case DECOMP_TYPE_B3:
599+
case DECOMP_TYPE_B4:
600+
case DECOMP_TYPE_B5:
601+
case DECOMP_TYPE_B6:
602+
case DECOMP_TYPE_B7:
603+
case DECOMP_TYPE_B8:
586604
l = type - DECOMP_TYPE_B1 + 1;
587605
decomp_type_b:
588606
{

0 commit comments

Comments
 (0)