Commit 4e0ac2ed authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[no-wasm] Remove wasm-js

This CL removes wasm-js.cc from compilation if
v8_enable_webassembly=false. In order to do so, an alternative
implementation of {v8::WasmStreaming} has to be provided, because the
public API should stay unchanged. The only path to obtain a
{v8::WasmStreaming} object is via {v8::WasmStreaming::Unpack}, which
will always fail if WebAssembly is not supported. Hence all methods in
{WasmStreamingImpl} are unreachable.

As a drive-by, this CL removes all includes from src/wasm in src/init
(bootstrapper.cc would have been done anyway, and v8.cc is just a few
 changes).

R=jkummerow@chromium.org

Bug: v8:11238
Change-Id: Ic0638eb5cda91ec29c1c07ef400bc670c91630fb
Cq-Include-Trybots: luci.v8.try:v8_linux64_no_wasm_compile_rel
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2737300Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73234}
parent c3f9d3cd
...@@ -2993,7 +2993,6 @@ v8_header_set("v8_internal_headers") { ...@@ -2993,7 +2993,6 @@ v8_header_set("v8_internal_headers") {
"src/wasm/wasm-feature-flags.h", "src/wasm/wasm-feature-flags.h",
"src/wasm/wasm-features.h", "src/wasm/wasm-features.h",
"src/wasm/wasm-import-wrapper-cache.h", "src/wasm/wasm-import-wrapper-cache.h",
"src/wasm/wasm-js.h",
"src/wasm/wasm-linkage.h", "src/wasm/wasm-linkage.h",
"src/wasm/wasm-module-builder.h", "src/wasm/wasm-module-builder.h",
"src/wasm/wasm-module-sourcemap.h", "src/wasm/wasm-module-sourcemap.h",
...@@ -3035,6 +3034,7 @@ v8_header_set("v8_internal_headers") { ...@@ -3035,6 +3034,7 @@ v8_header_set("v8_internal_headers") {
"src/asmjs/asm-types.h", "src/asmjs/asm-types.h",
"src/debug/debug-wasm-objects-inl.h", "src/debug/debug-wasm-objects-inl.h",
"src/debug/debug-wasm-objects.h", "src/debug/debug-wasm-objects.h",
"src/wasm/wasm-js.h",
] ]
} }
...@@ -3927,7 +3927,6 @@ v8_source_set("v8_base_without_compiler") { ...@@ -3927,7 +3927,6 @@ v8_source_set("v8_base_without_compiler") {
"src/wasm/wasm-external-refs.cc", "src/wasm/wasm-external-refs.cc",
"src/wasm/wasm-features.cc", "src/wasm/wasm-features.cc",
"src/wasm/wasm-import-wrapper-cache.cc", "src/wasm/wasm-import-wrapper-cache.cc",
"src/wasm/wasm-js.cc",
"src/wasm/wasm-module-builder.cc", "src/wasm/wasm-module-builder.cc",
"src/wasm/wasm-module-sourcemap.cc", "src/wasm/wasm-module-sourcemap.cc",
"src/wasm/wasm-module.cc", "src/wasm/wasm-module.cc",
...@@ -3949,6 +3948,7 @@ v8_source_set("v8_base_without_compiler") { ...@@ -3949,6 +3948,7 @@ v8_source_set("v8_base_without_compiler") {
"src/asmjs/asm-scanner.cc", "src/asmjs/asm-scanner.cc",
"src/asmjs/asm-types.cc", "src/asmjs/asm-types.cc",
"src/debug/debug-wasm-objects.cc", "src/debug/debug-wasm-objects.cc",
"src/wasm/wasm-js.cc",
] ]
} }
......
...@@ -10119,6 +10119,42 @@ RegisterState& RegisterState::operator=(const RegisterState& other) { ...@@ -10119,6 +10119,42 @@ RegisterState& RegisterState::operator=(const RegisterState& other) {
return *this; return *this;
} }
#if !V8_ENABLE_WEBASSEMBLY
// If WebAssembly is disabled, we still need to provide an implementation of the
// WasmStreaming API. Since {WasmStreaming::Unpack} will always fail, all
// methods are unreachable.
class WasmStreaming::WasmStreamingImpl {};
WasmStreaming::WasmStreaming(std::unique_ptr<WasmStreamingImpl>) {
UNREACHABLE();
}
WasmStreaming::~WasmStreaming() = default;
void WasmStreaming::OnBytesReceived(const uint8_t* bytes, size_t size) {
UNREACHABLE();
}
void WasmStreaming::Finish() { UNREACHABLE(); }
void WasmStreaming::Abort(MaybeLocal<Value> exception) { UNREACHABLE(); }
bool WasmStreaming::SetCompiledModuleBytes(const uint8_t* bytes, size_t size) {
UNREACHABLE();
}
void WasmStreaming::SetClient(std::shared_ptr<Client> client) { UNREACHABLE(); }
void WasmStreaming::SetUrl(const char* url, size_t length) { UNREACHABLE(); }
// static
std::shared_ptr<WasmStreaming> WasmStreaming::Unpack(Isolate* isolate,
Local<Value> value) {
FATAL("WebAssembly is disabled");
}
#endif // !V8_ENABLE_WEBASSEMBLY
namespace internal { namespace internal {
const size_t HandleScopeImplementer::kEnteredContextsOffset = const size_t HandleScopeImplementer::kEnteredContextsOffset =
......
...@@ -63,9 +63,12 @@ ...@@ -63,9 +63,12 @@
#include "src/objects/swiss-name-dictionary-inl.h" #include "src/objects/swiss-name-dictionary-inl.h"
#include "src/objects/templates.h" #include "src/objects/templates.h"
#include "src/snapshot/snapshot.h" #include "src/snapshot/snapshot.h"
#include "src/wasm/wasm-js.h"
#include "src/zone/zone-hashmap.h" #include "src/zone/zone-hashmap.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/wasm-js.h"
#endif // V8_ENABLE_WEBASSEMBLY
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -4945,6 +4948,7 @@ bool Genesis::InstallSpecialObjects(Isolate* isolate, ...@@ -4945,6 +4948,7 @@ bool Genesis::InstallSpecialObjects(Isolate* isolate,
Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit), isolate); Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit), isolate);
JSObject::AddProperty(isolate, Error, name, stack_trace_limit, NONE); JSObject::AddProperty(isolate, Error, name, stack_trace_limit, NONE);
#if V8_ENABLE_WEBASSEMBLY
if (FLAG_expose_wasm) { if (FLAG_expose_wasm) {
// Install the internal data structures into the isolate and expose on // Install the internal data structures into the isolate and expose on
// the global object. // the global object.
...@@ -4954,6 +4958,7 @@ bool Genesis::InstallSpecialObjects(Isolate* isolate, ...@@ -4954,6 +4958,7 @@ bool Genesis::InstallSpecialObjects(Isolate* isolate,
// translated to Wasm to work correctly. // translated to Wasm to work correctly.
WasmJs::Install(isolate, false); WasmJs::Install(isolate, false);
} }
#endif // V8_ENABLE_WEBASSEMBLY
return true; return true;
} }
......
...@@ -26,7 +26,10 @@ ...@@ -26,7 +26,10 @@
#include "src/profiler/heap-profiler.h" #include "src/profiler/heap-profiler.h"
#include "src/snapshot/snapshot.h" #include "src/snapshot/snapshot.h"
#include "src/tracing/tracing-category-observer.h" #include "src/tracing/tracing-category-observer.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/wasm-engine.h" #include "src/wasm/wasm-engine.h"
#endif // V8_ENABLE_WEBASSEMBLY
#if defined(V8_TARGET_OS_WIN) && defined(V8_ENABLE_SYSTEM_INSTRUMENTATION) #if defined(V8_TARGET_OS_WIN) && defined(V8_ENABLE_SYSTEM_INSTRUMENTATION)
#include "src/diagnostics/system-jit-win.h" #include "src/diagnostics/system-jit-win.h"
...@@ -50,7 +53,9 @@ bool V8::Initialize() { ...@@ -50,7 +53,9 @@ bool V8::Initialize() {
} }
void V8::TearDown() { void V8::TearDown() {
#if V8_ENABLE_WEBASSEMBLY
wasm::WasmEngine::GlobalTearDown(); wasm::WasmEngine::GlobalTearDown();
#endif // V8_ENABLE_WEBASSEMBLY
#if defined(USE_SIMULATOR) #if defined(USE_SIMULATOR)
Simulator::GlobalTearDown(); Simulator::GlobalTearDown();
#endif #endif
...@@ -157,7 +162,9 @@ void V8::InitializeOncePerProcessImpl() { ...@@ -157,7 +162,9 @@ void V8::InitializeOncePerProcessImpl() {
ElementsAccessor::InitializeOncePerProcess(); ElementsAccessor::InitializeOncePerProcess();
Bootstrapper::InitializeOncePerProcess(); Bootstrapper::InitializeOncePerProcess();
CallDescriptors::InitializeOncePerProcess(); CallDescriptors::InitializeOncePerProcess();
#if V8_ENABLE_WEBASSEMBLY
wasm::WasmEngine::InitializeOncePerProcess(); wasm::WasmEngine::InitializeOncePerProcess();
#endif // V8_ENABLE_WEBASSEMBLY
} }
void V8::InitializeOncePerProcess() { void V8::InitializeOncePerProcess() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment