Skip to content

Commit

Permalink
3035091: [rab/gsab] Fix gsab maxByteLength after transferring to worker
Browse files Browse the repository at this point in the history
Adds a patch to v8 to disable a DCHECK that is also firing on node streams
in child processes.

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3035091
  • Loading branch information
VerteDinde committed Jul 30, 2021
1 parent eab5d46 commit 5ea1a78
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/v8/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export_symbols_needed_for_windows_build.patch
workaround_an_undefined_symbol_error.patch
do_not_export_private_v8_symbols_on_windows.patch
fix_build_deprecated_attirbute_for_older_msvc_versions.patch
fix_disable_implies_dcheck_for_node_stream_array_buffers.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: VerteDinde <khammond@slack-corp.com>
Date: Thu, 29 Jul 2021 17:05:32 -0700
Subject: fix: disable implies dcheck for node stream array buffers

Added in this CL: https://chromium-review.googlesource.com/c/v8/v8/+/3035091

This commit was added in preparation for ResizableArrayBuffers
and GrowableSharedArrayBuffer. If a buffer is not resizable and
has a larger max_byte_length than byte_length, we throw.

However, the check also catches on Node stream buffers, which
on readStream will slowly fill their byte length up to the
maximum length. Streams do not yet have the resizable
property.

This patch can be removed when streams support rab/gsab, or
when support is synchronized across both v8 and node.

diff --git a/src/objects/js-array-buffer.cc b/src/objects/js-array-buffer.cc
index 583297e20746bf1f63a8646745cb34dc2d841338..8004ffbd2803a0c5dff978e087edc70d34d41713 100644
--- a/src/objects/js-array-buffer.cc
+++ b/src/objects/js-array-buffer.cc
@@ -73,9 +73,9 @@ void JSArrayBuffer::Attach(std::shared_ptr<BackingStore> backing_store) {
DCHECK_NOT_NULL(backing_store);
DCHECK_EQ(is_shared(), backing_store->is_shared());
DCHECK_EQ(is_resizable(), backing_store->is_resizable());
- DCHECK_IMPLIES(
- !backing_store->is_wasm_memory() && !backing_store->is_resizable(),
- backing_store->byte_length() == backing_store->max_byte_length());
+ // DCHECK_IMPLIES(
+ // !backing_store->is_wasm_memory() && !backing_store->is_resizable(),
+ // backing_store->byte_length() == backing_store->max_byte_length());
DCHECK(!was_detached());
Isolate* isolate = GetIsolate();
set_backing_store(isolate, backing_store->buffer_start());

0 comments on commit 5ea1a78

Please sign in to comment.