Skip to content

Commit 6b51ac3

Browse files
bzoznodejs-ci
authored andcommitted
deps: fix addons compilation with VS2013
VS2013 does not support defaulting move constructor and assignment operator. This adds explicit definitions of those methods for two classes. This fix is required because we still support building addons with VS2013 and the incompatibility is in v8.h. Fixes: #4 PR-URL: nodejs/node#13263 Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent abb8514 commit 6b51ac3

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

deps/v8/include/v8.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -4161,10 +4161,12 @@ class V8_EXPORT WasmCompiledModule : public Object {
41614161
// supports move semantics, and does not support copy semantics.
41624162
class TransferrableModule final {
41634163
public:
4164-
TransferrableModule(TransferrableModule&& src) = default;
4164+
TransferrableModule(TransferrableModule&& src)
4165+
: compiled_code(std::move(src.compiled_code)),
4166+
wire_bytes(std::move(src.wire_bytes)) {}
41654167
TransferrableModule(const TransferrableModule& src) = delete;
41664168

4167-
TransferrableModule& operator=(TransferrableModule&& src) = default;
4169+
TransferrableModule& operator=(TransferrableModule&& src);
41684170
TransferrableModule& operator=(const TransferrableModule& src) = delete;
41694171

41704172
private:
@@ -4277,9 +4279,11 @@ class V8_EXPORT WasmModuleObjectBuilder final {
42774279
// Disable copy semantics *in this implementation*. We can choose to
42784280
// relax this, albeit it's not clear why.
42794281
WasmModuleObjectBuilder(const WasmModuleObjectBuilder&) = delete;
4280-
WasmModuleObjectBuilder(WasmModuleObjectBuilder&&) = default;
4282+
WasmModuleObjectBuilder(WasmModuleObjectBuilder&& src)
4283+
: received_buffers_(std::move(src.received_buffers_)),
4284+
total_size_(src.total_size_) {}
42814285
WasmModuleObjectBuilder& operator=(const WasmModuleObjectBuilder&) = delete;
4282-
WasmModuleObjectBuilder& operator=(WasmModuleObjectBuilder&&) = default;
4286+
WasmModuleObjectBuilder& operator=(WasmModuleObjectBuilder&&);
42834287

42844288
std::vector<Buffer> received_buffers_;
42854289
size_t total_size_ = 0;

deps/v8/src/api.cc

+15
Original file line numberDiff line numberDiff line change
@@ -7807,6 +7807,14 @@ Local<String> WasmCompiledModule::GetWasmWireBytes() {
78077807
return Local<String>::Cast(Utils::ToLocal(wire_bytes));
78087808
}
78097809

7810+
WasmCompiledModule::TransferrableModule&
7811+
WasmCompiledModule::TransferrableModule::operator=(
7812+
TransferrableModule&& src) {
7813+
compiled_code = std::move(src.compiled_code);
7814+
wire_bytes = std::move(src.wire_bytes);
7815+
return *this;
7816+
}
7817+
78107818
// Currently, wasm modules are bound, both to Isolate and to
78117819
// the Context they were created in. The currently-supported means to
78127820
// decontextualize and then re-contextualize a module is via
@@ -7978,6 +7986,13 @@ MaybeLocal<WasmCompiledModule> WasmModuleObjectBuilder::Finish() {
79787986
return WasmCompiledModule::Compile(isolate_, wire_bytes.get(), total_size_);
79797987
}
79807988

7989+
WasmModuleObjectBuilder&
7990+
WasmModuleObjectBuilder::operator=(WasmModuleObjectBuilder&& src) {
7991+
received_buffers_ = std::move(src.received_buffers_);
7992+
total_size_ = src.total_size_;
7993+
return *this;
7994+
}
7995+
79817996
// static
79827997
v8::ArrayBuffer::Allocator* v8::ArrayBuffer::Allocator::NewDefaultAllocator() {
79837998
return new ArrayBufferAllocator();

0 commit comments

Comments
 (0)