Skip to content

Commit

Permalink
Bug 1794841 - wasm Remove unneeded OptimizedBackend enum. r=jseward
Browse files Browse the repository at this point in the history
This is not needed now that CL has been removed.

Differential Revision: https://phabricator.services.mozilla.com/D159192
  • Loading branch information
eqrion committed Oct 18, 2022
1 parent e7bc4be commit 999a88c
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 41 deletions.
3 changes: 1 addition & 2 deletions js/src/wasm/AsmJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1413,8 +1413,7 @@ class MOZ_STACK_CLASS ModuleValidatorShared {
sigSet_(cx),
funcImportMap_(cx),
arrayViews_(cx),
compilerEnv_(CompileMode::Once, Tier::Optimized, OptimizedBackend::Ion,
DebugEnabled::False),
compilerEnv_(CompileMode::Once, Tier::Optimized, DebugEnabled::False),
moduleEnv_(FeatureArgs(), ModuleKind::AsmJS) {
compilerEnv_.computeParameters();
memory_.minLength = RoundUpToNextValidAsmJSHeapLength(0);
Expand Down
8 changes: 1 addition & 7 deletions js/src/wasm/WasmCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,10 @@ CompilerEnvironment::CompilerEnvironment(const CompileArgs& args)
: state_(InitialWithArgs), args_(&args) {}

CompilerEnvironment::CompilerEnvironment(CompileMode mode, Tier tier,
OptimizedBackend optimizedBackend,
DebugEnabled debugEnabled)
: state_(InitialWithModeTierDebug),
mode_(mode),
tier_(tier),
optimizedBackend_(optimizedBackend),
debug_(debugEnabled) {}

void CompilerEnvironment::computeParameters() {
Expand Down Expand Up @@ -624,8 +622,6 @@ void CompilerEnvironment::computeParameters(Decoder& d) {
tier_ = hasSecondTier ? Tier::Optimized : Tier::Baseline;
}

optimizedBackend_ = OptimizedBackend::Ion;

debug_ = debugEnabled ? DebugEnabled::True : DebugEnabled::False;

state_ = Computed;
Expand Down Expand Up @@ -725,14 +721,12 @@ bool wasm::CompileTier2(const CompileArgs& args, const Bytes& bytecode,
UniqueCharsVector* warnings, Atomic<bool>* cancelled) {
Decoder d(bytecode, 0, error);

OptimizedBackend optimizedBackend = OptimizedBackend::Ion;

ModuleEnvironment moduleEnv(args.features);
if (!DecodeModuleEnvironment(d, &moduleEnv)) {
return false;
}
CompilerEnvironment compilerEnv(CompileMode::Tier2, Tier::Optimized,
optimizedBackend, DebugEnabled::False);
DebugEnabled::False);
compilerEnv.computeParameters(d);

ModuleGenerator mg(args, &moduleEnv, &compilerEnv, cancelled, error,
Expand Down
9 changes: 1 addition & 8 deletions js/src/wasm/WasmCompileArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ struct CompilerEnvironment {
struct {
CompileMode mode_;
Tier tier_;
OptimizedBackend optimizedBackend_;
DebugEnabled debug_;
};
};
Expand All @@ -204,9 +203,7 @@ struct CompilerEnvironment {
// Save the provided values for mode, tier, and debug, and the initial value
// for gc/refTypes. A subsequent computeParameters() will compute the
// final value of gc/refTypes.
CompilerEnvironment(CompileMode mode, Tier tier,
OptimizedBackend optimizedBackend,
DebugEnabled debugEnabled);
CompilerEnvironment(CompileMode mode, Tier tier, DebugEnabled debugEnabled);

// Compute any remaining compilation parameters.
void computeParameters(Decoder& d);
Expand All @@ -225,10 +222,6 @@ struct CompilerEnvironment {
MOZ_ASSERT(isComputed());
return tier_;
}
OptimizedBackend optimizedBackend() const {
MOZ_ASSERT(isComputed());
return optimizedBackend_;
}
DebugEnabled debug() const {
MOZ_ASSERT(isComputed());
return debug_;
Expand Down
6 changes: 0 additions & 6 deletions js/src/wasm/WasmConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -1040,12 +1040,6 @@ static const unsigned MaxFrameSize = 512 * 1024;

static const unsigned MaxVarU32DecodedBytes = 5;

// Which backend to use in the case of the optimized tier.

enum class OptimizedBackend {
Ion,
};

// The CompileMode controls how compilation of a module is performed (notably,
// how many times we compile it).

Expand Down
19 changes: 4 additions & 15 deletions js/src/wasm/WasmGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,14 +692,9 @@ static bool ExecuteCompileTask(CompileTask* task, UniqueChars* error) {

switch (task->compilerEnv.tier()) {
case Tier::Optimized:
switch (task->compilerEnv.optimizedBackend()) {
case OptimizedBackend::Ion:
if (!IonCompileFunctions(task->moduleEnv, task->compilerEnv,
task->lifo, task->inputs, &task->output,
error)) {
return false;
}
break;
if (!IonCompileFunctions(task->moduleEnv, task->compilerEnv, task->lifo,
task->inputs, &task->output, error)) {
return false;
}
break;
case Tier::Baseline:
Expand Down Expand Up @@ -841,13 +836,7 @@ bool ModuleGenerator::compileFuncDef(uint32_t funcIndex,
threshold = JitOptions.wasmBatchBaselineThreshold;
break;
case Tier::Optimized:
switch (compilerEnv_->optimizedBackend()) {
case OptimizedBackend::Ion:
threshold = JitOptions.wasmBatchIonThreshold;
break;
default:
MOZ_CRASH("Invalid optimizedBackend value");
}
threshold = JitOptions.wasmBatchIonThreshold;
break;
default:
MOZ_CRASH("Invalid tier value");
Expand Down
2 changes: 1 addition & 1 deletion js/src/wasm/WasmIntrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ bool wasm::CompileIntrinsicModule(JSContext* cx,
}
CompilerEnvironment compilerEnv(
CompileMode::Once, IonAvailable(cx) ? Tier::Optimized : Tier::Baseline,
OptimizedBackend::Ion, DebugEnabled::False);
DebugEnabled::False);
compilerEnv.computeParameters();

// Build a module environment
Expand Down
1 change: 0 additions & 1 deletion js/src/wasm/WasmIonCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7035,7 +7035,6 @@ bool wasm::IonCompileFunctions(const ModuleEnvironment& moduleEnv,
CompiledCode* code, UniqueChars* error) {
MOZ_ASSERT(compilerEnv.tier() == Tier::Optimized);
MOZ_ASSERT(compilerEnv.debug() == DebugEnabled::False);
MOZ_ASSERT(compilerEnv.optimizedBackend() == OptimizedBackend::Ion);

TempAllocator alloc(&lifo);
JitContext jitContext;
Expand Down
2 changes: 1 addition & 1 deletion js/src/wasm/WasmJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4186,7 +4186,7 @@ JSFunction* WasmFunctionCreate(JSContext* cx, HandleFunction func,

ModuleEnvironment moduleEnv(compileArgs->features);
CompilerEnvironment compilerEnv(CompileMode::Once, Tier::Optimized,
OptimizedBackend::Ion, DebugEnabled::False);
DebugEnabled::False);
compilerEnv.computeParameters();

// Initialize the type section
Expand Down

0 comments on commit 999a88c

Please sign in to comment.