Skip to content

Commit

Permalink
wasm: update V8 to v8.7.220.10. (#13568)
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Sikora <[email protected]>
  • Loading branch information
PiotrSikora authored Oct 30, 2020
1 parent 0441602 commit 7ab7de1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
11 changes: 7 additions & 4 deletions bazel/external/wee8.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ cc_library(
srcs = [
"libwee8.a",
],
hdrs = [
"wee8/include/v8-version.h",
"wee8/third_party/wasm-api/wasm.hh",
],
hdrs =
glob([
"wee8/include/**/*.h",
"wee8/src/**/*.h",
"wee8/third_party/wasm-api/wasm.hh",
]),
copts = [
"-Wno-range-loop-analysis",
],
defines = ["ENVOY_WASM_V8"],
includes = [
"wee8",
"wee8/include",
"wee8/third_party",
],
Expand Down
19 changes: 16 additions & 3 deletions bazel/external/wee8.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# 1. Fix linking with unbundled toolchain on macOS.
# 2. Increase VSZ limit to 4TiB (allows us to start up to 409 VMs).
# 3. Fix MSAN linking.
# 4. Fix Wasm module deserialization (http://crbug.com/v8/11024).
--- wee8/build/toolchain/gcc_toolchain.gni
+++ wee8/build/toolchain/gcc_toolchain.gni
@@ -329,6 +329,8 @@ template("gcc_toolchain") {
@@ -348,6 +348,8 @@ template("gcc_toolchain") {
# AIX does not support either -D (deterministic output) or response
# files.
command = "$ar -X64 {{arflags}} -r -c -s {{output}} {{inputs}}"
Expand All @@ -12,7 +13,7 @@
} else {
rspfile = "{{output}}.rsp"
rspfile_content = "{{inputs}}"
@@ -507,7 +509,7 @@ template("gcc_toolchain") {
@@ -543,7 +545,7 @@ template("gcc_toolchain") {

start_group_flag = ""
end_group_flag = ""
Expand Down Expand Up @@ -51,5 +52,17 @@
- is_msan && (msan_track_origins == 0 || msan_track_origins == 2)
+prebuilt_instrumented_libraries_available = false

if (use_libfuzzer && is_linux) {
if (use_libfuzzer && (is_linux || is_chromeos)) {
if (is_asan) {
--- wee8/src/wasm/module-compiler.cc
+++ wee8/src/wasm/module-compiler.cc
@@ -2901,6 +2901,9 @@ void CompilationStateImpl::InitializeCompilationProgressAfterDeserialization() {
RequiredBaselineTierField::encode(ExecutionTier::kTurbofan) |
RequiredTopTierField::encode(ExecutionTier::kTurbofan) |
ReachedTierField::encode(ExecutionTier::kTurbofan);
+ finished_events_.Add(CompilationEvent::kFinishedExportWrappers);
+ finished_events_.Add(CompilationEvent::kFinishedBaselineCompilation);
+ finished_events_.Add(CompilationEvent::kFinishedTopTierCompilation);
compilation_progress_.assign(module->num_declared_functions,
kProgressAfterDeserialization);
}
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,10 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "V8",
project_desc = "Google’s open source high-performance JavaScript and WebAssembly engine, written in C++",
project_url = "https://v8.dev",
version = "8.5.210.20",
version = "8.7.220.10",
# This archive was created using https://storage.googleapis.com/envoyproxy-wee8/wee8-archive.sh
# and contains complete checkout of V8 with all dependencies necessary to build wee8.
sha256 = "ef404643d7da6854b76b9fb9950a79a1acbd037b7a26f02c585ac379b0f7dee1",
sha256 = "f22734640e0515bc34d1ca3772513aef24374fafa44d0489d3a9a57cadec69fb",
urls = ["https://storage.googleapis.com/envoyproxy-wee8/wee8-{version}.tar.gz"],
use_category = ["dataplane_ext"],
extensions = [
Expand All @@ -664,7 +664,7 @@ REPOSITORY_LOCATIONS_SPEC = dict(
"envoy.filters.network.wasm",
"envoy.stat_sinks.wasm",
],
release_date = "2020-08-17",
release_date = "2020-10-27",
cpe = "cpe:2.3:a:google:v8:*",
),
com_googlesource_quiche = dict(
Expand Down
12 changes: 8 additions & 4 deletions test/tools/wee8_compile/wee8_compile.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// NOLINT(namespace-envoy)

#include <unistd.h>

#include <chrono>
#include <fstream>
#include <iostream>
#include <sstream>
#include <thread>
#include <vector>

#include "src/wasm/c-api.h"
#include "v8-version.h"
#include "wasm-api/wasm.hh"

Expand Down Expand Up @@ -166,8 +167,11 @@ wasm::vec<byte_t> serializeWasmModule(const char* path, const wasm::vec<byte_t>&
return wasm::vec<byte_t>::invalid();
}

// TODO(PiotrSikora): figure out how to hook the completion callback.
sleep(3);
wasm::StoreImpl* store_impl = reinterpret_cast<wasm::StoreImpl*>(store.get());
auto isolate = store_impl->isolate();
while (isolate->HasPendingBackgroundTasks()) {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}

return module->serialize();
}
Expand Down
2 changes: 1 addition & 1 deletion tools/code_format/check_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"./test/test_common/simulated_time_system.cc", "./test/test_common/simulated_time_system.h",
"./test/test_common/test_time.cc", "./test/test_common/test_time.h",
"./test/test_common/utility.cc", "./test/test_common/utility.h",
"./test/integration/integration.h")
"./test/integration/integration.h", "./test/tools/wee8_compile/wee8_compile.cc")

# Tests in these paths may make use of the Registry::RegisterFactory constructor or the
# REGISTER_FACTORY macro. Other locations should use the InjectFactory helper class to
Expand Down

0 comments on commit 7ab7de1

Please sign in to comment.