[wasm] Remove redundant parameters from PipelineWasmCompilationJob

This removes more parameters which can be queried from the NativeModule.

R=titzer@chromium.org

Bug: v8:8343
Change-Id: Ia5111a336e8e2272f189ff2c5523afec8b2de660
Reviewed-on: https://chromium-review.googlesource.com/c/1303723
Reviewed-by: Ben Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57092}
This commit is contained in:
Clemens Hammacher 2018-10-29 12:52:52 +01:00 committed by Commit Bot
parent bf3d7b9ae3
commit 00a2e85800
3 changed files with 20 additions and 23 deletions

View File

@ -806,10 +806,9 @@ PipelineStatistics* CreatePipelineStatistics(Handle<Script> script,
return pipeline_statistics;
}
PipelineStatistics* CreatePipelineStatistics(wasm::WasmEngine* wasm_engine,
wasm::FunctionBody function_body,
wasm::WasmModule* wasm_module,
OptimizedCompilationInfo* info,
PipelineStatistics* CreatePipelineStatistics(
wasm::WasmEngine* wasm_engine, wasm::FunctionBody function_body,
const wasm::WasmModule* wasm_module, OptimizedCompilationInfo* info,
ZoneStats* zone_stats) {
PipelineStatistics* pipeline_statistics = nullptr;
@ -1013,20 +1012,20 @@ class PipelineWasmCompilationJob final : public OptimizedCompilationJob {
OptimizedCompilationInfo* info, wasm::WasmEngine* wasm_engine,
MachineGraph* mcgraph, CallDescriptor* call_descriptor,
SourcePositionTable* source_positions, NodeOriginTable* node_origins,
wasm::FunctionBody function_body, wasm::WasmModule* wasm_module,
wasm::NativeModule* native_module, int function_index, bool asmjs_origin)
wasm::FunctionBody function_body, wasm::NativeModule* native_module,
int function_index)
: OptimizedCompilationJob(kNoStackLimit, info, "TurboFan",
State::kReadyToExecute),
zone_stats_(wasm_engine->allocator()),
pipeline_statistics_(CreatePipelineStatistics(
wasm_engine, function_body, wasm_module, info, &zone_stats_)),
wasm_engine, function_body, native_module->module(), info,
&zone_stats_)),
data_(&zone_stats_, wasm_engine, info, mcgraph,
pipeline_statistics_.get(), source_positions, node_origins,
function_index, WasmAssemblerOptions()),
pipeline_(&data_),
linkage_(call_descriptor),
native_module_(native_module),
asmjs_origin_(asmjs_origin) {}
native_module_(native_module) {}
protected:
Status PrepareJobImpl(Isolate* isolate) final;
@ -1040,7 +1039,6 @@ class PipelineWasmCompilationJob final : public OptimizedCompilationJob {
PipelineImpl pipeline_;
Linkage linkage_;
wasm::NativeModule* native_module_;
bool asmjs_origin_;
};
PipelineWasmCompilationJob::Status PipelineWasmCompilationJob::PrepareJobImpl(
@ -1054,14 +1052,17 @@ PipelineWasmCompilationJob::ExecuteJobImpl() {
PipelineData* data = &data_;
data->BeginPhaseKind("wasm optimization");
if (FLAG_wasm_opt || asmjs_origin_) {
const bool is_asm_js = native_module_->module()->origin == wasm::kAsmJsOrigin;
if (FLAG_wasm_opt || is_asm_js) {
PipelineRunScope scope(data, "wasm full optimization");
GraphReducer graph_reducer(scope.zone(), data->graph(),
data->mcgraph()->Dead());
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common(), scope.zone());
ValueNumberingReducer value_numbering(scope.zone(), data->graph()->zone());
MachineOperatorReducer machine_reducer(data->mcgraph(), asmjs_origin_);
const bool allow_signalling_nan = is_asm_js;
MachineOperatorReducer machine_reducer(data->mcgraph(),
allow_signalling_nan);
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->broker(), data->common(),
data->machine(), scope.zone());
@ -2325,13 +2326,11 @@ OptimizedCompilationJob* Pipeline::NewWasmCompilationJob(
OptimizedCompilationInfo* info, wasm::WasmEngine* wasm_engine,
MachineGraph* mcgraph, CallDescriptor* call_descriptor,
SourcePositionTable* source_positions, NodeOriginTable* node_origins,
wasm::FunctionBody function_body, wasm::WasmModule* wasm_module,
wasm::NativeModule* native_module, int function_index,
wasm::ModuleOrigin asmjs_origin) {
wasm::FunctionBody function_body, wasm::NativeModule* native_module,
int function_index) {
return new PipelineWasmCompilationJob(
info, wasm_engine, mcgraph, call_descriptor, source_positions,
node_origins, function_body, wasm_module, native_module, function_index,
asmjs_origin);
node_origins, function_body, native_module, function_index);
}
bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,

View File

@ -50,9 +50,8 @@ class Pipeline : public AllStatic {
OptimizedCompilationInfo* info, wasm::WasmEngine* wasm_engine,
MachineGraph* mcgraph, CallDescriptor* call_descriptor,
SourcePositionTable* source_positions, NodeOriginTable* node_origins,
wasm::FunctionBody function_body, wasm::WasmModule* wasm_module,
wasm::NativeModule* native_module, int function_index,
wasm::ModuleOrigin wasm_origin);
wasm::FunctionBody function_body, wasm::NativeModule* native_module,
int function_index);
// Run the pipeline on a machine graph and generate code.
static MaybeHandle<Code> GenerateCodeForWasmStub(

View File

@ -5321,8 +5321,7 @@ void TurbofanWasmCompilationUnit::ExecuteCompilation(
std::unique_ptr<OptimizedCompilationJob> job(Pipeline::NewWasmCompilationJob(
&info, wasm_unit_->wasm_engine_, mcgraph, call_descriptor,
source_positions, node_origins, wasm_unit_->func_body_,
const_cast<wasm::WasmModule*>(env->module), wasm_unit_->native_module_,
wasm_unit_->func_index_, env->module->origin));
wasm_unit_->native_module_, wasm_unit_->func_index_));
if (job->ExecuteJob() == CompilationJob::SUCCEEDED) {
wasm_unit_->SetResult(info.wasm_code(), counters);
}