diff --git a/CMakeLists.txt b/CMakeLists.txt index 80f68271b6..2cb26bfc33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_policy(SET CMP0067 NEW) set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) set(Bun_VERSION "1.1.19") -set(WEBKIT_TAG 615e8585f96aa718b0f5158210259b83fe8440ea) +set(WEBKIT_TAG c61accd7316919f65b050f8448d5fbf52202268a) set(BUN_WORKDIR "${CMAKE_CURRENT_BINARY_DIR}") message(STATUS "Configuring Bun ${Bun_VERSION} in ${BUN_WORKDIR}") @@ -778,6 +778,8 @@ if(NOT NO_CODEGEN) "${BUN_SRC}/js/thirdparty/*.ts" "${BUN_SRC}/js/internal/*.js" "${BUN_SRC}/js/internal/*.ts" + "${BUN_SRC}/js/internal/util/*.js" + "${BUN_SRC}/js/internal/fs/*.ts" "${BUN_SRC}/js/node/*.js" "${BUN_SRC}/js/node/*.ts" "${BUN_SRC}/js/thirdparty/*.js" diff --git a/packages/bun-internal-test/src/banned.json b/packages/bun-internal-test/src/banned.json index 6b17b5358d..0340357dfa 100644 --- a/packages/bun-internal-test/src/banned.json +++ b/packages/bun-internal-test/src/banned.json @@ -5,7 +5,7 @@ "std.debug.assert": "Use bun.assert instead", "std.debug.dumpStackTrace": "Use bun.handleErrorReturnTrace or bun.crash_handler.dumpStackTrace instead", "std.debug.print": "Don't let this be committed", - "std.mem.indexOfAny(": "Use bun.strings.indexOfAny", + "std.mem.indexOfAny(u8": "Use bun.strings.indexOfAny", "undefined != ": "This is by definition Undefined Behavior.", "undefined == ": "This is by definition Undefined Behavior.", "bun.toFD(std.fs.cwd().fd)": "Use bun.FD.cwd()", diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 9bdb43ecd2..0c7c568ff5 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -20,8 +20,6 @@ #include "JavaScriptCore/FunctionPrototype.h" #include "JavaScriptCore/GetterSetter.h" #include "JavaScriptCore/GlobalObjectMethodTable.h" -#include "JavaScriptCore/HashMapImpl.h" -#include "JavaScriptCore/HashMapImplInlines.h" #include "JavaScriptCore/Heap.h" #include "JavaScriptCore/Identifier.h" #include "JavaScriptCore/InitializeThreading.h" @@ -857,7 +855,7 @@ extern "C" bool Zig__GlobalObject__resetModuleRegistryMap(JSC__JSGlobalObject* g // vm.deleteAllLinkedCode(JSC::DeleteAllCodeEffort::DeleteAllCodeIfNotCollecting); // JSC::Heap::PreventCollectionScope(vm.heap); - oldMap->clear(vm); + oldMap->clear(globalObject); JSC::gcUnprotect(oldMap); // vm.heap.completeAllJITPlans(); @@ -3659,8 +3657,8 @@ void GlobalObject::reload() this, Identifier::fromString(this->vm(), "registry"_s))); - registry->clear(this->vm()); - this->requireMap()->clear(this->vm()); + registry->clear(this); + this->requireMap()->clear(this); // If we run the GC every time, we will never get the SourceProvider cache hit. // So we run the GC every other time. diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index ed5f960f2c..8e6104573f 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -96,8 +96,6 @@ #include "JavaScriptCore/DateInstance.h" #include "JavaScriptCore/RegExpObject.h" #include "JavaScriptCore/PropertyNameArray.h" -#include "JavaScriptCore/HashMapImpl.h" -#include "JavaScriptCore/HashMapImplInlines.h" #include "webcore/JSAbortSignal.h" #include "JSAbortAlgorithm.h" @@ -717,48 +715,48 @@ bool Bun__deepEquals(JSC__JSGlobalObject* globalObject, JSValue v1, JSValue v2, return false; } - bool canPerformFastSet = JSSet::isAddFastAndNonObservable(set1->structure()) && JSSet::isAddFastAndNonObservable(set2->structure()); + // bool canPerformFastSet = JSSet::isAddFastAndNonObservable(set1->structure()) && JSSet::isAddFastAndNonObservable(set2->structure()); - // This code is loosely based on - // https://github.com/oven-sh/WebKit/blob/657558d4d4c9c33f41b9670e72d96a5a39fe546e/Source/JavaScriptCore/runtime/HashMapImplInlines.h#L203-L211 - if (canPerformFastSet && set1->isIteratorProtocolFastAndNonObservable() && set2->isIteratorProtocolFastAndNonObservable()) { - auto* bucket = set1->head(); - while (bucket) { - if (!bucket->deleted()) { - auto key = bucket->key(); - RETURN_IF_EXCEPTION(*scope, false); - auto** bucket2ptr = set2->findBucket(globalObject, key); + // // This code is loosely based on + // // https://github.com/oven-sh/WebKit/blob/657558d4d4c9c33f41b9670e72d96a5a39fe546e/Source/JavaScriptCore/runtime/HashMapImplInlines.h#L203-L211 + // if (canPerformFastSet && set1->isIteratorProtocolFastAndNonObservable() && set2->isIteratorProtocolFastAndNonObservable()) { + // auto* bucket = set1->head(); + // while (bucket) { + // if (!bucket->deleted()) { + // auto key = bucket->key(); + // RETURN_IF_EXCEPTION(*scope, false); + // auto** bucket2ptr = set2->findBucket(globalObject, key); - if (bucket2ptr && (*bucket2ptr)->deleted()) { - bucket2ptr = nullptr; - } + // if (bucket2ptr && (*bucket2ptr)->deleted()) { + // bucket2ptr = nullptr; + // } - if (!bucket2ptr) { - auto findDeepEqualKey = [&]() -> bool { - auto* bucket = set2->head(); - while (bucket) { - if (!bucket->deleted()) { - auto key2 = bucket->key(); - if (Bun__deepEquals(globalObject, key, key2, gcBuffer, stack, scope, false)) { - return true; - } - } - bucket = bucket->next(); - } + // if (!bucket2ptr) { + // auto findDeepEqualKey = [&]() -> bool { + // auto* bucket = set2->head(); + // while (bucket) { + // if (!bucket->deleted()) { + // auto key2 = bucket->key(); + // if (Bun__deepEquals(globalObject, key, key2, gcBuffer, stack, scope, false)) { + // return true; + // } + // } + // bucket = bucket->next(); + // } - return false; - }; + // return false; + // }; - if (!findDeepEqualKey()) { - return false; - } - } - } - bucket = bucket->next(); - } + // if (!findDeepEqualKey()) { + // return false; + // } + // } + // } + // bucket = bucket->next(); + // } - return true; - } + // return true; + // } // This code path can be triggered when it is a class that extends from Set. // @@ -825,56 +823,56 @@ bool Bun__deepEquals(JSC__JSGlobalObject* globalObject, JSValue v1, JSValue v2, return false; } - bool canPerformFastSet = JSMap::isSetFastAndNonObservable(map1->structure()) && JSMap::isSetFastAndNonObservable(map2->structure()); + // bool canPerformFastSet = JSMap::isSetFastAndNonObservable(map1->structure()) && JSMap::isSetFastAndNonObservable(map2->structure()); - // This code is loosely based on - // https://github.com/oven-sh/WebKit/blob/657558d4d4c9c33f41b9670e72d96a5a39fe546e/Source/JavaScriptCore/runtime/HashMapImplInlines.h#L203-L211 - if (canPerformFastSet && map1->isIteratorProtocolFastAndNonObservable() && map2->isIteratorProtocolFastAndNonObservable()) { - auto* bucket = map1->head(); - while (bucket) { - if (!bucket->deleted()) { - auto key = bucket->key(); - auto value = bucket->value(); - RETURN_IF_EXCEPTION(*scope, false); - auto** bucket2ptr = map2->findBucket(globalObject, key); - JSMap::BucketType* bucket2 = nullptr; + // // This code is loosely based on + // // https://github.com/oven-sh/WebKit/blob/657558d4d4c9c33f41b9670e72d96a5a39fe546e/Source/JavaScriptCore/runtime/HashMapImplInlines.h#L203-L211 + // if (canPerformFastSet && map1->isIteratorProtocolFastAndNonObservable() && map2->isIteratorProtocolFastAndNonObservable()) { + // auto* bucket = map1->head(); + // while (bucket) { + // if (!bucket->deleted()) { + // auto key = bucket->key(); + // auto value = bucket->value(); + // RETURN_IF_EXCEPTION(*scope, false); + // auto** bucket2ptr = map2->findBucket(globalObject, key); + // JSMap::BucketType* bucket2 = nullptr; - if (bucket2ptr) { - bucket2 = *bucket2ptr; + // if (bucket2ptr) { + // bucket2 = *bucket2ptr; - if (bucket2->deleted()) { - bucket2 = nullptr; - } - } + // if (bucket2->deleted()) { + // bucket2 = nullptr; + // } + // } - if (!bucket2) { - auto findDeepEqualKey = [&]() -> JSMap::BucketType* { - auto* bucket = map2->head(); - while (bucket) { - if (!bucket->deleted()) { - auto key2 = bucket->key(); - if (Bun__deepEquals(globalObject, key, key2, gcBuffer, stack, scope, false)) { - return bucket; - } - } - bucket = bucket->next(); - } + // if (!bucket2) { + // auto findDeepEqualKey = [&]() -> JSMap::BucketType* { + // auto* bucket = map2->head(); + // while (bucket) { + // if (!bucket->deleted()) { + // auto key2 = bucket->key(); + // if (Bun__deepEquals(globalObject, key, key2, gcBuffer, stack, scope, false)) { + // return bucket; + // } + // } + // bucket = bucket->next(); + // } - return nullptr; - }; + // return nullptr; + // }; - bucket2 = findDeepEqualKey(); - } + // bucket2 = findDeepEqualKey(); + // } - if (!bucket2 || !Bun__deepEquals(globalObject, value, bucket2->value(), gcBuffer, stack, scope, false)) { - return false; - } - } - bucket = bucket->next(); - } + // if (!bucket2 || !Bun__deepEquals(globalObject, value, bucket2->value(), gcBuffer, stack, scope, false)) { + // return false; + // } + // } + // bucket = bucket->next(); + // } - return true; - } + // return true; + // } // This code path can be triggered when it is a class that extends from Map. // diff --git a/src/bun.js/bindings/napi.cpp b/src/bun.js/bindings/napi.cpp index fe30f2538d..787d3446ca 100644 --- a/src/bun.js/bindings/napi.cpp +++ b/src/bun.js/bindings/napi.cpp @@ -33,8 +33,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/bun.js/bindings/webcore/JSAbortController.cpp b/src/bun.js/bindings/webcore/JSAbortController.cpp index 8a85c5ac4e..81464aa295 100644 --- a/src/bun.js/bindings/webcore/JSAbortController.cpp +++ b/src/bun.js/bindings/webcore/JSAbortController.cpp @@ -251,7 +251,7 @@ void JSAbortController::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSAbortSignal.cpp b/src/bun.js/bindings/webcore/JSAbortSignal.cpp index cf2b1bf09f..5369d9b920 100644 --- a/src/bun.js/bindings/webcore/JSAbortSignal.cpp +++ b/src/bun.js/bindings/webcore/JSAbortSignal.cpp @@ -376,7 +376,7 @@ void JSAbortSignal::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp b/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp index 61c7e8f6b2..980dfa0050 100644 --- a/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp +++ b/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp @@ -351,7 +351,7 @@ void JSBroadcastChannel::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSDOMURL.cpp b/src/bun.js/bindings/webcore/JSDOMURL.cpp index 07d1e83a6a..5f0ca50b09 100755 --- a/src/bun.js/bindings/webcore/JSDOMURL.cpp +++ b/src/bun.js/bindings/webcore/JSDOMURL.cpp @@ -789,7 +789,7 @@ void JSDOMURL::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSMessageChannel.cpp b/src/bun.js/bindings/webcore/JSMessageChannel.cpp index 316d8f808f..a5c8ff7197 100644 --- a/src/bun.js/bindings/webcore/JSMessageChannel.cpp +++ b/src/bun.js/bindings/webcore/JSMessageChannel.cpp @@ -250,7 +250,7 @@ void JSMessageChannel::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSMessageEvent.cpp b/src/bun.js/bindings/webcore/JSMessageEvent.cpp index 7251b71e32..caf32b36ac 100644 --- a/src/bun.js/bindings/webcore/JSMessageEvent.cpp +++ b/src/bun.js/bindings/webcore/JSMessageEvent.cpp @@ -470,7 +470,7 @@ void JSMessageEvent::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSMessagePort.cpp b/src/bun.js/bindings/webcore/JSMessagePort.cpp index 2e700a49b5..576baae759 100644 --- a/src/bun.js/bindings/webcore/JSMessagePort.cpp +++ b/src/bun.js/bindings/webcore/JSMessagePort.cpp @@ -419,7 +419,7 @@ void JSMessagePort::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSPerformance.cpp b/src/bun.js/bindings/webcore/JSPerformance.cpp index 05808eab41..d866a4e58e 100644 --- a/src/bun.js/bindings/webcore/JSPerformance.cpp +++ b/src/bun.js/bindings/webcore/JSPerformance.cpp @@ -601,7 +601,7 @@ void JSPerformance::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSPerformanceEntry.cpp b/src/bun.js/bindings/webcore/JSPerformanceEntry.cpp index 428a42fe83..ac027687e5 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceEntry.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceEntry.cpp @@ -268,7 +268,7 @@ void JSPerformanceEntry::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSPerformanceMark.cpp b/src/bun.js/bindings/webcore/JSPerformanceMark.cpp index c9103dd312..b0a193269c 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceMark.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceMark.cpp @@ -230,7 +230,7 @@ void JSPerformanceMark::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp b/src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp index b495cc5037..824e3a3ac2 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp @@ -42,7 +42,6 @@ #include #include - namespace WebCore { using namespace JSC; @@ -103,8 +102,7 @@ template<> void JSPerformanceMeasureDOMConstructor::initializeProperties(VM& vm, /* Hash table for prototype */ -static const HashTableValue JSPerformanceMeasurePrototypeTableValues[] = -{ +static const HashTableValue JSPerformanceMeasurePrototypeTableValues[] = { { "constructor"_s, static_cast(PropertyAttribute::DontEnum), NoIntrinsic, { HashTableValue::GetterSetterType, jsPerformanceMeasureConstructor, 0 } }, { "detail"_s, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute, NoIntrinsic, { HashTableValue::GetterSetterType, jsPerformanceMeasure_detail, 0 } }, }; @@ -144,7 +142,7 @@ JSValue JSPerformanceMeasure::getConstructor(VM& vm, const JSGlobalObject* globa return getDOMConstructor(vm, *jsCast(globalObject)); } -JSC_DEFINE_CUSTOM_GETTER(jsPerformanceMeasureConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsPerformanceMeasureConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -162,24 +160,24 @@ static inline JSValue jsPerformanceMeasure_detailGetter(JSGlobalObject& lexicalG return cachedValue; auto& impl = thisObject.wrapped(); JSValue result = toJS(lexicalGlobalObject, throwScope, impl.detail(*jsCast(&lexicalGlobalObject))); - RETURN_IF_EXCEPTION(throwScope, { }); + RETURN_IF_EXCEPTION(throwScope, {}); thisObject.m_detail.set(JSC::getVM(&lexicalGlobalObject), &thisObject, result); return result; } -JSC_DEFINE_CUSTOM_GETTER(jsPerformanceMeasure_detail, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(jsPerformanceMeasure_detail, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { return IDLAttribute::get(*lexicalGlobalObject, thisValue, attributeName); } JSC::GCClient::IsoSubspace* JSPerformanceMeasure::subspaceForImpl(JSC::VM& vm) { - return WebCore::subspaceForImpl(vm, - [] (auto& spaces) { return spaces.m_clientSubspaceForPerformanceMeasure.get(); }, - [] (auto& spaces, auto&& space) { spaces.m_clientSubspaceForPerformanceMeasure = std::forward(space); }, - [] (auto& spaces) { return spaces.m_subspaceForPerformanceMeasure.get(); }, - [] (auto& spaces, auto&& space) { spaces.m_subspaceForPerformanceMeasure = std::forward(space); } - ); + return WebCore::subspaceForImpl( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForPerformanceMeasure.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForPerformanceMeasure = std::forward(space); }, + [](auto& spaces) { return spaces.m_subspaceForPerformanceMeasure.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForPerformanceMeasure = std::forward(space); }); } template @@ -198,9 +196,8 @@ void JSPerformanceMeasure::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } - } diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserver.cpp b/src/bun.js/bindings/webcore/JSPerformanceObserver.cpp index 9068241421..f9eb3bf9f0 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceObserver.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceObserver.cpp @@ -365,7 +365,7 @@ void JSPerformanceObserver::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp b/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp index 797d414656..80a4a0e24c 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp @@ -245,7 +245,7 @@ void JSPerformanceObserverEntryList::analyzeHeap(JSCell* cell, HeapAnalyzer& ana auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSPerformanceTiming.cpp b/src/bun.js/bindings/webcore/JSPerformanceTiming.cpp index 9c2240cb8e..6e5fcc303b 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceTiming.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceTiming.cpp @@ -573,7 +573,7 @@ void JSPerformanceTiming::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/JSWorker.cpp b/src/bun.js/bindings/webcore/JSWorker.cpp index 968798e706..15c77eb244 100644 --- a/src/bun.js/bindings/webcore/JSWorker.cpp +++ b/src/bun.js/bindings/webcore/JSWorker.cpp @@ -574,7 +574,7 @@ void JSWorker::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast(cell); analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url "_s + thisObject->scriptExecutionContext()->url().string()); + analyzer.setLabelForCell(cell, makeString("url "_s, thisObject->scriptExecutionContext()->url().string())); Base::analyzeHeap(cell, analyzer); } diff --git a/src/bun.js/bindings/webcore/SerializedScriptValue.cpp b/src/bun.js/bindings/webcore/SerializedScriptValue.cpp index e3843c0760..4510a19590 100644 --- a/src/bun.js/bindings/webcore/SerializedScriptValue.cpp +++ b/src/bun.js/bindings/webcore/SerializedScriptValue.cpp @@ -2573,7 +2573,9 @@ SerializationReturnCode CloneSerializer::serialize(JSValue in) JSMap* inMap = jsCast(inValue); if (!startMap(inMap)) break; - JSMapIterator* iterator = JSMapIterator::create(vm, m_lexicalGlobalObject->mapIteratorStructure(), inMap, IterationKind::Entries); + JSMapIterator* iterator = JSMapIterator::create(m_lexicalGlobalObject, m_lexicalGlobalObject->mapIteratorStructure(), inMap, IterationKind::Entries); + if (UNLIKELY(scope.exception())) + return SerializationReturnCode::ExistingExceptionError; m_gcBuffer.appendWithCrashOnOverflow(inMap); m_gcBuffer.appendWithCrashOnOverflow(iterator); mapIteratorStack.append(iterator); @@ -2619,7 +2621,9 @@ SerializationReturnCode CloneSerializer::serialize(JSValue in) JSSet* inSet = jsCast(inValue); if (!startSet(inSet)) break; - JSSetIterator* iterator = JSSetIterator::create(vm, m_lexicalGlobalObject->setIteratorStructure(), inSet, IterationKind::Keys); + JSSetIterator* iterator = JSSetIterator::create(m_lexicalGlobalObject, m_lexicalGlobalObject->setIteratorStructure(), inSet, IterationKind::Keys); + if (UNLIKELY(scope.exception())) + return SerializationReturnCode::ExistingExceptionError; m_gcBuffer.appendWithCrashOnOverflow(inSet); m_gcBuffer.appendWithCrashOnOverflow(iterator); setIteratorStack.append(iterator); diff --git a/src/bun.js/bindings/webcore/Worker.cpp b/src/bun.js/bindings/webcore/Worker.cpp index 14b4d3c5f7..7ab16bf75c 100644 --- a/src/bun.js/bindings/webcore/Worker.cpp +++ b/src/bun.js/bindings/webcore/Worker.cpp @@ -59,7 +59,6 @@ #include #include #include "MessageEvent.h" -#include #include "BunWorkerGlobalScope.h" #include "CloseEvent.h" #include "JSMessagePort.h" diff --git a/src/codegen/generate-classes.ts b/src/codegen/generate-classes.ts index 63efacf89b..61161c3f93 100644 --- a/src/codegen/generate-classes.ts +++ b/src/codegen/generate-classes.ts @@ -1474,7 +1474,7 @@ void ${name}::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = jsCast<${name}*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + // analyzer.setLabelForCell(cell, makeString("url ", thisObject->scriptExecutionContext()->url().string())); } Base::analyzeHeap(cell, analyzer); } diff --git a/src/codegen/generate-jssink.ts b/src/codegen/generate-jssink.ts index 9288da8fb9..69e0699164 100644 --- a/src/codegen/generate-jssink.ts +++ b/src/codegen/generate-jssink.ts @@ -713,7 +713,7 @@ void ${className}::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) if (void* wrapped = thisObject->wrapped()) { analyzer.setWrappedObjectForCell(cell, wrapped); // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + // analyzer.setLabelForCell(cell, makeString("url ", thisObject->scriptExecutionContext()->url().string())); } Base::analyzeHeap(cell, analyzer); } @@ -724,7 +724,7 @@ void ${controller}::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) if (void* wrapped = thisObject->wrapped()) { analyzer.setWrappedObjectForCell(cell, wrapped); // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + // analyzer.setLabelForCell(cell, makeString("url ", thisObject->scriptExecutionContext()->url().string())); } Base::analyzeHeap(cell, analyzer); } diff --git a/src/generated_versions_list.zig b/src/generated_versions_list.zig index 980316a8f7..881119ea87 100644 --- a/src/generated_versions_list.zig +++ b/src/generated_versions_list.zig @@ -4,7 +4,7 @@ pub const boringssl = "29a2cd359458c9384694b75456026e4b57e3e567"; pub const libarchive = "898dc8319355b7e985f68a9819f182aaed61b53a"; pub const mimalloc = "4c283af60cdae205df5a872530c77e2a6a307d43"; pub const picohttpparser = "066d2b1e9ab820703db0837a7255d92d30f0c9f5"; -pub const webkit = "615e8585f96aa718b0f5158210259b83fe8440ea"; +pub const webkit = "c61accd7316919f65b050f8448d5fbf52202268a"; pub const zig = @import("std").fmt.comptimePrint("{}", .{@import("builtin").zig_version}); pub const zlib = "886098f3f339617b4243b286f5ed364b9989e245"; pub const tinycc = "ab631362d839333660a265d3084d8ff060b96753"; diff --git a/src/js/internal/util/inspect.js b/src/js/internal/util/inspect.js index 4bfc829bda..f4b3a12282 100644 --- a/src/js/internal/util/inspect.js +++ b/src/js/internal/util/inspect.js @@ -2637,7 +2637,7 @@ function previewEntries(val, isIterator = false) { const iteratedObject = $getInternalField(val, 1 /*iteratorFieldIteratedObject*/); // for Maps: 0 = keys, 1 = values, 2 = entries // for Sets: 1 = keys|values, 2 = entries - const kind = $getInternalField(val, 2 /*iteratorFieldKind*/); + const kind = $getInternalField(val, 3 /*iteratorFieldKind*/); const isEntries = kind === 2; // TODO(bun): improve performance by not using Array.from and instead using the iterator directly to only get the first // few entries which will actually be displayed (this requires changing some logic in the call sites of this function)