aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-10-05 18:05:10 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-10-05 18:07:41 -0700
commit1777e9d0b1805ef79b6c2499e3d065b7164dae29 (patch)
tree94a7b21a2e4287ec5fb934daeeadfb12396e386b
parent707b454bf480dc595d319a387b36f5f1e069b716 (diff)
downloadbun-1777e9d0b1805ef79b6c2499e3d065b7164dae29.tar.gz
bun-1777e9d0b1805ef79b6c2499e3d065b7164dae29.tar.zst
bun-1777e9d0b1805ef79b6c2499e3d065b7164dae29.zip
Add abstraction for ticking async event loop
-rw-r--r--src/bun.js/bindings/headers-cpp.h2
-rw-r--r--src/bun.js/bindings/headers.h3
-rw-r--r--src/bun.js/bindings/headers.zig1
-rw-r--r--src/bun_js.zig5
-rw-r--r--src/cli/test_command.zig3
5 files changed, 7 insertions, 7 deletions
diff --git a/src/bun.js/bindings/headers-cpp.h b/src/bun.js/bindings/headers-cpp.h
index 617b1b63b..e0073666e 100644
--- a/src/bun.js/bindings/headers-cpp.h
+++ b/src/bun.js/bindings/headers-cpp.h
@@ -1,4 +1,4 @@
-//-- AUTOGENERATED FILE -- 1664608671
+//-- AUTOGENERATED FILE -- 1665017239
// clang-format off
#pragma once
diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h
index b42daca48..fdcd1878b 100644
--- a/src/bun.js/bindings/headers.h
+++ b/src/bun.js/bindings/headers.h
@@ -1,5 +1,5 @@
// clang-format off
-//-- AUTOGENERATED FILE -- 1664608671
+//-- AUTOGENERATED FILE -- 1665017239
#pragma once
#include <stddef.h>
@@ -378,6 +378,7 @@ CPP_DECL void JSC__SourceCode__fromString(JSC__SourceCode* arg0, const WTF__Stri
CPP_DECL bWTF__String JSC__JSFunction__calculatedDisplayName(JSC__JSFunction* arg0, JSC__VM* arg1);
CPP_DECL bWTF__String JSC__JSFunction__displayName(JSC__JSFunction* arg0, JSC__VM* arg1);
CPP_DECL bWTF__String JSC__JSFunction__getName(JSC__JSFunction* arg0, JSC__VM* arg1);
+CPP_DECL void JSC__JSFunction__optimizeSoon(JSC__JSValue JSValue0);
#pragma mark - JSC::JSGlobalObject
diff --git a/src/bun.js/bindings/headers.zig b/src/bun.js/bindings/headers.zig
index 24d188720..7b7c2f567 100644
--- a/src/bun.js/bindings/headers.zig
+++ b/src/bun.js/bindings/headers.zig
@@ -184,6 +184,7 @@ pub extern fn JSC__SourceCode__fromString(arg0: [*c]JSC__SourceCode, arg1: [*c]c
pub extern fn JSC__JSFunction__calculatedDisplayName(arg0: [*c]JSC__JSFunction, arg1: [*c]JSC__VM) bWTF__String;
pub extern fn JSC__JSFunction__displayName(arg0: [*c]JSC__JSFunction, arg1: [*c]JSC__VM) bWTF__String;
pub extern fn JSC__JSFunction__getName(arg0: [*c]JSC__JSFunction, arg1: [*c]JSC__VM) bWTF__String;
+pub extern fn JSC__JSFunction__optimizeSoon(JSValue0: JSC__JSValue) void;
pub extern fn JSC__JSGlobalObject__arrayIteratorPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.ArrayIteratorPrototype;
pub extern fn JSC__JSGlobalObject__arrayPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.ArrayPrototype;
pub extern fn JSC__JSGlobalObject__asyncFunctionPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.AsyncFunctionPrototype;
diff --git a/src/bun_js.zig b/src/bun_js.zig
index eda807188..65a172b52 100644
--- a/src/bun_js.zig
+++ b/src/bun_js.zig
@@ -148,10 +148,7 @@ pub const Run = struct {
{
while (this.vm.eventLoop().tasks.count > 0 or this.vm.active_tasks > 0 or this.vm.uws_event_loop.?.active > 0) {
this.vm.tick();
-
- if (this.vm.uws_event_loop.?.num_polls > 0 or this.vm.uws_event_loop.?.active > 0) {
- this.vm.uws_event_loop.?.tick();
- }
+ this.vm.eventLoop().autoTick();
}
if (this.vm.log.msgs.items.len > 0) {
diff --git a/src/cli/test_command.zig b/src/cli/test_command.zig
index 7b564d908..d85c74d3f 100644
--- a/src/cli/test_command.zig
+++ b/src/cli/test_command.zig
@@ -135,6 +135,7 @@ pub const CommandLineReporter = struct {
this.summary.pass += 1;
this.summary.expectations += expectations;
}
+
pub fn handleTestFail(cb: *TestRunner.Callback, id: Test.ID, _: string, label: string, expectations: u32, parent: ?*Jest.DescribeScope) void {
var writer_: std.fs.File.Writer = Output.errorWriter();
var this: *CommandLineReporter = @fieldParentPtr(CommandLineReporter, "callback", cb);
@@ -481,7 +482,7 @@ pub const TestCommand = struct {
while (Jest.Jest.runner.?.has_pending_tests) : (vm.eventLoop().tick()) {
vm.eventLoop().tick();
if (!Jest.Jest.runner.?.has_pending_tests) break;
- vm.uws_event_loop.?.tick();
+ vm.eventLoop().autoTick();
}
}
_ = vm.global.vm().runGC(false);