Skip to content
Closed
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
Empty file modified githooks/pre-commit
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions src/workerd/jsg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ wd_cc_library(
src = f,
local_defines = ["JSG_IMPLEMENTATION"],
deps = [":jsg"],
size = "enormous",
) for f in glob(
["*-test.c++"],
exclude = [
Expand Down
375 changes: 198 additions & 177 deletions src/workerd/jsg/fast-api-test.c++

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/workerd/jsg/fast-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ concept FastApiPrimitive = kj::isSameType<T, void>() || kj::isSameType<T, bool>(

// Helper to determine if a type can be used as a parameter in V8 Fast API
template <typename T>
concept FastApiParam = !isFunctionCallbackInfo<kj::RemoveConst<kj::Decay<T>>> &&
!isKjPromise<kj::RemoveConst<kj::Decay<T>>> && !isJsgPromise<kj::RemoveConst<kj::Decay<T>>>;
concept FastApiParam = !isFunctionCallbackInfo<kj::RemoveConst<kj::Decay<T>>>;

// Helper to determine if a type can be used as a return value in a V8 Fast API
template <typename T>
Expand Down Expand Up @@ -106,6 +105,8 @@ struct FastApiJSGToV8 {
using value = v8::Local<v8::Value>;
};

// TODO(soon): Address this.
// Removing v8::FastOneByteString will fix GC related issues.
template <typename T>
requires StringLike<kj::RemoveConst<kj::Decay<T>>>
struct FastApiJSGToV8<T> {
Expand Down
1 change: 1 addition & 0 deletions src/workerd/jsg/promise.h
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ class PromiseWrapper {
if (handle->IsPromise()) {
auto promise = handle.As<v8::Promise>();
if constexpr (!isVoid<T>() && !isV8Ref<T>()) {
js.v8Isolate->RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCollection);
// Add a .then() to unwrap the promise's resolution (i.e. convert it from JS to C++).
// Note that we don't need to handle the rejection case here as there is no wrapping
// applied to exception values, so we just let it propagate through.
Expand Down
2 changes: 2 additions & 0 deletions src/workerd/jsg/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ class StringWrapper {
template <StringLike T>
kj::Maybe<T> tryUnwrap(
Lock& js, v8::Local<v8::Context> context, const v8::FastOneByteString& handle, T*) {
KJ_DBG("Converting FAST ONE BYTE STRING");
// js.v8Isolate->RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCollection);
size_t utf8_length = simdutf::utf8_length_from_latin1(handle.data, handle.length);
kj::Array<char> buf = kj::heapArray<char>(utf8_length + 1);
buf[utf8_length] = '\0';
Expand Down
Loading