[wasm] Remove redundant GetSharedWireBytesStorage
It does exactly the same as GetWireBytesStorage. Also change the WasmCompilationUnit::ExecuteCompilation method to receive a reference to the shared_ptr, since it does not take (shared) ownership. This saves one ref count increment and decrement. R=titzer@chromium.org Bug: v8:8689 Change-Id: I03c3ec5f907c738c73e0dc16646d78ecac3f3717 Reviewed-on: https://chromium-review.googlesource.com/c/1417632 Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Ben Titzer <titzer@chromium.org> Cr-Commit-Position: refs/heads/master@{#58908}
This commit is contained in:
parent
7d3a3385c7
commit
babdc422e5
@ -54,8 +54,8 @@ WasmCompilationUnit::~WasmCompilationUnit() = default;
|
||||
|
||||
void WasmCompilationUnit::ExecuteCompilation(
|
||||
CompilationEnv* env, NativeModule* native_module,
|
||||
std::shared_ptr<WireBytesStorage> wire_bytes_storage, Counters* counters,
|
||||
WasmFeatures* detected) {
|
||||
const std::shared_ptr<WireBytesStorage>& wire_bytes_storage,
|
||||
Counters* counters, WasmFeatures* detected) {
|
||||
auto* func = &env->module->functions[func_index_];
|
||||
Vector<const uint8_t> code = wire_bytes_storage->GetCode(func->code);
|
||||
wasm::FunctionBody func_body{func->sig, func->code.offset(), code.start(),
|
||||
|
@ -42,7 +42,7 @@ class WasmCompilationUnit final {
|
||||
~WasmCompilationUnit();
|
||||
|
||||
void ExecuteCompilation(CompilationEnv*, NativeModule*,
|
||||
std::shared_ptr<WireBytesStorage>, Counters*,
|
||||
const std::shared_ptr<WireBytesStorage>&, Counters*,
|
||||
WasmFeatures* detected);
|
||||
|
||||
ExecutionTier tier() const { return tier_; }
|
||||
|
@ -137,12 +137,6 @@ class CompilationStateImpl {
|
||||
return WasmError{error->error.offset(), error_msg.str()};
|
||||
}
|
||||
|
||||
std::shared_ptr<WireBytesStorage> GetSharedWireBytesStorage() const {
|
||||
base::MutexGuard guard(&mutex_);
|
||||
DCHECK_NOT_NULL(wire_bytes_storage_);
|
||||
return wire_bytes_storage_;
|
||||
}
|
||||
|
||||
void SetWireBytesStorage(
|
||||
std::shared_ptr<WireBytesStorage> wire_bytes_storage) {
|
||||
base::MutexGuard guard(&mutex_);
|
||||
@ -151,6 +145,7 @@ class CompilationStateImpl {
|
||||
|
||||
std::shared_ptr<WireBytesStorage> GetWireBytesStorage() const {
|
||||
base::MutexGuard guard(&mutex_);
|
||||
DCHECK_NOT_NULL(wire_bytes_storage_);
|
||||
return wire_bytes_storage_;
|
||||
}
|
||||
|
||||
@ -496,8 +491,8 @@ bool FetchAndExecuteCompilationUnit(CompilationEnv* env,
|
||||
// if baseline bails out.
|
||||
ExecutionTier tier = unit->tier();
|
||||
unit->ExecuteCompilation(env, native_module,
|
||||
compilation_state->GetSharedWireBytesStorage(),
|
||||
counters, detected);
|
||||
compilation_state->GetWireBytesStorage(), counters,
|
||||
detected);
|
||||
compilation_state->OnFinishedUnit(tier, unit->result());
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user