Commit 8aee0141 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm] Remove the wasm-stream-compilation flag

In addition to a git grep I ran the
virtual/enable_wasm_streaming/http/tests/wasm_streaming/wasm_response_apis.html
layout test locally to confirm that the flag is not used in Chrome.

R=titzer@chromium.org

Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I00d013b85b585d26e50aacaeb82fb0b1ce1ff56c
Reviewed-on: https://chromium-review.googlesource.com/1049965Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53072}
parent f3745430
......@@ -4272,8 +4272,6 @@ class V8_EXPORT WasmModuleObjectBuilderStreaming final {
~WasmModuleObjectBuilderStreaming();
private:
typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> Buffer;
WasmModuleObjectBuilderStreaming(const WasmModuleObjectBuilderStreaming&) =
delete;
WasmModuleObjectBuilderStreaming(WasmModuleObjectBuilderStreaming&&) =
......@@ -4296,8 +4294,6 @@ class V8_EXPORT WasmModuleObjectBuilderStreaming final {
#else
Persistent<Promise> promise_;
#endif
std::vector<Buffer> received_buffers_;
size_t total_size_ = 0;
std::shared_ptr<internal::wasm::StreamingDecoder> streaming_decoder_;
};
......
......@@ -7514,15 +7514,13 @@ WasmModuleObjectBuilderStreaming::WasmModuleObjectBuilderStreaming(
Local<Promise::Resolver> resolver = maybe_resolver.ToLocalChecked();
promise_.Reset(isolate, resolver->GetPromise());
if (i::FLAG_wasm_stream_compilation) {
i::Handle<i::JSPromise> promise = Utils::OpenHandle(*GetPromise());
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
streaming_decoder_ =
i_isolate->wasm_engine()
->compilation_manager()
->StartStreamingCompilation(i_isolate, handle(i_isolate->context()),
promise);
}
i::Handle<i::JSPromise> promise = Utils::OpenHandle(*GetPromise());
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
streaming_decoder_ =
i_isolate->wasm_engine()
->compilation_manager()
->StartStreamingCompilation(i_isolate, handle(i_isolate->context()),
promise);
}
Local<Promise> WasmModuleObjectBuilderStreaming::GetPromise() {
......@@ -7531,38 +7529,11 @@ Local<Promise> WasmModuleObjectBuilderStreaming::GetPromise() {
void WasmModuleObjectBuilderStreaming::OnBytesReceived(const uint8_t* bytes,
size_t size) {
if (i::FLAG_wasm_stream_compilation) {
streaming_decoder_->OnBytesReceived(i::Vector<const uint8_t>(bytes, size));
return;
}
std::unique_ptr<uint8_t[]> cloned_bytes(new uint8_t[size]);
memcpy(cloned_bytes.get(), bytes, size);
received_buffers_.push_back(
Buffer(std::unique_ptr<const uint8_t[]>(
const_cast<const uint8_t*>(cloned_bytes.release())),
size));
total_size_ += size;
streaming_decoder_->OnBytesReceived(i::Vector<const uint8_t>(bytes, size));
}
void WasmModuleObjectBuilderStreaming::Finish() {
if (i::FLAG_wasm_stream_compilation) {
streaming_decoder_->Finish();
return;
}
std::unique_ptr<uint8_t[]> wire_bytes(new uint8_t[total_size_]);
uint8_t* insert_at = wire_bytes.get();
for (size_t i = 0; i < received_buffers_.size(); ++i) {
const Buffer& buff = received_buffers_[i];
memcpy(insert_at, buff.first.get(), buff.second);
insert_at += buff.second;
}
// AsyncCompile makes its own copy of the wire bytes. This inefficiency
// will be resolved when we move to true streaming compilation.
auto i_isolate = reinterpret_cast<i::Isolate*>(isolate_);
i_isolate->wasm_engine()->AsyncCompile(
i_isolate, Utils::OpenHandle(*promise_.Get(isolate_)),
{wire_bytes.get(), wire_bytes.get() + total_size_}, false);
streaming_decoder_->Finish();
}
void WasmModuleObjectBuilderStreaming::Abort(MaybeLocal<Value> exception) {
......@@ -7570,7 +7541,7 @@ void WasmModuleObjectBuilderStreaming::Abort(MaybeLocal<Value> exception) {
// The promise has already been resolved, e.g. because of a compilation
// error.
if (promise->State() != v8::Promise::kPending) return;
if (i::FLAG_wasm_stream_compilation) streaming_decoder_->Abort();
streaming_decoder_->Abort();
// If no exception value is provided, we do not reject the promise. This can
// happen when streaming compilation gets aborted when no script execution is
......
......@@ -521,12 +521,8 @@ DEFINE_BOOL(wasm_trace_serialization, false,
"trace serialization/deserialization")
DEFINE_BOOL(wasm_async_compilation, true,
"enable actual asynchronous compilation for WebAssembly.compile")
DEFINE_BOOL(wasm_stream_compilation, true,
"enable streaming compilation for WebAssembly")
DEFINE_IMPLICATION(wasm_stream_compilation, wasm_async_compilation)
DEFINE_BOOL(wasm_test_streaming, false,
"use streaming compilation instead of async compilation for tests")
DEFINE_IMPLICATION(wasm_test_streaming, wasm_stream_compilation)
// Parallel compilation confuses turbo_stats, force single threaded.
DEFINE_VALUE_IMPLICATION(turbo_stats, wasm_num_compilation_tasks, 0)
DEFINE_UINT(wasm_max_mem_pages, v8::internal::wasm::kV8MaxWasmMemoryPages,
......
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