Skip to content

Commit d512917

Browse files
committed
QuickJS: regex/string optimizations & workers uaf fix
* Optimize String replace, args object creation, regex exec: bellard/quickjs@9f11034 * Optimize regex backgracking bellard/quickjs@7ab2341 * Fix use-after-free error in worker cleanup (we don't use this): bellard/quickjs@728ed94
1 parent 64f5c5a commit d512917

7 files changed

Lines changed: 865 additions & 660 deletions

File tree

src/couch_quickjs/patches/01-spidermonkey-185-mode.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
--- quickjs-master/quickjs.c 2025-11-15 08:52:50
2-
+++ quickjs/quickjs.c 2025-11-17 17:35:22
3-
@@ -31337,10 +31337,24 @@
1+
--- quickjs-master/quickjs.c 2025-11-22 06:10:55.000000000 -0500
2+
+++ quickjs/quickjs.c 2025-11-22 12:45:37.890107480 -0500
3+
@@ -31420,10 +31420,24 @@
44
if (s->token.val == TOK_FUNCTION ||
55
(token_is_pseudo_keyword(s, JS_ATOM_async) &&
66
peek_token(s, TRUE) == TOK_FUNCTION)) {

src/couch_quickjs/patches/02-test262-errors.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
--- quickjs-master/test262_errors.txt 2025-11-15 08:52:50
2-
+++ quickjs/test262_errors.txt 2025-11-17 17:35:22
1+
--- quickjs-master/test262_errors.txt 2025-11-22 06:10:55.000000000 -0500
2+
+++ quickjs/test262_errors.txt 2025-11-22 12:45:37.894107458 -0500
33
@@ -19,6 +19,8 @@
44
test262/test/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js:24: Test262Error: #1: innerX === 2. Actual: 5
55
test262/test/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js:24: Test262Error: #1: innerX === 2. Actual: 5

src/couch_quickjs/quickjs/Changelog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- micro optimizations (15% faster on bench-v8)
1+
- micro optimizations (30% faster on bench-v8)
22
- added resizable array buffers
33
- added ArrayBuffer.prototype.transfer
44
- added the Iterator object and methods

src/couch_quickjs/quickjs/libregexp-opcode.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ DEF(goto, 5)
3939
DEF(split_goto_first, 5)
4040
DEF(split_next_first, 5)
4141
DEF(match, 1)
42+
DEF(lookahead_match, 1)
43+
DEF(negative_lookahead_match, 1) /* must come after */
4244
DEF(save_start, 2) /* save start position */
4345
DEF(save_end, 2) /* save end position, must come after saved_start */
4446
DEF(save_reset, 3) /* reset save positions */
45-
DEF(loop, 5) /* decrement the top the stack and goto if != 0 */
46-
DEF(push_i32, 5) /* push integer on the stack */
47-
DEF(drop, 1)
47+
DEF(loop, 6) /* decrement the top the stack and goto if != 0 */
48+
DEF(push_i32, 6) /* push integer on the stack */
4849
DEF(word_boundary, 1)
4950
DEF(word_boundary_i, 1)
5051
DEF(not_word_boundary, 1)
@@ -58,10 +59,9 @@ DEF(range_i, 3) /* variable length */
5859
DEF(range32, 3) /* variable length */
5960
DEF(range32_i, 3) /* variable length */
6061
DEF(lookahead, 5)
61-
DEF(negative_lookahead, 5)
62-
DEF(push_char_pos, 1) /* push the character position on the stack */
63-
DEF(check_advance, 1) /* pop one stack element and check that it is different from the character position */
62+
DEF(negative_lookahead, 5) /* must come after */
63+
DEF(push_char_pos, 2) /* push the character position on the stack */
64+
DEF(check_advance, 2) /* pop one stack element and check that it is different from the character position */
6465
DEF(prev, 1) /* go to the previous char */
65-
DEF(simple_greedy_quant, 17)
6666

6767
#endif /* DEF */

0 commit comments

Comments
 (0)