Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -43839,6 +43839,8 @@ static JSValue js_array_includes(JSContext *ctx, JSValueConst this_val,
}
if (js_get_fast_array(ctx, obj, &arrp, &count)) {
for (; n < count; n++) {
if (js_poll_interrupts(ctx))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (js_poll_interrupts(ctx))
if (n % 2048 == 0 && js_poll_interrupts(ctx))

goto exception;
if (js_strict_eq2(ctx, argv[0], arrp[n],
JS_EQ_SAME_VALUE_ZERO)) {
goto done;
Expand Down Expand Up @@ -43888,6 +43890,8 @@ static JSValue js_array_indexOf(JSContext *ctx, JSValueConst this_val,
}
if (js_get_fast_array(ctx, obj, &arrp, &count)) {
for (; n < count; n++) {
if (js_poll_interrupts(ctx))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (js_poll_interrupts(ctx))
if (n % 2048 == 0 && js_poll_interrupts(ctx))

goto exception;
if (js_strict_eq2(ctx, argv[0], arrp[n], JS_EQ_STRICT)) {
goto done;
}
Expand Down Expand Up @@ -43939,6 +43943,8 @@ static JSValue js_array_lastIndexOf(JSContext *ctx, JSValueConst this_val,
}
if (js_get_fast_array(ctx, obj, &arrp, &count) && count == len) {
for (; n >= 0; n--) {
if (js_poll_interrupts(ctx))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (js_poll_interrupts(ctx))
if (n % 2048 == 0 && js_poll_interrupts(ctx))

goto exception;
if (js_strict_eq2(ctx, argv[0], arrp[n],
JS_EQ_STRICT)) {
goto done;
Expand Down
8 changes: 8 additions & 0 deletions tests/bug1672/Array.prototype.includes-fast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*---
flags: [qjs:set-interrupt-handler]
negative:
phase: runtime
type: InternalError
---*/
const a = new Array(1e5).fill(0)
for (;;) a.includes(42)
8 changes: 8 additions & 0 deletions tests/bug1672/Array.prototype.indexOf-fast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*---
flags: [qjs:set-interrupt-handler]
negative:
phase: runtime
type: InternalError
---*/
const a = new Array(1e5).fill(0)
for (;;) a.indexOf(42)
8 changes: 8 additions & 0 deletions tests/bug1672/Array.prototype.lastIndexOf-fast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*---
flags: [qjs:set-interrupt-handler]
negative:
phase: runtime
type: InternalError
---*/
const a = new Array(1e5).fill(0)
for (;;) a.lastIndexOf(42)
Loading