[wasm] Remove {InterpreterCompilationUnit}
{InterpreterCompilationUnit} does not store any data except for a pointer back to the {WasmCompilationUnit}, and has a single method only. Thus remove it, and replace it by a static function. This saves one field per compilation unit. We can probably also remove {TurbofanWasmCompilationUnit} in a similar way, which I will do in a follow-up CL. R=mstarzinger@chromium.org Change-Id: I8fc2e18366757573499fd57f909ec8222c27be38 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1587387 Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#61083}
This commit is contained in:
parent
99254554c1
commit
ea2de39ff1
@ -5534,7 +5534,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
|
||||
return true;
|
||||
}
|
||||
|
||||
void BuildWasmInterpreterEntry(uint32_t func_index) {
|
||||
void BuildWasmInterpreterEntry(int func_index) {
|
||||
int param_count = static_cast<int>(sig_->parameter_count());
|
||||
|
||||
// Build the start and the parameter nodes.
|
||||
@ -6263,9 +6263,9 @@ wasm::WasmCompilationResult TurbofanWasmCompilationUnit::ExecuteCompilation(
|
||||
return std::move(*result);
|
||||
}
|
||||
|
||||
wasm::WasmCompilationResult InterpreterCompilationUnit::ExecuteCompilation(
|
||||
wasm::WasmCompilationResult ExecuteInterpreterEntryCompilation(
|
||||
wasm::WasmEngine* wasm_engine, wasm::CompilationEnv* env,
|
||||
const wasm::FunctionBody& func_body, Counters* counters,
|
||||
const wasm::FunctionBody& func_body, int func_index, Counters* counters,
|
||||
wasm::WasmFeatures* detected) {
|
||||
Zone zone(wasm_engine->allocator(), ZONE_NAME);
|
||||
const wasm::WasmModule* module = env ? env->module : nullptr;
|
||||
@ -6274,9 +6274,8 @@ wasm::WasmCompilationResult InterpreterCompilationUnit::ExecuteCompilation(
|
||||
decoder.Decode();
|
||||
if (decoder.failed()) return wasm::WasmCompilationResult{};
|
||||
|
||||
wasm::WasmCompilationResult result =
|
||||
CompileWasmInterpreterEntry(wasm_engine, env->enabled_features,
|
||||
wasm_unit_->func_index_, func_body.sig);
|
||||
wasm::WasmCompilationResult result = CompileWasmInterpreterEntry(
|
||||
wasm_engine, env->enabled_features, func_index, func_body.sig);
|
||||
DCHECK(result.succeeded());
|
||||
DCHECK_EQ(wasm::ExecutionTier::kInterpreter, result.result_tier);
|
||||
|
||||
|
@ -70,22 +70,9 @@ class TurbofanWasmCompilationUnit {
|
||||
DISALLOW_COPY_AND_ASSIGN(TurbofanWasmCompilationUnit);
|
||||
};
|
||||
|
||||
class InterpreterCompilationUnit final {
|
||||
public:
|
||||
explicit InterpreterCompilationUnit(wasm::WasmCompilationUnit* wasm_unit)
|
||||
: wasm_unit_(wasm_unit) {}
|
||||
|
||||
wasm::WasmCompilationResult ExecuteCompilation(wasm::WasmEngine*,
|
||||
wasm::CompilationEnv*,
|
||||
const wasm::FunctionBody&,
|
||||
Counters*,
|
||||
wasm::WasmFeatures* detected);
|
||||
|
||||
private:
|
||||
wasm::WasmCompilationUnit* const wasm_unit_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(InterpreterCompilationUnit);
|
||||
};
|
||||
wasm::WasmCompilationResult ExecuteInterpreterEntryCompilation(
|
||||
wasm::WasmEngine*, wasm::CompilationEnv*, const wasm::FunctionBody&,
|
||||
int func_index, Counters*, wasm::WasmFeatures* detected);
|
||||
|
||||
// Calls to WASM imports are handled in several different ways, depending on the
|
||||
// type of the target function/callable and whether the signature matches the
|
||||
|
@ -172,8 +172,8 @@ WasmCompilationResult WasmCompilationUnit::ExecuteCompilation(
|
||||
break;
|
||||
|
||||
case ExecutionTier::kInterpreter:
|
||||
result = interpreter_unit_->ExecuteCompilation(
|
||||
wasm_engine, env, func_body, counters, detected);
|
||||
result = compiler::ExecuteInterpreterEntryCompilation(
|
||||
wasm_engine, env, func_body, func_index_, counters, detected);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -190,28 +190,12 @@ WasmCompilationResult WasmCompilationUnit::ExecuteCompilation(
|
||||
}
|
||||
|
||||
void WasmCompilationUnit::SwitchTier(ExecutionTier new_tier) {
|
||||
// This method is being called in the constructor, where neither
|
||||
// {turbofan_unit_} nor {interpreter_unit_} are set, or to switch tier from
|
||||
// kLiftoff to kTurbofan.
|
||||
switch (new_tier) {
|
||||
case ExecutionTier::kLiftoff:
|
||||
DCHECK(!turbofan_unit_);
|
||||
DCHECK(!interpreter_unit_);
|
||||
return;
|
||||
case ExecutionTier::kTurbofan:
|
||||
DCHECK(!turbofan_unit_);
|
||||
DCHECK(!interpreter_unit_);
|
||||
turbofan_unit_.reset(new compiler::TurbofanWasmCompilationUnit(this));
|
||||
return;
|
||||
case ExecutionTier::kInterpreter:
|
||||
DCHECK(!turbofan_unit_);
|
||||
DCHECK(!interpreter_unit_);
|
||||
interpreter_unit_.reset(new compiler::InterpreterCompilationUnit(this));
|
||||
return;
|
||||
case ExecutionTier::kNone:
|
||||
UNREACHABLE();
|
||||
// This method is being called in the constructor, where {turbofan_unit_} is
|
||||
// not set, or to switch tier from kLiftoff to kTurbofan.
|
||||
DCHECK(!turbofan_unit_);
|
||||
if (new_tier == ExecutionTier::kTurbofan) {
|
||||
turbofan_unit_.reset(new compiler::TurbofanWasmCompilationUnit(this));
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -20,7 +20,6 @@ class AssemblerBuffer;
|
||||
class Counters;
|
||||
|
||||
namespace compiler {
|
||||
class InterpreterCompilationUnit;
|
||||
class Pipeline;
|
||||
class TurbofanWasmCompilationUnit;
|
||||
} // namespace compiler
|
||||
@ -85,15 +84,12 @@ class V8_EXPORT_PRIVATE WasmCompilationUnit final {
|
||||
|
||||
private:
|
||||
friend class compiler::TurbofanWasmCompilationUnit;
|
||||
friend class compiler::InterpreterCompilationUnit;
|
||||
|
||||
const int func_index_;
|
||||
ExecutionTier tier_;
|
||||
|
||||
// TurbofanWasmCompilationUnit, set if {tier_ == kTurbofan}.
|
||||
std::unique_ptr<compiler::TurbofanWasmCompilationUnit> turbofan_unit_;
|
||||
// InterpreterCompilationUnit, set if {tier_ == kInterpreter}.
|
||||
std::unique_ptr<compiler::InterpreterCompilationUnit> interpreter_unit_;
|
||||
|
||||
void SwitchTier(ExecutionTier new_tier);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user