[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:
Clemens Hammacher 2019-01-18 09:24:20 +01:00 committed by Commit Bot
parent 7d3a3385c7
commit babdc422e5
3 changed files with 6 additions and 11 deletions

View File

@ -54,8 +54,8 @@ WasmCompilationUnit::~WasmCompilationUnit() = default;
void WasmCompilationUnit::ExecuteCompilation( void WasmCompilationUnit::ExecuteCompilation(
CompilationEnv* env, NativeModule* native_module, CompilationEnv* env, NativeModule* native_module,
std::shared_ptr<WireBytesStorage> wire_bytes_storage, Counters* counters, const std::shared_ptr<WireBytesStorage>& wire_bytes_storage,
WasmFeatures* detected) { Counters* counters, WasmFeatures* detected) {
auto* func = &env->module->functions[func_index_]; auto* func = &env->module->functions[func_index_];
Vector<const uint8_t> code = wire_bytes_storage->GetCode(func->code); Vector<const uint8_t> code = wire_bytes_storage->GetCode(func->code);
wasm::FunctionBody func_body{func->sig, func->code.offset(), code.start(), wasm::FunctionBody func_body{func->sig, func->code.offset(), code.start(),

View File

@ -42,7 +42,7 @@ class WasmCompilationUnit final {
~WasmCompilationUnit(); ~WasmCompilationUnit();
void ExecuteCompilation(CompilationEnv*, NativeModule*, void ExecuteCompilation(CompilationEnv*, NativeModule*,
std::shared_ptr<WireBytesStorage>, Counters*, const std::shared_ptr<WireBytesStorage>&, Counters*,
WasmFeatures* detected); WasmFeatures* detected);
ExecutionTier tier() const { return tier_; } ExecutionTier tier() const { return tier_; }

View File

@ -137,12 +137,6 @@ class CompilationStateImpl {
return WasmError{error->error.offset(), error_msg.str()}; 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( void SetWireBytesStorage(
std::shared_ptr<WireBytesStorage> wire_bytes_storage) { std::shared_ptr<WireBytesStorage> wire_bytes_storage) {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
@ -151,6 +145,7 @@ class CompilationStateImpl {
std::shared_ptr<WireBytesStorage> GetWireBytesStorage() const { std::shared_ptr<WireBytesStorage> GetWireBytesStorage() const {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
DCHECK_NOT_NULL(wire_bytes_storage_);
return wire_bytes_storage_; return wire_bytes_storage_;
} }
@ -496,8 +491,8 @@ bool FetchAndExecuteCompilationUnit(CompilationEnv* env,
// if baseline bails out. // if baseline bails out.
ExecutionTier tier = unit->tier(); ExecutionTier tier = unit->tier();
unit->ExecuteCompilation(env, native_module, unit->ExecuteCompilation(env, native_module,
compilation_state->GetSharedWireBytesStorage(), compilation_state->GetWireBytesStorage(), counters,
counters, detected); detected);
compilation_state->OnFinishedUnit(tier, unit->result()); compilation_state->OnFinishedUnit(tier, unit->result());
return true; return true;