From 84326fc49bfd02fc7ac0b4ed14391dc2fa9c4dee Mon Sep 17 00:00:00 2001 From: "Ben L. Titzer" Date: Wed, 17 Jan 2018 15:46:27 +0100 Subject: [PATCH] [wasm] Hide SyncValidate() behind WasmEngine interface. This is the first in a series of CLs that will separate the JS API from the implementation of WebAssembly by bottlenecking interactions through the WasmEngine. In the long run, the JS API and much of V8 should rely only on the WasmEngine interface, which will represent the "public interface" for embedding WebAssembly. Next: hide compilation-related methods behind WasmEngine. Bug: v8:7316 Change-Id: I93404f0dc8a201ae99d30b4c1ca34606e3dddbca Reviewed-on: https://chromium-review.googlesource.com/868590 Commit-Queue: Ben Titzer Reviewed-by: Clemens Hammacher Cr-Commit-Position: refs/heads/master@{#50660} --- BUILD.gn | 1 + src/v8.gyp | 1 + src/wasm/module-compiler.cc | 7 ------- src/wasm/module-compiler.h | 3 --- src/wasm/wasm-engine.cc | 23 +++++++++++++++++++++++ src/wasm/wasm-engine.h | 4 +++- src/wasm/wasm-js.cc | 8 +++----- test/fuzzer/wasm-fuzzer-common.cc | 4 +++- 8 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 src/wasm/wasm-engine.cc diff --git a/BUILD.gn b/BUILD.gn index 3e6575ff3f..5b414f7609 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -2136,6 +2136,7 @@ v8_source_set("v8_base") { "src/wasm/wasm-code-wrapper.h", "src/wasm/wasm-constants.h", "src/wasm/wasm-debug.cc", + "src/wasm/wasm-engine.cc", "src/wasm/wasm-engine.h", "src/wasm/wasm-external-refs.cc", "src/wasm/wasm-external-refs.h", diff --git a/src/v8.gyp b/src/v8.gyp index 802baeb687..218b173af2 100644 --- a/src/v8.gyp +++ b/src/v8.gyp @@ -1486,6 +1486,7 @@ 'wasm/wasm-code-wrapper.h', 'wasm/wasm-constants.h', 'wasm/wasm-debug.cc', + 'wasm/wasm-engine.cc', 'wasm/wasm-engine.h', 'wasm/wasm-external-refs.cc', 'wasm/wasm-external-refs.h', diff --git a/src/wasm/module-compiler.cc b/src/wasm/module-compiler.cc index db9ea1a8eb..9b50d7cc9b 100644 --- a/src/wasm/module-compiler.cc +++ b/src/wasm/module-compiler.cc @@ -533,13 +533,6 @@ class SetOfNativeModuleModificationScopes final { } // namespace -bool SyncValidate(Isolate* isolate, const ModuleWireBytes& bytes) { - if (bytes.start() == nullptr || bytes.length() == 0) return false; - ModuleResult result = SyncDecodeWasmModule(isolate, bytes.start(), - bytes.end(), true, kWasmOrigin); - return result.ok(); -} - MaybeHandle SyncCompileTranslatedAsmJs( Isolate* isolate, ErrorThrower* thrower, const ModuleWireBytes& bytes, Handle