Skip to content
Merged
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
4 changes: 3 additions & 1 deletion cmake/targets/BuildBun.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ if(WIN32)
endif()

if(USE_MIMALLOC_AS_DEFAULT_ALLOCATOR)
target_compile_definitions(${bun} PRIVATE USE_MIMALLOC=1)
target_compile_definitions(${bun} PRIVATE USE_BUN_MIMALLOC=1)
endif()

target_compile_definitions(${bun} PRIVATE
Expand Down Expand Up @@ -1253,6 +1253,7 @@ if(WIN32)
target_link_libraries(${bun} PRIVATE
${WEBKIT_LIB_PATH}/WTF.lib
${WEBKIT_LIB_PATH}/JavaScriptCore.lib
${WEBKIT_LIB_PATH}/bmalloc.lib
${WEBKIT_LIB_PATH}/sicudtd.lib
${WEBKIT_LIB_PATH}/sicuind.lib
${WEBKIT_LIB_PATH}/sicuucd.lib
Expand All @@ -1261,6 +1262,7 @@ if(WIN32)
target_link_libraries(${bun} PRIVATE
${WEBKIT_LIB_PATH}/WTF.lib
${WEBKIT_LIB_PATH}/JavaScriptCore.lib
${WEBKIT_LIB_PATH}/bmalloc.lib
${WEBKIT_LIB_PATH}/sicudt.lib
${WEBKIT_LIB_PATH}/sicuin.lib
${WEBKIT_LIB_PATH}/sicuuc.lib
Expand Down
2 changes: 1 addition & 1 deletion cmake/tools/SetupWebKit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ option(WEBKIT_VERSION "The version of WebKit to use")
option(WEBKIT_LOCAL "If a local version of WebKit should be used instead of downloading")

if(NOT WEBKIT_VERSION)
set(WEBKIT_VERSION daf95b4b4574799ff22c8c4effd0dc6e864968a5)
set(WEBKIT_VERSION f151e5c43c3546da23c5c1e709452da25d47e168)
endif()
Comment thread
Jarred-Sumner marked this conversation as resolved.

# Use preview build URL for Windows ARM64 until the fix is merged to main
Expand Down
2 changes: 1 addition & 1 deletion misctools/cold-jsc-start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionWrite, (JSC::JSGlobalObject * globalObject,
JSValue arg1 = callframe->argument(0);
JSValue toWriteArg = callframe->argument(1);
auto &vm = globalObject->vm();
auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);

int32_t fd = STDOUT_FILENO;
if (callframe->argumentCount() > 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/AsyncModule.zig
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ pub const AsyncModule = struct {
jsc.markBinding(@src());
var specifier = specifier_;
var referrer = referrer_;
var scope: jsc.CatchScope = undefined;
var scope: jsc.TopExceptionScope = undefined;
scope.init(globalThis, @src());
defer {
specifier.deref();
Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/VirtualMachine.zig
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ fn wrapUnhandledRejectionErrorForUncaughtException(globalObject: *JSGlobalObject
break :blk false;
}) return reason;
const reasonStr = blk: {
var scope: jsc.CatchScope = undefined;
var scope: jsc.TopExceptionScope = undefined;
scope.init(globalObject, @src());
defer scope.deinit();
defer if (scope.exception()) |_| scope.clearException();
Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/api/JSBundler.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ pub const JSBundler = struct {
error.JSTerminated => return error.JSTerminated,
};

var scope: jsc.CatchScope = undefined;
var scope: jsc.TopExceptionScope = undefined;
scope.init(globalThis, @src());
defer scope.deinit();

Expand Down
4 changes: 2 additions & 2 deletions src/bun.js/api/html_rewriter.zig
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,8 @@ fn HandlerCallback(
wrapper.deref();
}

// Use a CatchScope to properly handle exceptions from the JavaScript callback
var scope: bun.jsc.CatchScope = undefined;
// Use a TopExceptionScope to properly handle exceptions from the JavaScript callback
var scope: bun.jsc.TopExceptionScope = undefined;
scope.init(this.global, @src());
defer scope.deinit();

Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/bindings/AnyPromise.zig
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub const AnyPromise = union(enum) {
}
};

var scope: jsc.CatchScope = undefined;
var scope: jsc.TopExceptionScope = undefined;
scope.init(globalObject, @src());
defer scope.deinit();
var ctx = Wrapper{ .args = args };
Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/bindings/BunDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ extern "C" void Bun__startJSDebuggerThread(Zig::GlobalObject* debuggerGlobalObje
debuggerScriptExecutionContext = debuggerGlobalObject->scriptExecutionContext();

JSC::VM& vm = debuggerGlobalObject->vm();
auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
JSValue defaultValue = debuggerGlobalObject->internalModuleRegistry()->requireId(debuggerGlobalObject, vm, InternalModuleRegistry::Field::InternalDebugger);
scope.assertNoException();
JSFunction* debuggerDefaultFn = jsCast<JSFunction*>(defaultValue.asCell());
Expand Down
6 changes: 3 additions & 3 deletions src/bun.js/bindings/BunObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,13 +1145,13 @@ static void exportBunObject(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC:

for (const auto& propertyName : propertyNames) {
exportNames.append(propertyName);
auto catchScope = DECLARE_CATCH_SCOPE(vm);
auto topExceptionScope = DECLARE_TOP_EXCEPTION_SCOPE(vm);

// Yes, we have to call getters :(
JSValue value = object->get(globalObject, propertyName);

if (catchScope.exception()) {
(void)catchScope.tryClearException();
if (topExceptionScope.exception()) {
(void)topExceptionScope.tryClearException();
value = jsUndefined();
}
exportValues.append(value);
Expand Down
10 changes: 5 additions & 5 deletions src/bun.js/bindings/BunPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "helpers.h"
#include "ZigGlobalObject.h"

#include <JavaScriptCore/CatchScope.h>
#include <JavaScriptCore/TopExceptionScope.h>
#include <JavaScriptCore/JSCInlines.h>
#include <JavaScriptCore/JSGlobalObject.h>
#include <JavaScriptCore/JSMap.h>
Expand Down Expand Up @@ -543,10 +543,10 @@ extern "C" JSC_DEFINE_HOST_FUNCTION(JSMock__jsModuleMock, (JSC::JSGlobalObject *
if (url.isValid() && url.protocolIsFile()) {
auto fromString = url.fileSystemPath();
BunString from = Bun::toString(fromString);
auto catchScope = DECLARE_CATCH_SCOPE(vm);
auto topExceptionScope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
auto result = JSValue::decode(Bun__resolveSyncWithSource(globalObject, JSValue::encode(specifierString), &from, true, false));
if (catchScope.exception()) {
(void)catchScope.tryClearException();
if (topExceptionScope.exception()) {
(void)topExceptionScope.tryClearException();
}

if (result && result.isString()) {
Expand Down Expand Up @@ -646,7 +646,7 @@ extern "C" JSC_DEFINE_HOST_FUNCTION(JSMock__jsModuleMock, (JSC::JSGlobalObject *

for (auto& name : names) {
// consistent with regular esm handling code
auto catchScope = DECLARE_CATCH_SCOPE(vm);
auto topExceptionScope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
JSValue value = object->get(globalObject, name);
if (scope.exception()) [[unlikely]] {
(void)scope.tryClearException();
Expand Down
12 changes: 6 additions & 6 deletions src/bun.js/bindings/BunProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "ErrorCode+List.h"
#include "JavaScriptCore/ArgList.h"
#include "JavaScriptCore/CallData.h"
#include "JavaScriptCore/CatchScope.h"
#include "JavaScriptCore/TopExceptionScope.h"
#include "JavaScriptCore/JSCJSValue.h"
#include "JavaScriptCore/JSCast.h"
#include "JavaScriptCore/JSMap.h"
Expand Down Expand Up @@ -1190,7 +1190,7 @@ extern "C" int Bun__handleUncaughtException(JSC::JSGlobalObject* lexicalGlobalOb
// if there is an uncaughtExceptionCaptureCallback, call it and consider the exception handled
auto capture = process->getUncaughtExceptionCaptureCallback();
if (!capture.isEmpty() && !capture.isUndefinedOrNull()) {
auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
(void)call(lexicalGlobalObject, capture, args, "uncaughtExceptionCaptureCallback"_s);
if (auto ex = scope.exception()) {
(void)scope.tryClearException();
Expand Down Expand Up @@ -1254,7 +1254,7 @@ extern "C" JSC::EncodedJSValue Bun__noSideEffectsToString(JSC::VM& vm, JSC::JSGl
extern "C" void Bun__promises__emitUnhandledRejectionWarning(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue reason, JSC::EncodedJSValue promise)
{
auto& vm = globalObject->vm();
auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
auto warning = JSC::createError(globalObject, "Unhandled promise rejection. This error originated either by "
"throwing inside of an async function without a catch block, "
"or by rejecting a promise which was not handled with .catch(). "
Expand Down Expand Up @@ -1306,7 +1306,7 @@ extern "C" bool Bun__VM__allowRejectionHandledWarning(void* vm);

extern "C" bool Bun__emitHandledPromiseEvent(JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSValue promise)
{
auto scope = DECLARE_CATCH_SCOPE(JSC::getVM(lexicalGlobalObject));
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(JSC::getVM(lexicalGlobalObject));
if (!lexicalGlobalObject->inherits(Zig::GlobalObject::info()))
return false;
auto* globalObject = jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
Expand Down Expand Up @@ -2330,7 +2330,7 @@ extern "C" void Bun__ForceFileSinkToBeSynchronousForProcessObjectStdio(JSC::JSGl
static JSValue constructStdioWriteStream(JSC::JSGlobalObject* globalObject, JSC::JSObject* processObject, int fd)
{
auto& vm = JSC::getVM(globalObject);
auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);

JSC::JSFunction* getStdioWriteStream = JSC::JSFunction::create(vm, globalObject, processObjectInternalsGetStdioWriteStreamCodeGenerator(vm), globalObject);
JSC::MarkedArgumentBuffer args;
Expand Down Expand Up @@ -2393,7 +2393,7 @@ static JSValue constructStderr(VM& vm, JSObject* processObject)
static JSValue constructStdin(VM& vm, JSObject* processObject)
{
auto* globalObject = processObject->globalObject();
auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
JSC::JSFunction* getStdinStream = JSC::JSFunction::create(vm, globalObject, processObjectInternalsGetStdinStreamCodeGenerator(vm), globalObject);
JSC::MarkedArgumentBuffer args;
args.append(processObject);
Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/bindings/BunProcessReportObjectWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "JavaScriptCore/JSArray.h"
#include "JavaScriptCore/ObjectConstructor.h"
#include "JavaScriptCore/JSGlobalObject.h"
#include "JavaScriptCore/CatchScope.h"
#include "JavaScriptCore/TopExceptionScope.h"
#include "JavaScriptCore/VM.h"
#include "wtf/text/WTFString.h"
#include "wtf/text/StringView.h"
Expand Down
6 changes: 3 additions & 3 deletions src/bun.js/bindings/CallSite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ void CallSite::formatAsString(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WT
}

if (auto* object = thisValue.getObject()) {
auto catchScope = DECLARE_CATCH_SCOPE(vm);
auto topExceptionScope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
auto className = object->calculatedClassName(object);
if (catchScope.exception()) {
(void)catchScope.tryClearException();
if (topExceptionScope.exception()) {
(void)topExceptionScope.tryClearException();
}

if (className.length() > 0) {
Expand Down
77 changes: 0 additions & 77 deletions src/bun.js/bindings/CatchScopeBinding.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions src/bun.js/bindings/ErrorCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static Structure* createErrorStructure(JSC::VM& vm, JSGlobalObject* globalObject

JSObject* ErrorCodeCache::createError(VM& vm, Zig::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options)
{
auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
auto* cache = errorCache(globalObject);
const auto& data = errors[static_cast<size_t>(code)];
if (!cache->internalField(static_cast<unsigned>(code))) {
Expand Down Expand Up @@ -346,7 +346,7 @@ void JSValueToStringSafe(JSC::JSGlobalObject* globalObject, WTF::StringBuilder&

void determineSpecificType(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WTF::StringBuilder& builder, JSValue value)
{
auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);

ASSERT(!value.isEmpty());

Expand Down
16 changes: 8 additions & 8 deletions src/bun.js/bindings/ErrorStackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "JavaScriptCore/JSType.h"
#include "wtf/text/OrdinalNumber.h"

#include <JavaScriptCore/CatchScope.h>
#include <JavaScriptCore/TopExceptionScope.h>
#include <JavaScriptCore/DebuggerPrimitives.h>
#include <JavaScriptCore/Exception.h>
#include <JavaScriptCore/JSCInlines.h>
Expand Down Expand Up @@ -258,7 +258,7 @@ JSCStackTrace JSCStackTrace::getStackTraceForThrownValue(JSC::VM& vm, JSC::JSVal
{
const WTF::Vector<JSC::StackFrame>* jscStackTrace = nullptr;

JSC::Exception* currentException = DECLARE_CATCH_SCOPE(vm).exception();
JSC::Exception* currentException = DECLARE_TOP_EXCEPTION_SCOPE(vm).exception();
if (currentException && currentException->value() == thrownValue) {
jscStackTrace = &currentException->stack();
} else {
Expand Down Expand Up @@ -631,7 +631,7 @@ String functionName(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, JSC::
// First try the "name" property.
{
WTF::String name;
auto catchScope = DECLARE_CATCH_SCOPE(vm);
auto topExceptionScope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
PropertySlot slot(object, PropertySlot::InternalMethodType::VMInquiry, &vm);
if (object->getOwnNonIndexPropertySlot(vm, object->structure(), vm.propertyNames->name, slot)) {
if (!slot.isAccessor()) {
Expand All @@ -644,17 +644,17 @@ String functionName(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, JSC::
}
}
}
if (catchScope.exception()) [[unlikely]] {
(void)catchScope.tryClearException();
if (topExceptionScope.exception()) [[unlikely]] {
(void)topExceptionScope.tryClearException();
}
}

{
// Then try the "displayName" property (what this does internally)
auto catchScope = DECLARE_CATCH_SCOPE(vm);
auto topExceptionScope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
functionName = JSC::getCalculatedDisplayName(vm, object);
if (catchScope.exception()) [[unlikely]] {
(void)catchScope.tryClearException();
if (topExceptionScope.exception()) [[unlikely]] {
(void)topExceptionScope.tryClearException();
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/bun.js/bindings/FormatStackTraceForJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "JavaScriptCore/ArgList.h"
#include "JavaScriptCore/CallData.h"
#include "JavaScriptCore/CatchScope.h"
#include "JavaScriptCore/TopExceptionScope.h"
#include "JavaScriptCore/Error.h"
#include "JavaScriptCore/ErrorInstance.h"
#include "JavaScriptCore/ExceptionScope.h"
Expand Down Expand Up @@ -125,7 +125,7 @@ static JSValue formatStackTraceToJSValueWithoutPrepareStackTrace(JSC::VM& vm, Zi
prepareStackTrace = prepare;
}
} else {
auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);

auto* errorConstructor = lexicalGlobalObject->m_errorStructure.constructor(globalObject);
prepareStackTrace = errorConstructor->getIfPropertyExists(lexicalGlobalObject, JSC::Identifier::fromString(vm, "prepareStackTrace"_s));
Expand Down Expand Up @@ -526,7 +526,7 @@ WTF::String computeErrorInfoWrapperToString(JSC::VM& vm, Vector<StackFrame>& sta
OrdinalNumber line = OrdinalNumber::fromOneBasedInt(line_in);
OrdinalNumber column = OrdinalNumber::fromOneBasedInt(column_in);

auto scope = DECLARE_CATCH_SCOPE(vm);
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
WTF::String result = computeErrorInfoToString(vm, stackTrace, line, column, sourceURL);
if (scope.exception()) {
// TODO: is this correct? vm.setOnComputeErrorInfo doesnt appear to properly handle a function that can throw
Expand Down
Loading
Loading