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