aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-04 03:47:56 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-04 03:47:56 -0700
commit0a0d3ba8505d057251a6059da4252abb4f699fb1 (patch)
treefeb44e5385e092af647fbbd8d9a7959a5ede2a00
parent1d8431a92cbb17a0c744743ce99430d5e6cde014 (diff)
downloadbun-jarred/profiled-call.tar.gz
bun-jarred/profiled-call.tar.zst
bun-jarred/profiled-call.zip
Use profiled calljarred/profiled-call
-rw-r--r--src/bun.js/bindings/BunJSCModule.cpp127
-rw-r--r--src/bun.js/bindings/JSBundlerPlugin.cpp2
-rw-r--r--src/bun.js/bindings/JSSink.cpp26
-rw-r--r--src/bun.js/bindings/JSSink.h2
-rw-r--r--src/bun.js/bindings/JSSinkLookupTable.h2
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp10
-rw-r--r--src/bun.js/bindings/bindings.cpp6
-rw-r--r--src/bun.js/bindings/napi.cpp2
-rw-r--r--src/bun.js/bindings/webcore/EventEmitter.cpp2
-rw-r--r--src/bun.js/scripts/generate-jssink.js6
10 files changed, 142 insertions, 43 deletions
diff --git a/src/bun.js/bindings/BunJSCModule.cpp b/src/bun.js/bindings/BunJSCModule.cpp
index 5809a9813..5d8eacb57 100644
--- a/src/bun.js/bindings/BunJSCModule.cpp
+++ b/src/bun.js/bindings/BunJSCModule.cpp
@@ -1,4 +1,5 @@
#include "root.h"
+#include "headers-handwritten.h"
#include "JavaScriptCore/JavaScript.h"
#include "wtf/FileSystem.h"
@@ -24,8 +25,11 @@
#include "JavaScriptCore/DeferTermination.h"
#include "JavaScriptCore/SamplingProfiler.h"
#include "JavaScriptCore/VMTrapsInlines.h"
+#include "JavaScriptCore/JSPromise.h"
+#include "JavaScriptCore/InspectorProtocolObjects.h"
#if ENABLE(REMOTE_INSPECTOR)
+#include "JavaScriptCore/InspectorScriptProfilerAgent.h"
#include "JavaScriptCore/RemoteInspectorServer.h"
#endif
@@ -33,6 +37,70 @@
using namespace JSC;
using namespace WTF;
+using namespace Inspector;
+
+static Ref<Protocol::ScriptProfiler::Samples> buildSamples(JSC::JSGlobalObject* glboalObject, VM& vm, Vector<SamplingProfiler::StackTrace>&& samplingProfilerStackTraces)
+{
+ auto stackTraces = JSON::ArrayOf<Protocol::ScriptProfiler::StackTrace>::create();
+ for (SamplingProfiler::StackTrace& stackTrace : samplingProfilerStackTraces) {
+ auto frames = JSON::ArrayOf<Protocol::ScriptProfiler::StackFrame>::create();
+ for (SamplingProfiler::StackFrame& stackFrame : stackTrace.frames) {
+ if (!JSC::Options::showPrivateScriptsInStackTraces()) {
+ if (stackFrame.frameType == SamplingProfiler::FrameType::Executable) {
+ if (stackFrame.executable->implementationVisibility() != ImplementationVisibility::Public) {
+ // Skip internal frames.
+ continue;
+ }
+ }
+ }
+
+ ZigStackFrame remappedFrame[2];
+
+ remappedFrame[0].position.line = stackFrame.functionStartLine();
+ remappedFrame[0].position.column_start = stackFrame.functionStartColumn();
+
+ if (stackFrame.hasExpressionInfo()) {
+ remappedFrame[1].position.line = stackFrame.lineNumber();
+ remappedFrame[1].position.column_start = stackFrame.columnNumber();
+ }
+
+ if (!stackFrame.url().isEmpty()) {
+ remappedFrame[0].source_url = Bun::toString(stackFrame.url());
+ if (stackFrame.hasExpressionInfo())
+ remappedFrame[1].source_url = Bun::toString(stackFrame.url());
+ }
+
+ Bun__remapStackFramePositions(glboalObject, remappedFrame, 1 + stackFrame.hasExpressionInfo());
+
+ auto frameObject = Protocol::ScriptProfiler::StackFrame::create()
+ .setSourceID(String::number(stackFrame.sourceID()))
+ .setName(stackFrame.displayName(vm))
+ .setLine(remappedFrame[0].position.line)
+ .setColumn(remappedFrame[0].position.column_start)
+ .setUrl(stackFrame.url())
+ .release();
+
+ if (stackFrame.hasExpressionInfo()) {
+ Ref<Protocol::ScriptProfiler::ExpressionLocation> expressionLocation = Protocol::ScriptProfiler::ExpressionLocation::create()
+ .setLine(remappedFrame[1].position.line)
+ .setColumn(remappedFrame[1].position.column_start)
+ .release();
+ frameObject->setExpressionLocation(WTFMove(expressionLocation));
+ }
+
+ frames->addItem(WTFMove(frameObject));
+ }
+ Ref<Protocol::ScriptProfiler::StackTrace> inspectorStackTrace = Protocol::ScriptProfiler::StackTrace::create()
+ .setTimestamp(stackTrace.timestamp.seconds())
+ .setStackFrames(WTFMove(frames))
+ .release();
+ stackTraces->addItem(WTFMove(inspectorStackTrace));
+ }
+
+ return Protocol::ScriptProfiler::Samples::create()
+ .setStackTraces(WTFMove(stackTraces))
+ .release();
+}
JSC_DECLARE_HOST_FUNCTION(functionStartRemoteDebugger);
JSC_DEFINE_HOST_FUNCTION(functionStartRemoteDebugger, (JSGlobalObject * globalObject, CallFrame* callFrame))
@@ -452,6 +520,37 @@ JSC_DEFINE_HOST_FUNCTION(functionSetTimeZone, (JSGlobalObject * globalObject, Ca
return JSValue::encode(jsString(vm, timeZoneString));
}
+static EncodedJSValue createResultObject(JSGlobalObject* globalObject)
+{
+ auto& vm = globalObject->vm();
+ JSC::SamplingProfiler& samplingProfiler = *vm.samplingProfiler();
+ StringPrintStream topFunctions;
+ samplingProfiler.reportTopFunctions(topFunctions);
+
+ StringPrintStream byteCodes;
+ samplingProfiler.reportTopBytecodes(byteCodes);
+
+ Locker locker { samplingProfiler.getLock() };
+ samplingProfiler.pause();
+ JSValue stackTraces = JSONParse(globalObject, buildSamples(globalObject, vm, samplingProfiler.releaseStackTraces())->toJSONString());
+ locker.unlockEarly();
+
+ samplingProfiler.shutdown();
+ samplingProfiler.clearData();
+
+ JSObject* result = constructEmptyObject(globalObject, globalObject->objectPrototype(), 3);
+ result->putDirect(vm, Identifier::fromString(vm, "functions"_s), jsString(vm, topFunctions.toString()));
+ result->putDirect(vm, Identifier::fromString(vm, "bytecodes"_s), jsString(vm, byteCodes.toString()));
+ result->putDirect(vm, Identifier::fromString(vm, "stackTraces"_s), stackTraces);
+
+ return JSValue::encode(result);
+}
+
+JSC_DEFINE_HOST_FUNCTION(functionFulfillProfilerRequest, (JSGlobalObject * globalObject, CallFrame* callFrame))
+{
+ return createResultObject(globalObject);
+}
+
JSC_DEFINE_HOST_FUNCTION(functionRunProfiler, (JSGlobalObject * globalObject, CallFrame* callFrame))
{
JSC::VM& vm = globalObject->vm();
@@ -477,31 +576,31 @@ JSC_DEFINE_HOST_FUNCTION(functionRunProfiler, (JSGlobalObject * globalObject, Ca
samplingProfiler.noticeCurrentThreadAsJSCExecutionThread();
samplingProfiler.start();
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), args);
- samplingProfiler.pause();
+
+ JSValue result = JSC::profiledCall(globalObject, JSC::ProfilingReason::API, function, callData, JSC::jsUndefined(), args);
+
if (throwScope.exception()) {
samplingProfiler.shutdown();
samplingProfiler.clearData();
return JSValue::encode(JSValue {});
}
- StringPrintStream topFunctions;
- samplingProfiler.reportTopFunctions(topFunctions);
+ if (auto* promise = jsDynamicCast<JSC::JSPromise*>(result)) {
+ auto* fulfill = JSC::JSFunction::create(vm, globalObject, 0, "fulfill"_s, functionFulfillProfilerRequest, ImplementationVisibility::Public);
+ RETURN_IF_EXCEPTION(throwScope, {});
+ auto afterOngoingPromiseCapability = JSC::JSPromise::createNewPromiseCapability(globalObject, globalObject->promiseConstructor());
- StringPrintStream byteCodes;
- samplingProfiler.reportTopBytecodes(byteCodes);
+ auto data = JSC::JSPromise::convertCapabilityToDeferredData(globalObject, afterOngoingPromiseCapability);
+ RETURN_IF_EXCEPTION(throwScope, {});
- JSValue stackTraces = JSONParse(globalObject, samplingProfiler.stackTracesAsJSON());
+ promise->performPromiseThen(globalObject, fulfill, fulfill, afterOngoingPromiseCapability);
- samplingProfiler.shutdown();
- samplingProfiler.clearData();
+ return JSValue::encode(data.promise);
+ }
- JSObject* result = constructEmptyObject(globalObject, globalObject->objectPrototype(), 3);
- result->putDirect(vm, Identifier::fromString(vm, "functions"_s), jsString(vm, topFunctions.toString()));
- result->putDirect(vm, Identifier::fromString(vm, "bytecodes"_s), jsString(vm, byteCodes.toString()));
- result->putDirect(vm, Identifier::fromString(vm, "stackTraces"_s), stackTraces);
+ samplingProfiler.pause();
- return JSValue::encode(result);
+ return createResultObject(globalObject);
}
JSC_DECLARE_HOST_FUNCTION(functionGenerateHeapSnapshotForDebugging);
diff --git a/src/bun.js/bindings/JSBundlerPlugin.cpp b/src/bun.js/bindings/JSBundlerPlugin.cpp
index cae6a4b22..cacfa438b 100644
--- a/src/bun.js/bindings/JSBundlerPlugin.cpp
+++ b/src/bun.js/bindings/JSBundlerPlugin.cpp
@@ -393,7 +393,7 @@ extern "C" EncodedJSValue JSBundlerPlugin__runSetupFunction(
arguments.append(JSValue::decode(encodedConfig));
auto* lexicalGlobalObject = jsCast<JSFunction*>(JSValue::decode(encodedSetupFunction))->globalObject();
- auto result = JSC::call(lexicalGlobalObject, setupFunction, callData, plugin, arguments);
+ auto result = JSC::profiledCall(lexicalGlobalObject, ProfilingReason::Other, setupFunction, callData, plugin, arguments);
if (UNLIKELY(scope.exception())) {
auto exception = scope.exception();
scope.clearException();
diff --git a/src/bun.js/bindings/JSSink.cpp b/src/bun.js/bindings/JSSink.cpp
index 5f99d3792..5f4cfe19d 100644
--- a/src/bun.js/bindings/JSSink.cpp
+++ b/src/bun.js/bindings/JSSink.cpp
@@ -1,6 +1,6 @@
// AUTO-GENERATED FILE. DO NOT EDIT.
-// Generated by 'make generate-sink' at 2023-07-02T16:19:51.440Z
+// Generated by 'make generate-sink' at 2023-07-04T09:59:44.299Z
// To regenerate this file, run:
//
// make generate-sink
@@ -802,7 +802,7 @@ void JSReadableArrayBufferSinkController::detach()
JSC::MarkedArgumentBuffer arguments;
arguments.append(readableStream);
arguments.append(jsUndefined());
- JSC::call(globalObject, onClose, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, onClose, callData, JSC::jsUndefined(), arguments);
}
m_weakReadableStream.clear();
@@ -1056,7 +1056,7 @@ void JSReadableFileSinkController::detach()
JSC::MarkedArgumentBuffer arguments;
arguments.append(readableStream);
arguments.append(jsUndefined());
- JSC::call(globalObject, onClose, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, onClose, callData, JSC::jsUndefined(), arguments);
}
m_weakReadableStream.clear();
@@ -1310,7 +1310,7 @@ void JSReadableHTTPResponseSinkController::detach()
JSC::MarkedArgumentBuffer arguments;
arguments.append(readableStream);
arguments.append(jsUndefined());
- JSC::call(globalObject, onClose, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, onClose, callData, JSC::jsUndefined(), arguments);
}
m_weakReadableStream.clear();
@@ -1564,7 +1564,7 @@ void JSReadableHTTPSResponseSinkController::detach()
JSC::MarkedArgumentBuffer arguments;
arguments.append(readableStream);
arguments.append(jsUndefined());
- JSC::call(globalObject, onClose, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, onClose, callData, JSC::jsUndefined(), arguments);
}
m_weakReadableStream.clear();
@@ -1835,7 +1835,7 @@ extern "C" void ArrayBufferSink__onReady(JSC__JSValue controllerValue, JSC__JSVa
arguments.append(JSC::JSValue::decode(amt));
arguments.append(JSC::JSValue::decode(offset));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
extern "C" void ArrayBufferSink__onStart(JSC__JSValue controllerValue)
@@ -1859,7 +1859,7 @@ extern "C" void ArrayBufferSink__onClose(JSC__JSValue controllerValue, JSC__JSVa
arguments.append(readableStream ? readableStream : JSC::jsUndefined());
arguments.append(JSC::JSValue::decode(reason));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
extern "C" JSC__JSValue FileSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr)
@@ -1921,7 +1921,7 @@ extern "C" void FileSink__onReady(JSC__JSValue controllerValue, JSC__JSValue amt
arguments.append(JSC::JSValue::decode(amt));
arguments.append(JSC::JSValue::decode(offset));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
extern "C" void FileSink__onStart(JSC__JSValue controllerValue)
@@ -1945,7 +1945,7 @@ extern "C" void FileSink__onClose(JSC__JSValue controllerValue, JSC__JSValue rea
arguments.append(readableStream ? readableStream : JSC::jsUndefined());
arguments.append(JSC::JSValue::decode(reason));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
extern "C" JSC__JSValue HTTPResponseSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr)
@@ -2007,7 +2007,7 @@ extern "C" void HTTPResponseSink__onReady(JSC__JSValue controllerValue, JSC__JSV
arguments.append(JSC::JSValue::decode(amt));
arguments.append(JSC::JSValue::decode(offset));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
extern "C" void HTTPResponseSink__onStart(JSC__JSValue controllerValue)
@@ -2031,7 +2031,7 @@ extern "C" void HTTPResponseSink__onClose(JSC__JSValue controllerValue, JSC__JSV
arguments.append(readableStream ? readableStream : JSC::jsUndefined());
arguments.append(JSC::JSValue::decode(reason));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
extern "C" JSC__JSValue HTTPSResponseSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr)
@@ -2093,7 +2093,7 @@ extern "C" void HTTPSResponseSink__onReady(JSC__JSValue controllerValue, JSC__JS
arguments.append(JSC::JSValue::decode(amt));
arguments.append(JSC::JSValue::decode(offset));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
extern "C" void HTTPSResponseSink__onStart(JSC__JSValue controllerValue)
@@ -2117,5 +2117,5 @@ extern "C" void HTTPSResponseSink__onClose(JSC__JSValue controllerValue, JSC__JS
arguments.append(readableStream ? readableStream : JSC::jsUndefined());
arguments.append(JSC::JSValue::decode(reason));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
diff --git a/src/bun.js/bindings/JSSink.h b/src/bun.js/bindings/JSSink.h
index 41d7065dc..bbdf717fb 100644
--- a/src/bun.js/bindings/JSSink.h
+++ b/src/bun.js/bindings/JSSink.h
@@ -1,6 +1,6 @@
// AUTO-GENERATED FILE. DO NOT EDIT.
-// Generated by 'make generate-sink' at 2023-07-02T16:19:51.438Z
+// Generated by 'make generate-sink' at 2023-07-04T09:59:44.298Z
//
#pragma once
diff --git a/src/bun.js/bindings/JSSinkLookupTable.h b/src/bun.js/bindings/JSSinkLookupTable.h
index e4ed81629..a4ace6dc3 100644
--- a/src/bun.js/bindings/JSSinkLookupTable.h
+++ b/src/bun.js/bindings/JSSinkLookupTable.h
@@ -1,4 +1,4 @@
-// Automatically generated from src/bun.js/bindings/JSSink.cpp using /home/cirospaciari/Repos/bun/src/bun.js/WebKit/Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+// Automatically generated from src/bun.js/bindings/JSSink.cpp using /Users/jarred/Code/bun/src/bun.js/WebKit/Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index b3236a4a2..4528f3472 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -239,9 +239,9 @@ extern "C" void JSCInitialize(const char* envp[], size_t envc, void (*onCrash)(c
JSC::Options::useJITCage() = false;
JSC::Options::useShadowRealm() = true;
JSC::Options::useResizableArrayBuffer() = true;
-#ifdef BUN_DEBUG
- JSC::Options::showPrivateScriptsInStackTraces() = true;
-#endif
+ // #ifdef BUN_DEBUG
+ // JSC::Options::showPrivateScriptsInStackTraces() = true;
+ // #endif
JSC::Options::useSetMethods() = true;
/*
@@ -2606,7 +2606,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionPerformMicrotask, (JSGlobalObject * globalObj
break;
}
- JSC::call(globalObject, job, callData, jsUndefined(), arguments, exceptionPtr);
+ JSC::profiledCall(globalObject, ProfilingReason::Microtask, job, callData, jsUndefined(), arguments, exceptionPtr);
if (auto* exception = exceptionPtr.get()) {
Bun__reportUnhandledError(globalObject, JSValue::encode(exception));
@@ -2657,7 +2657,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionPerformMicrotaskVariadic, (JSGlobalObject * g
thisValue = callframe->argument(2);
}
- JSC::call(globalObject, job, callData, thisValue, arguments, exceptionPtr);
+ JSC::profiledCall(globalObject, ProfilingReason::Microtask, job, callData, thisValue, arguments, exceptionPtr);
if (auto* exception = exceptionPtr.get()) {
Bun__reportUnhandledError(globalObject, JSValue::encode(exception));
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp
index 9f9b20c1e..ae9beee28 100644
--- a/src/bun.js/bindings/bindings.cpp
+++ b/src/bun.js/bindings/bindings.cpp
@@ -250,7 +250,7 @@ static void handlePromise(PromiseType* promise, JSC__JSGlobalObject* globalObjec
arguments.append(jsUndefined());
arguments.append(JSValue::decode(ctx));
ASSERT(!arguments.hasOverflowed());
- JSC::call(globalThis, performPromiseThenFunction, callData, jsUndefined(), arguments);
+ JSC::profiledCall(globalThis, ProfilingReason::Other, performPromiseThenFunction, callData, jsUndefined(), arguments);
} else {
promise->then(globalThis, resolverFunction, rejecterFunction);
}
@@ -1763,7 +1763,7 @@ JSC__JSValue JSObjectCallAsFunctionReturnValue(JSContextRef ctx, JSObjectRef obj
return JSC::JSValue::encode(JSC::JSValue());
NakedPtr<JSC::Exception> returnedException = nullptr;
- auto result = JSC::call(globalObject, jsObject, callData, jsThisObject, argList, returnedException);
+ auto result = JSC::profiledCall(globalObject, ProfilingReason::Other, jsObject, callData, jsThisObject, argList, returnedException);
if (returnedException.get()) {
return JSC::JSValue::encode(JSC::JSValue(returnedException.get()));
@@ -1805,7 +1805,7 @@ JSC__JSValue JSObjectCallAsFunctionReturnValueHoldingAPILock(JSContextRef ctx, J
return JSC::JSValue::encode(JSC::JSValue());
NakedPtr<JSC::Exception> returnedException = nullptr;
- auto result = JSC::call(globalObject, jsObject, callData, jsThisObject, argList, returnedException);
+ auto result = JSC::profiledCall(globalObject, ProfilingReason::Other, jsObject, callData, jsThisObject, argList, returnedException);
if (returnedException.get()) {
return JSC::JSValue::encode(JSC::JSValue(returnedException.get()));
diff --git a/src/bun.js/bindings/napi.cpp b/src/bun.js/bindings/napi.cpp
index 8fffcc05f..7d559374e 100644
--- a/src/bun.js/bindings/napi.cpp
+++ b/src/bun.js/bindings/napi.cpp
@@ -1867,7 +1867,7 @@ extern "C" napi_status napi_call_function(napi_env env, napi_value recv_napi,
if (thisValue.isEmpty()) {
thisValue = JSC::jsUndefined();
}
- JSC::JSValue result = JSC::call(globalObject, funcValue, callData, thisValue, args);
+ JSC::JSValue result = JSC::profiledCall(globalObject, ProfilingReason::Other, funcValue, callData, thisValue, args);
if (result_ptr) {
*result_ptr = toNapi(result);
diff --git a/src/bun.js/bindings/webcore/EventEmitter.cpp b/src/bun.js/bindings/webcore/EventEmitter.cpp
index 0650d624c..c5a6ff487 100644
--- a/src/bun.js/bindings/webcore/EventEmitter.cpp
+++ b/src/bun.js/bindings/webcore/EventEmitter.cpp
@@ -227,7 +227,7 @@ void EventEmitter::innerInvokeEventListeners(const Identifier& eventType, Simple
continue;
WTF::NakedPtr<JSC::Exception> exceptionPtr;
- JSC::call(lexicalGlobalObject, jsFunction, callData, thisValue, arguments, exceptionPtr);
+ JSC::profiledCall(lexicalGlobalObject, ProfilingReason::Other, jsFunction, callData, thisValue, arguments, exceptionPtr);
auto* exception = exceptionPtr.get();
if (UNLIKELY(exception)) {
diff --git a/src/bun.js/scripts/generate-jssink.js b/src/bun.js/scripts/generate-jssink.js
index 715df1f82..13bc347ca 100644
--- a/src/bun.js/scripts/generate-jssink.js
+++ b/src/bun.js/scripts/generate-jssink.js
@@ -640,7 +640,7 @@ void JS${controllerName}::detach() {
JSC::MarkedArgumentBuffer arguments;
arguments.append(readableStream);
arguments.append(jsUndefined());
- JSC::call(globalObject, onClose, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, onClose, callData, JSC::jsUndefined(), arguments);
}
m_weakReadableStream.clear();
@@ -912,7 +912,7 @@ extern "C" void ${name}__onReady(JSC__JSValue controllerValue, JSC__JSValue amt,
arguments.append(JSC::JSValue::decode(amt));
arguments.append(JSC::JSValue::decode(offset));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
extern "C" void ${name}__onStart(JSC__JSValue controllerValue)
@@ -937,7 +937,7 @@ extern "C" void ${name}__onClose(JSC__JSValue controllerValue, JSC__JSValue reas
arguments.append(readableStream ? readableStream : JSC::jsUndefined());
arguments.append(JSC::JSValue::decode(reason));
- JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments);
+ JSC::profiledCall(globalObject, JSC::ProfilingReason::Other, function, callData, JSC::jsUndefined(), arguments);
}
`;