Commit 0df7f62c authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm] Use wasm engine allocator for export wrappers

Prefer using the wasm engine's allocator, as the isolate may not be
available during asynchronous compilation.

Bug: v8:9554
Change-Id: Iee3777efb62d18de6b2a64fa7a71d4ef4c6b3a92
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1722559
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62955}
parent 58f1b315
......@@ -1062,7 +1062,7 @@ class WasmHeapStubCompilationJob final : public OptimizedCompilationJob {
debug_name_(std::move(debug_name)),
info_(CStrVector(debug_name_.get()), graph->zone(), kind),
call_descriptor_(call_descriptor),
zone_stats_(isolate->allocator()),
zone_stats_(zone->allocator()),
zone_(std::move(zone)),
graph_(graph),
data_(&zone_stats_, &info_, isolate, graph_, nullptr, source_positions,
......
......@@ -6166,13 +6166,13 @@ void AppendSignature(char* buffer, size_t max_name_len,
} // namespace
std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob(
Isolate* isolate, wasm::FunctionSig* sig, bool is_import,
const wasm::WasmFeatures& enabled_features) {
Isolate* isolate, wasm::WasmEngine* wasm_engine, wasm::FunctionSig* sig,
bool is_import, const wasm::WasmFeatures& enabled_features) {
//----------------------------------------------------------------------------
// Create the Graph.
//----------------------------------------------------------------------------
std::unique_ptr<Zone> zone =
base::make_unique<Zone>(isolate->allocator(), ZONE_NAME);
base::make_unique<Zone>(wasm_engine->allocator(), ZONE_NAME);
Graph* graph = new (zone.get()) Graph(zone.get());
CommonOperatorBuilder common(zone.get());
MachineOperatorBuilder machine(
......
......@@ -131,8 +131,8 @@ wasm::WasmCode* CompileWasmCapiCallWrapper(wasm::WasmEngine*,
// Returns an OptimizedCompilationJob object for a JS to Wasm wrapper.
std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob(
Isolate* isolate, wasm::FunctionSig* sig, bool is_import,
const wasm::WasmFeatures& enabled_features);
Isolate* isolate, wasm::WasmEngine* wasm_engine, 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
// interpreter. It's ABI compatible with the compiled wasm function.
......
......@@ -263,10 +263,10 @@ void WasmCompilationUnit::CompileWasmFunction(Isolate* isolate,
}
JSToWasmWrapperCompilationUnit::JSToWasmWrapperCompilationUnit(
Isolate* isolate, FunctionSig* sig, bool is_import,
Isolate* isolate, WasmEngine* wasm_engine, FunctionSig* sig, bool is_import,
const WasmFeatures& enabled_features)
: job_(compiler::NewJSToWasmCompilationJob(isolate, sig, is_import,
enabled_features)) {}
: job_(compiler::NewJSToWasmCompilationJob(isolate, wasm_engine, sig,
is_import, enabled_features)) {}
JSToWasmWrapperCompilationUnit::~JSToWasmWrapperCompilationUnit() = default;
......@@ -298,8 +298,8 @@ Handle<Code> JSToWasmWrapperCompilationUnit::CompileJSToWasmWrapper(
Isolate* isolate, FunctionSig* sig, bool is_import) {
// Run the compilation unit synchronously.
WasmFeatures enabled_features = WasmFeaturesFromIsolate(isolate);
JSToWasmWrapperCompilationUnit unit(isolate, sig, is_import,
enabled_features);
JSToWasmWrapperCompilationUnit unit(isolate, isolate->wasm_engine(), sig,
is_import, enabled_features);
unit.Prepare(isolate);
unit.Execute();
return unit.Finalize(isolate);
......
......@@ -108,8 +108,8 @@ STATIC_ASSERT(sizeof(WasmCompilationUnit) <= 2 * kSystemPointerSize);
class V8_EXPORT_PRIVATE JSToWasmWrapperCompilationUnit final {
public:
JSToWasmWrapperCompilationUnit(Isolate* isolate, FunctionSig* sig,
bool is_import,
JSToWasmWrapperCompilationUnit(Isolate* isolate, WasmEngine* wasm_engine,
FunctionSig* sig, bool is_import,
const WasmFeatures& enabled_features);
~JSToWasmWrapperCompilationUnit();
......
......@@ -2460,7 +2460,8 @@ void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
JSToWasmWrapperKey key(function.imported, *function.sig);
if (queue.insert(key)) {
auto unit = base::make_unique<JSToWasmWrapperCompilationUnit>(
isolate, function.sig, function.imported, enabled_features);
isolate, isolate->wasm_engine(), function.sig, function.imported,
enabled_features);
unit->Prepare(isolate);
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