Skip to content

Commit 25430fd

Browse files
addaleaxjasnell
authored andcommitted
v8: backport pieces from 99743ad460e
Backport new virtual methods from 99743ad460e (“[wasm] Transferrable modules”). Ref: https://codereview.chromium.org/2748473004 Ref: v8/v8@99743ad460e PR-URL: #12875 Reviewed-By: James M Snell <[email protected]>
1 parent 385499c commit 25430fd

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

deps/v8/include/v8.h

+10
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ class Private;
108108
class Uint32;
109109
class Utils;
110110
class Value;
111+
class WasmCompiledModule;
111112
template <class T> class Local;
112113
template <class T>
113114
class MaybeLocal;
@@ -1707,6 +1708,8 @@ class V8_EXPORT ValueSerializer {
17071708
virtual Maybe<uint32_t> GetSharedArrayBufferId(
17081709
Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer);
17091710

1711+
virtual Maybe<uint32_t> GetWasmModuleTransferId(
1712+
Isolate* isolate, Local<WasmCompiledModule> module);
17101713
/*
17111714
* Allocates memory for the buffer of at least the size provided. The actual
17121715
* size (which may be greater or equal) is written to |actual_size|. If no
@@ -1817,6 +1820,13 @@ class V8_EXPORT ValueDeserializer {
18171820
* MaybeLocal<Object>() returned.
18181821
*/
18191822
virtual MaybeLocal<Object> ReadHostObject(Isolate* isolate);
1823+
1824+
/*
1825+
* Get a WasmCompiledModule given a transfer_id previously provided
1826+
* by ValueSerializer::GetWasmModuleTransferId
1827+
*/
1828+
virtual MaybeLocal<WasmCompiledModule> GetWasmModuleFromId(
1829+
Isolate* isolate, uint32_t transfer_id);
18201830
};
18211831

18221832
ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size);

deps/v8/src/api.cc

+14
Original file line numberDiff line numberDiff line change
@@ -3119,6 +3119,11 @@ Maybe<uint32_t> ValueSerializer::Delegate::GetSharedArrayBufferId(
31193119
return Nothing<uint32_t>();
31203120
}
31213121

3122+
Maybe<uint32_t> ValueSerializer::Delegate::GetWasmModuleTransferId(
3123+
Isolate* v8_isolate, Local<WasmCompiledModule> module) {
3124+
return Nothing<uint32_t>();
3125+
}
3126+
31223127
void* ValueSerializer::Delegate::ReallocateBufferMemory(void* old_buffer,
31233128
size_t size,
31243129
size_t* actual_size) {
@@ -3207,6 +3212,15 @@ MaybeLocal<Object> ValueDeserializer::Delegate::ReadHostObject(
32073212
return MaybeLocal<Object>();
32083213
}
32093214

3215+
MaybeLocal<WasmCompiledModule> ValueDeserializer::Delegate::GetWasmModuleFromId(
3216+
Isolate* v8_isolate, uint32_t id) {
3217+
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
3218+
isolate->ScheduleThrow(*isolate->factory()->NewError(
3219+
isolate->error_function(),
3220+
i::MessageTemplate::kDataCloneDeserializationError));
3221+
return MaybeLocal<WasmCompiledModule>();
3222+
}
3223+
32103224
struct ValueDeserializer::PrivateData {
32113225
PrivateData(i::Isolate* i, i::Vector<const uint8_t> data, Delegate* delegate)
32123226
: isolate(i), deserializer(i, data, delegate) {}

0 commit comments

Comments
 (0)