From a29f81f603c05e080b54f8e1330575362c6579d5 Mon Sep 17 00:00:00 2001 From: titzer Date: Mon, 7 Dec 2015 05:39:13 -0800 Subject: [PATCH] Add an --expose-wasm flag. This adds a runtime flag that controls whether the WASM object is exposed to JavaScript. While currently guarded by the V8_WASM build-time flag, after landing in V8 the build-time flag will be removed, leaving only this new runtime flag. R=mstarzinger@chromium.org BUG= Review URL: https://codereview.chromium.org/1507623002 Cr-Commit-Position: refs/heads/master@{#32657} --- src/bootstrapper.cc | 4 +++- src/flag-definitions.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 26857502da..b65af08228 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -2657,7 +2657,9 @@ bool Genesis::InstallSpecialObjects(Handle native_context) { } #if defined(V8_WASM) - WasmJs::Install(isolate, global); + if (FLAG_expose_wasm) { + WasmJs::Install(isolate, global); + } #endif return true; diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 3ad21bf2fc..b6312b3e76 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -465,6 +465,7 @@ DEFINE_BOOL(trace_turbo_escape, false, "enable tracing in escape analysis") #if defined(V8_WASM) // Flags for native WebAssembly. +DEFINE_BOOL(expose_wasm, true, "expose WASM interface to JavaScript") DEFINE_BOOL(trace_wasm_decoder, false, "trace decoding of wasm code") DEFINE_BOOL(trace_wasm_decode_time, false, "trace decoding time of wasm code") DEFINE_BOOL(trace_wasm_compiler, false, "trace compiling of wasm code")