Skip to content

Commit a9843a6

Browse files
committed
Set flags via the v8 API, instead of directly modifying them
Signed-off-by: Rachel Green <[email protected]>
1 parent 26969ea commit a9843a6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/v8/v8.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
#include <utility>
2727
#include <vector>
2828

29-
#include "include/proxy-wasm/limits.h"
30-
3129
#include "include/v8-version.h"
3230
#include "include/v8.h"
33-
#include "src/flags/flags.h"
31+
#include "third_party/absl/strings/str_format.h"
32+
#include "third_party/proxy_wasm_cpp_host/include/proxy-wasm/limits.h"
33+
#include "third_party/v8/include/v8-initialization.h"
3434
#include "src/wasm/c-api.h"
3535
#include "wasm-api/wasm.hh"
3636

@@ -42,10 +42,12 @@ wasm::Engine *engine() {
4242
static wasm::own<wasm::Engine> engine;
4343

4444
std::call_once(init, []() {
45-
::v8::internal::v8_flags.liftoff = false;
46-
::v8::internal::v8_flags.wasm_max_mem_pages =
47-
PROXY_WASM_HOST_MAX_WASM_MEMORY_SIZE_BYTES / PROXY_WASM_HOST_WASM_MEMORY_PAGE_SIZE_BYTES;
45+
std::string args =
46+
absl::StrFormat("--wasm_max_mem_pages=%u", PROXY_WASM_HOST_MAX_WASM_MEMORY_SIZE_BYTES /
47+
PROXY_WASM_HOST_WASM_MEMORY_PAGE_SIZE_BYTES);
48+
::v8::V8::SetFlagsFromString(args.c_str(), args.size());
4849
::v8::V8::EnableWebAssemblyTrapHandler(true);
50+
4951
engine = wasm::Engine::make();
5052
});
5153

0 commit comments

Comments
 (0)