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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Back out Error.cause serialization (#192, #194) pending a performance-neutral design.

- Back out Buffer trailer reservation (#195) for its small-payload serialization cost, pending a design that charges only large-Buffer paths.

- Avoid an extra payload copy when structured cloning or messaging a Buffer or ArrayBuffer inside a container, without changing serialized bytes.

- Sync oven-sh/bun through `ad4089bf49d9f4c3ab7c8d95a58f3e0f0f186054`, including lint, format, binding, WebSocket and SQL updates, while retaining the fork runtime and CI contracts.
Expand Down
15 changes: 2 additions & 13 deletions src/jsc/bindings/webcore/SerializedScriptValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,6 @@ class CloneSerializer : public CloneBase {
{
if (!startObjectInternal(object))
return false;
m_pendingContainerBytes += sizeof(TerminatorTag);
write(ObjectTag);
return true;
}
Expand All @@ -846,7 +845,6 @@ class CloneSerializer : public CloneBase {
if (!startObjectInternal(array))
return false;

m_pendingContainerBytes += sizeof(TerminatorTag);
unsigned length = array->length();
write(ArrayTag);
write(length);
Expand All @@ -858,7 +856,6 @@ class CloneSerializer : public CloneBase {
if (!startObjectInternal(set))
return false;

m_pendingContainerBytes += sizeof(uint8_t) + sizeof(TerminatorTag);
write(SetObjectTag);
return true;
}
Expand All @@ -868,15 +865,12 @@ class CloneSerializer : public CloneBase {
if (!startObjectInternal(map))
return false;

m_pendingContainerBytes += sizeof(uint8_t) + sizeof(TerminatorTag);
write(MapObjectTag);
return true;
}

void endObject()
{
ASSERT(m_pendingContainerBytes >= sizeof(TerminatorTag));
m_pendingContainerBytes -= sizeof(TerminatorTag);
write(TerminatorTag);
}

Expand Down Expand Up @@ -1315,7 +1309,7 @@ class CloneSerializer : public CloneBase {

if (arrayBuffer->isResizableOrGrowableShared()) {
uint64_t byteLength = arrayBuffer->byteLength();
if (!m_buffer.tryReserveCapacity(static_cast<uint64_t>(m_buffer.size()) + sizeof(uint8_t) + sizeof(uint64_t) * 2 + byteLength + m_pendingContainerBytes)) [[unlikely]] {
if (!m_buffer.tryReserveCapacity(static_cast<uint64_t>(m_buffer.size()) + sizeof(uint8_t) + sizeof(uint64_t) * 2 + byteLength)) [[unlikely]] {
code = SerializationReturnCode::DataCloneError;
return true;
}
Expand All @@ -1328,9 +1322,7 @@ class CloneSerializer : public CloneBase {
}

uint64_t byteLength = arrayBuffer->byteLength();
// Reserve mandatory container trailers before copying the payload so
// closing the containers cannot copy the payload again.
if (!m_buffer.tryReserveCapacity(static_cast<uint64_t>(m_buffer.size()) + sizeof(uint8_t) + sizeof(uint64_t) + byteLength + m_pendingContainerBytes)) [[unlikely]] {
if (!m_buffer.tryReserveCapacity(static_cast<uint64_t>(m_buffer.size()) + sizeof(uint8_t) + sizeof(uint64_t) + byteLength)) [[unlikely]] {
code = SerializationReturnCode::DataCloneError;
return true;
}
Expand Down Expand Up @@ -1988,7 +1980,6 @@ class CloneSerializer : public CloneBase {
}
}
#endif
unsigned m_pendingContainerBytes { 0 };
ObjectPool m_objectPool;
ObjectPool m_transferredMessagePorts;
ObjectPool m_transferredArrayBuffers;
Expand Down Expand Up @@ -2173,7 +2164,6 @@ SerializationReturnCode CloneSerializer::serialize(JSValue in)
mapIteratorStack.removeLast();
RETURN_IF_EXCEPTION(scope, SerializationReturnCode::ExistingExceptionError);
// Keep the legacy property-section markers, but clone only Map entries.
m_pendingContainerBytes -= sizeof(uint8_t);
write(NonMapPropertiesTag);
endObject();
inputObjectStack.removeLast();
Expand Down Expand Up @@ -2220,7 +2210,6 @@ SerializationReturnCode CloneSerializer::serialize(JSValue in)
if (!hasNext) {
setIteratorStack.removeLast();
// Older readers still expect an empty own-property section after Set entries.
m_pendingContainerBytes -= sizeof(uint8_t);
write(NonSetPropertiesTag);
endObject();
inputObjectStack.removeLast();
Expand Down
Loading