Commit 2471103b authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Move {lower_simd} flag into {ModuleEnv} structure.

R=titzer@chromium.org
BUG=v8:7754

Change-Id: Icf17677a3ca3c9be153b68a9a6f939259e7b7b5f
Reviewed-on: https://chromium-review.googlesource.com/1143263
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54582}
parent 29d08f1c
...@@ -5114,7 +5114,7 @@ SourcePositionTable* TurbofanWasmCompilationUnit::BuildGraphForWasmFunction( ...@@ -5114,7 +5114,7 @@ SourcePositionTable* TurbofanWasmCompilationUnit::BuildGraphForWasmFunction(
builder.LowerInt64(); builder.LowerInt64();
if (builder.has_simd() && if (builder.has_simd() &&
(!CpuFeatures::SupportsWasmSimd128() || wasm_unit_->lower_simd_)) { (!CpuFeatures::SupportsWasmSimd128() || wasm_unit_->env_->lower_simd)) {
SimdScalarLowering( SimdScalarLowering(
mcgraph, mcgraph,
CreateMachineSignature(mcgraph->zone(), wasm_unit_->func_body_.sig)) CreateMachineSignature(mcgraph->zone(), wasm_unit_->func_body_.sig))
......
...@@ -36,7 +36,7 @@ WasmCompilationUnit::GetDefaultCompilationMode() { ...@@ -36,7 +36,7 @@ WasmCompilationUnit::GetDefaultCompilationMode() {
WasmCompilationUnit::WasmCompilationUnit( WasmCompilationUnit::WasmCompilationUnit(
WasmEngine* wasm_engine, ModuleEnv* env, wasm::NativeModule* native_module, WasmEngine* wasm_engine, ModuleEnv* env, wasm::NativeModule* native_module,
wasm::FunctionBody body, wasm::WasmName name, int index, Counters* counters, wasm::FunctionBody body, wasm::WasmName name, int index, Counters* counters,
CompilationMode mode, bool lower_simd) CompilationMode mode)
: env_(env), : env_(env),
wasm_engine_(wasm_engine), wasm_engine_(wasm_engine),
func_body_(body), func_body_(body),
...@@ -44,7 +44,6 @@ WasmCompilationUnit::WasmCompilationUnit( ...@@ -44,7 +44,6 @@ WasmCompilationUnit::WasmCompilationUnit(
counters_(counters), counters_(counters),
func_index_(index), func_index_(index),
native_module_(native_module), native_module_(native_module),
lower_simd_(lower_simd),
mode_(mode) { mode_(mode) {
DCHECK_GE(index, env->module->num_imported_functions); DCHECK_GE(index, env->module->num_imported_functions);
DCHECK_LT(index, env->module->functions.size()); DCHECK_LT(index, env->module->functions.size());
......
...@@ -30,6 +30,8 @@ enum RuntimeExceptionSupport : bool { ...@@ -30,6 +30,8 @@ enum RuntimeExceptionSupport : bool {
enum UseTrapHandler : bool { kUseTrapHandler = true, kNoTrapHandler = false }; enum UseTrapHandler : bool { kUseTrapHandler = true, kNoTrapHandler = false };
enum LowerSimd : bool { kLowerSimd = true, kNoLowerSimd = false };
// The {ModuleEnv} encapsulates the module data that is used during compilation. // The {ModuleEnv} encapsulates the module data that is used during compilation.
// ModuleEnvs are shareable across multiple compilations. // ModuleEnvs are shareable across multiple compilations.
struct ModuleEnv { struct ModuleEnv {
...@@ -45,11 +47,15 @@ struct ModuleEnv { ...@@ -45,11 +47,15 @@ struct ModuleEnv {
// be generated differently. // be generated differently.
const RuntimeExceptionSupport runtime_exception_support; const RuntimeExceptionSupport runtime_exception_support;
const LowerSimd lower_simd;
constexpr ModuleEnv(const WasmModule* module, UseTrapHandler use_trap_handler, constexpr ModuleEnv(const WasmModule* module, UseTrapHandler use_trap_handler,
RuntimeExceptionSupport runtime_exception_support) RuntimeExceptionSupport runtime_exception_support,
LowerSimd lower_simd = kNoLowerSimd)
: module(module), : module(module),
use_trap_handler(use_trap_handler), use_trap_handler(use_trap_handler),
runtime_exception_support(runtime_exception_support) {} runtime_exception_support(runtime_exception_support),
lower_simd(lower_simd) {}
}; };
class WasmCompilationUnit final { class WasmCompilationUnit final {
...@@ -64,8 +70,7 @@ class WasmCompilationUnit final { ...@@ -64,8 +70,7 @@ class WasmCompilationUnit final {
// used by callers to pass Counters. // used by callers to pass Counters.
WasmCompilationUnit(WasmEngine* wasm_engine, ModuleEnv*, wasm::NativeModule*, WasmCompilationUnit(WasmEngine* wasm_engine, ModuleEnv*, wasm::NativeModule*,
wasm::FunctionBody, wasm::WasmName, int index, Counters*, wasm::FunctionBody, wasm::WasmName, int index, Counters*,
CompilationMode = GetDefaultCompilationMode(), CompilationMode = GetDefaultCompilationMode());
bool lower_simd = false);
~WasmCompilationUnit(); ~WasmCompilationUnit();
...@@ -91,8 +96,6 @@ class WasmCompilationUnit final { ...@@ -91,8 +96,6 @@ class WasmCompilationUnit final {
Counters* counters_; Counters* counters_;
int func_index_; int func_index_;
wasm::NativeModule* native_module_; wasm::NativeModule* native_module_;
// TODO(wasm): Put {lower_simd_} inside the {ModuleEnv}.
bool lower_simd_;
CompilationMode mode_; CompilationMode mode_;
// LiftoffCompilationUnit, set if {mode_ == kLiftoff}. // LiftoffCompilationUnit, set if {mode_ == kLiftoff}.
std::unique_ptr<LiftoffCompilationUnit> liftoff_unit_; std::unique_ptr<LiftoffCompilationUnit> liftoff_unit_;
......
...@@ -195,7 +195,7 @@ ModuleEnv TestingModuleBuilder::CreateModuleEnv() { ...@@ -195,7 +195,7 @@ ModuleEnv TestingModuleBuilder::CreateModuleEnv() {
return { return {
test_module_ptr_, test_module_ptr_,
trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler, trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler,
runtime_exception_support_}; runtime_exception_support_, lower_simd()};
} }
const WasmGlobal* TestingModuleBuilder::AddGlobal(ValueType type) { const WasmGlobal* TestingModuleBuilder::AddGlobal(ValueType type) {
...@@ -424,8 +424,7 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) { ...@@ -424,8 +424,7 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
builder_->instance_object()->module_object()->native_module(); builder_->instance_object()->module_object()->native_module();
WasmCompilationUnit unit(isolate()->wasm_engine(), &module_env, native_module, WasmCompilationUnit unit(isolate()->wasm_engine(), &module_env, native_module,
func_body, func_name, function_->func_index, func_body, func_name, function_->func_index,
isolate()->counters(), comp_mode, isolate()->counters(), comp_mode);
builder_->lower_simd());
unit.ExecuteCompilation(); unit.ExecuteCompilation();
wasm::WasmCode* wasm_code = unit.FinishCompilation(&thrower); wasm::WasmCode* wasm_code = unit.FinishCompilation(&thrower);
if (wasm::WasmCode::ShouldBeLogged(isolate())) { if (wasm::WasmCode::ShouldBeLogged(isolate())) {
......
...@@ -54,8 +54,6 @@ enum WasmExecutionMode { ...@@ -54,8 +54,6 @@ enum WasmExecutionMode {
kExecuteLiftoff kExecuteLiftoff
}; };
enum LowerSimd : bool { kLowerSimd = true, kNoLowerSimd = false };
using compiler::CallDescriptor; using compiler::CallDescriptor;
using compiler::MachineTypeForC; using compiler::MachineTypeForC;
using compiler::Node; using compiler::Node;
......
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