Skip to content

Commit

Permalink
Linking issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed Mar 20, 2023
1 parent f83333e commit 8ba37d3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
9 changes: 9 additions & 0 deletions src/wasm-v8-lowlevel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@
#include "wasm/wasm-objects-inl.h"
#include "wasm/wasm-serialization.h"

#include "flags/flags.h"


namespace v8 {
namespace wasm {


// Initialization

void flags_init() {
v8::internal::v8_flags.expose_gc = true;
}


// Objects

auto object_isolate(v8::Local<v8::Object> obj) -> v8::Isolate* {
Expand Down
4 changes: 3 additions & 1 deletion src/wasm-v8-lowlevel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace v8 {
namespace wasm {

void flags_init();

auto object_isolate(v8::Local<v8::Object>) -> v8::Isolate*;
auto object_isolate(const v8::Persistent<v8::Object>&) -> v8::Isolate*;

Expand Down Expand Up @@ -42,7 +44,7 @@ auto module_binary_size(v8::Local<v8::Object> module) -> size_t;
auto module_binary(v8::Local<v8::Object> module) -> const char*;
auto module_serialize_size(v8::Local<v8::Object> module) -> size_t;
auto module_serialize(v8::Local<v8::Object> module, char*, size_t) -> bool;
auto module_deserialize(v8::Isolate*, const char*, size_t, const char*, size_t) -> v8::MaybeLocal<v8::Object>;
auto module_deserialize(v8::Isolate*, const uint8_t*, size_t, const uint8_t*, size_t) -> v8::MaybeLocal<v8::Object>;

auto instance_module(v8::Local<v8::Object> instance) -> v8::Local<v8::Object>;
auto instance_exports(v8::Local<v8::Object> instance) -> v8::Local<v8::Object>;
Expand Down
21 changes: 3 additions & 18 deletions src/wasm-v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ namespace wasm_v8 {
using namespace v8::wasm;
}

namespace v8 {
namespace internal {
extern bool FLAG_expose_gc;
extern bool FLAG_experimental_wasm_bigint;
extern bool FLAG_experimental_wasm_mv;
extern bool FLAG_experimental_wasm_anyref;
extern bool FLAG_experimental_wasm_bulk_memory;
extern bool FLAG_experimental_wasm_return_call;
}
}

namespace wasm {

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -288,12 +277,7 @@ void Engine::destroy() {
}

auto Engine::make(own<Config>&& config) -> own<Engine> {
v8::internal::FLAG_expose_gc = true;
v8::internal::FLAG_experimental_wasm_bigint = true;
v8::internal::FLAG_experimental_wasm_mv = true;
v8::internal::FLAG_experimental_wasm_anyref = true;
v8::internal::FLAG_experimental_wasm_bulk_memory = true;
v8::internal::FLAG_experimental_wasm_return_call = true;
v8::wasm::flags_init();
// v8::V8::SetFlagsFromCommandLine(&argc, const_cast<char**>(argv), false);
auto engine = new(std::nothrow) EngineImpl;
if (!engine) return own<Engine>();
Expand Down Expand Up @@ -1454,8 +1438,9 @@ auto Module::deserialize(Store* store_abs, const vec<byte_t>& serialized) -> own
auto binary_size = wasm::bin::u64(ptr);
auto size_size = ptr - serialized.get();
auto serial_size = serialized.size() - size_size - binary_size;
auto ptr2 = reinterpret_cast<const uint8_t*>(ptr);
auto maybe_obj = wasm_v8::module_deserialize(
isolate, ptr, binary_size, ptr + binary_size, serial_size);
isolate, ptr2, binary_size, ptr2 + binary_size, serial_size);
if (maybe_obj.IsEmpty()) return nullptr;
return RefImpl<Module>::make(store, maybe_obj.ToLocalChecked());
}
Expand Down

0 comments on commit 8ba37d3

Please sign in to comment.