Commit eb3935f4 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm] Pass enabled features argument to export wrapper compilation

In export wrapper compilation, the isolate was used to get enabled
features. This prevents asynchronous compilation, so this is replaced
with an enabled_features argument passed from the main thread.

R=mstarzinger@chromium.org

Bug: v8:9554
Change-Id: Iab8a090841170dc235273dda58997cde716ee13f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1722554Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62949}
parent c6b1ef0e
...@@ -6083,7 +6083,8 @@ void AppendSignature(char* buffer, size_t max_name_len, ...@@ -6083,7 +6083,8 @@ void AppendSignature(char* buffer, size_t max_name_len,
} // namespace } // namespace
std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob( std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob(
Isolate* isolate, wasm::FunctionSig* sig, bool is_import) { Isolate* isolate, wasm::FunctionSig* sig, bool is_import,
const wasm::WasmFeatures& enabled_features) {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Create the Graph. // Create the Graph.
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -6102,7 +6103,7 @@ std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob( ...@@ -6102,7 +6103,7 @@ std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob(
WasmWrapperGraphBuilder builder(zone.get(), &jsgraph, sig, nullptr, WasmWrapperGraphBuilder builder(zone.get(), &jsgraph, sig, nullptr,
StubCallMode::kCallCodeObject, StubCallMode::kCallCodeObject,
wasm::WasmFeaturesFromIsolate(isolate)); enabled_features);
builder.set_control_ptr(&control); builder.set_control_ptr(&control);
builder.set_effect_ptr(&effect); builder.set_effect_ptr(&effect);
builder.BuildJSToWasmWrapper(is_import); builder.BuildJSToWasmWrapper(is_import);
......
...@@ -131,7 +131,8 @@ wasm::WasmCode* CompileWasmCapiCallWrapper(wasm::WasmEngine*, ...@@ -131,7 +131,8 @@ wasm::WasmCode* CompileWasmCapiCallWrapper(wasm::WasmEngine*,
// Returns an OptimizedCompilationJob object for a JS to Wasm wrapper. // Returns an OptimizedCompilationJob object for a JS to Wasm wrapper.
std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob( std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob(
Isolate* isolate, wasm::FunctionSig* sig, bool is_import); Isolate* isolate, wasm::FunctionSig* sig, bool is_import,
const wasm::WasmFeatures& enabled_features);
// Compiles a stub that redirects a call to a wasm function to the wasm // Compiles a stub that redirects a call to a wasm function to the wasm
// interpreter. It's ABI compatible with the compiled wasm function. // interpreter. It's ABI compatible with the compiled wasm function.
......
...@@ -262,10 +262,11 @@ void WasmCompilationUnit::CompileWasmFunction(Isolate* isolate, ...@@ -262,10 +262,11 @@ void WasmCompilationUnit::CompileWasmFunction(Isolate* isolate,
} }
} }
JSToWasmWrapperCompilationUnit::JSToWasmWrapperCompilationUnit(Isolate* isolate, JSToWasmWrapperCompilationUnit::JSToWasmWrapperCompilationUnit(
FunctionSig* sig, Isolate* isolate, FunctionSig* sig, bool is_import,
bool is_import) const WasmFeatures& enabled_features)
: job_(compiler::NewJSToWasmCompilationJob(isolate, sig, is_import)) {} : job_(compiler::NewJSToWasmCompilationJob(isolate, sig, is_import,
enabled_features)) {}
JSToWasmWrapperCompilationUnit::~JSToWasmWrapperCompilationUnit() = default; JSToWasmWrapperCompilationUnit::~JSToWasmWrapperCompilationUnit() = default;
...@@ -296,7 +297,9 @@ Handle<Code> JSToWasmWrapperCompilationUnit::Finalize(Isolate* isolate) { ...@@ -296,7 +297,9 @@ Handle<Code> JSToWasmWrapperCompilationUnit::Finalize(Isolate* isolate) {
Handle<Code> JSToWasmWrapperCompilationUnit::CompileJSToWasmWrapper( Handle<Code> JSToWasmWrapperCompilationUnit::CompileJSToWasmWrapper(
Isolate* isolate, FunctionSig* sig, bool is_import) { Isolate* isolate, FunctionSig* sig, bool is_import) {
// Run the compilation unit synchronously. // Run the compilation unit synchronously.
JSToWasmWrapperCompilationUnit unit(isolate, sig, is_import); WasmFeatures enabled_features = WasmFeaturesFromIsolate(isolate);
JSToWasmWrapperCompilationUnit unit(isolate, sig, is_import,
enabled_features);
unit.Prepare(isolate); unit.Prepare(isolate);
unit.Execute(); unit.Execute();
return unit.Finalize(isolate); return unit.Finalize(isolate);
......
...@@ -109,7 +109,8 @@ STATIC_ASSERT(sizeof(WasmCompilationUnit) <= 2 * kSystemPointerSize); ...@@ -109,7 +109,8 @@ STATIC_ASSERT(sizeof(WasmCompilationUnit) <= 2 * kSystemPointerSize);
class V8_EXPORT_PRIVATE JSToWasmWrapperCompilationUnit final { class V8_EXPORT_PRIVATE JSToWasmWrapperCompilationUnit final {
public: public:
JSToWasmWrapperCompilationUnit(Isolate* isolate, FunctionSig* sig, JSToWasmWrapperCompilationUnit(Isolate* isolate, FunctionSig* sig,
bool is_import); bool is_import,
const WasmFeatures& enabled_features);
~JSToWasmWrapperCompilationUnit(); ~JSToWasmWrapperCompilationUnit();
void Prepare(Isolate* isolate); void Prepare(Isolate* isolate);
......
...@@ -2451,6 +2451,7 @@ void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module, ...@@ -2451,6 +2451,7 @@ void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
Handle<FixedArray> export_wrappers) { Handle<FixedArray> export_wrappers) {
JSToWasmWrapperQueue queue; JSToWasmWrapperQueue queue;
JSToWasmWrapperUnitMap compilation_units; JSToWasmWrapperUnitMap compilation_units;
WasmFeatures enabled_features = WasmFeaturesFromIsolate(isolate);
// Prepare compilation units in the main thread. // Prepare compilation units in the main thread.
for (auto exp : module->export_table) { for (auto exp : module->export_table) {
...@@ -2459,7 +2460,7 @@ void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module, ...@@ -2459,7 +2460,7 @@ void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
JSToWasmWrapperKey key(function.imported, *function.sig); JSToWasmWrapperKey key(function.imported, *function.sig);
if (queue.insert(key)) { if (queue.insert(key)) {
auto unit = base::make_unique<JSToWasmWrapperCompilationUnit>( auto unit = base::make_unique<JSToWasmWrapperCompilationUnit>(
isolate, function.sig, function.imported); isolate, function.sig, function.imported, enabled_features);
unit->Prepare(isolate); unit->Prepare(isolate);
compilation_units.emplace(key, std::move(unit)); compilation_units.emplace(key, std::move(unit));
} }
......
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