Skip to content

Commit

Permalink
deps: fix v8 compilation with vs2013
Browse files Browse the repository at this point in the history
VS2013 does not support defaulting move constructor and assignment
operator. This adds explicit definitions of those methods for two
classes.

Fixes: nodejs/node-v8#4
  • Loading branch information
bzoz committed May 23, 2017
1 parent 2f8c37b commit 27fb4bb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
12 changes: 8 additions & 4 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -4057,10 +4057,12 @@ class V8_EXPORT WasmCompiledModule : public Object {
// supports move semantics, and does not support copy semantics.
class TransferrableModule final {
public:
TransferrableModule(TransferrableModule&& src) = default;
TransferrableModule(TransferrableModule&& src)
: compiled_code(std::move(src.compiled_code)),
wire_bytes(std::move(src.wire_bytes)) {}
TransferrableModule(const TransferrableModule& src) = delete;

TransferrableModule& operator=(TransferrableModule&& src) = default;
TransferrableModule& operator=(TransferrableModule&& src);
TransferrableModule& operator=(const TransferrableModule& src) = delete;

private:
Expand Down Expand Up @@ -4133,9 +4135,11 @@ class V8_EXPORT WasmModuleObjectBuilder final {
// Disable copy semantics *in this implementation*. We can choose to
// relax this, albeit it's not clear why.
WasmModuleObjectBuilder(const WasmModuleObjectBuilder&) = delete;
WasmModuleObjectBuilder(WasmModuleObjectBuilder&&) = default;
WasmModuleObjectBuilder(WasmModuleObjectBuilder&& src)
: received_buffers_(std::move(src.received_buffers_)),
total_size_(src.total_size_) {}
WasmModuleObjectBuilder& operator=(const WasmModuleObjectBuilder&) = delete;
WasmModuleObjectBuilder& operator=(WasmModuleObjectBuilder&&) = default;
WasmModuleObjectBuilder& operator=(WasmModuleObjectBuilder&&);

std::vector<Buffer> received_buffers_;
size_t total_size_ = 0;
Expand Down
15 changes: 15 additions & 0 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7650,6 +7650,14 @@ Local<String> WasmCompiledModule::GetWasmWireBytes() {
return Local<String>::Cast(Utils::ToLocal(wire_bytes));
}

WasmCompiledModule::TransferrableModule&
WasmCompiledModule::TransferrableModule::operator=(
TransferrableModule&& src) {
compiled_code = std::move(src.compiled_code);
wire_bytes = std::move(src.wire_bytes);
return *this;
}

// Currently, wasm modules are bound, both to Isolate and to
// the Context they were created in. The currently-supported means to
// decontextualize and then re-contextualize a module is via
Expand Down Expand Up @@ -7763,6 +7771,13 @@ MaybeLocal<WasmCompiledModule> WasmModuleObjectBuilder::Finish() {
return WasmCompiledModule::Compile(isolate_, wire_bytes.get(), total_size_);
}

WasmModuleObjectBuilder&
WasmModuleObjectBuilder::operator=(WasmModuleObjectBuilder&& src) {
received_buffers_ = std::move(src.received_buffers_);
total_size_ = src.total_size_;
return *this;
}

// static
v8::ArrayBuffer::Allocator* v8::ArrayBuffer::Allocator::NewDefaultAllocator() {
return new ArrayBufferAllocator();
Expand Down

0 comments on commit 27fb4bb

Please sign in to comment.