Commit 4b94fab9 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Remove async_counters from AsyncCompileJob

They are only needed in the async DecodeModule step. We can just store
a raw pointer to the Counters there.

R=mstarzinger@chromium.org

Bug: v8:8238
Change-Id: I2b22008fc4cbf6f8f69c9d53822fdb5af7d638f6
Reviewed-on: https://chromium-review.googlesource.com/c/1303302
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57078}
parent cbc77647
...@@ -709,9 +709,8 @@ void ValidateSequentially(Isolate* isolate, NativeModule* native_module, ...@@ -709,9 +709,8 @@ void ValidateSequentially(Isolate* isolate, NativeModule* native_module,
base + func.code.end_offset()}; base + func.code.end_offset()};
DecodeResult result; DecodeResult result;
{ {
auto time_counter = auto time_counter = SELECT_WASM_COUNTER(
SELECT_WASM_COUNTER(isolate->async_counters(), module->origin, isolate->counters(), module->origin, wasm_decode, function_time);
wasm_decode, function_time);
TimedHistogramScope wasm_decode_function_time_scope(time_counter); TimedHistogramScope wasm_decode_function_time_scope(time_counter);
WasmFeatures detected; WasmFeatures detected;
...@@ -2184,7 +2183,6 @@ AsyncCompileJob::AsyncCompileJob( ...@@ -2184,7 +2183,6 @@ AsyncCompileJob::AsyncCompileJob(
std::shared_ptr<CompilationResultResolver> resolver) std::shared_ptr<CompilationResultResolver> resolver)
: isolate_(isolate), : isolate_(isolate),
enabled_features_(enabled), enabled_features_(enabled),
async_counters_(isolate->async_counters()),
bytes_copy_(std::move(bytes_copy)), bytes_copy_(std::move(bytes_copy)),
wire_bytes_(bytes_copy_.get(), bytes_copy_.get() + length), wire_bytes_(bytes_copy_.get(), bytes_copy_.get() + length),
resolver_(std::move(resolver)) { resolver_(std::move(resolver)) {
...@@ -2199,7 +2197,7 @@ AsyncCompileJob::AsyncCompileJob( ...@@ -2199,7 +2197,7 @@ AsyncCompileJob::AsyncCompileJob(
} }
void AsyncCompileJob::Start() { void AsyncCompileJob::Start() {
DoAsync<DecodeModule>(); // -- DoAsync<DecodeModule>(isolate_->counters()); // --
} }
void AsyncCompileJob::Abort() { void AsyncCompileJob::Abort() {
...@@ -2471,6 +2469,8 @@ void AsyncCompileJob::NextStep(Args&&... args) { ...@@ -2471,6 +2469,8 @@ void AsyncCompileJob::NextStep(Args&&... args) {
//========================================================================== //==========================================================================
class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep { class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep {
public: public:
explicit DecodeModule(Counters* counters) : counters_(counters) {}
void RunInBackground() override { void RunInBackground() override {
ModuleResult result; ModuleResult result;
{ {
...@@ -2478,10 +2478,9 @@ class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep { ...@@ -2478,10 +2478,9 @@ class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
// Decode the module bytes. // Decode the module bytes.
TRACE_COMPILE("(1) Decoding module...\n"); TRACE_COMPILE("(1) Decoding module...\n");
result = result = DecodeWasmModule(
DecodeWasmModule(job_->enabled_features_, job_->wire_bytes_.start(), job_->enabled_features_, job_->wire_bytes_.start(),
job_->wire_bytes_.end(), false, kWasmOrigin, job_->wire_bytes_.end(), false, kWasmOrigin, counters_,
job_->async_counters().get(),
job_->isolate()->wasm_engine()->allocator()); job_->isolate()->wasm_engine()->allocator());
} }
if (result.failed()) { if (result.failed()) {
...@@ -2492,6 +2491,9 @@ class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep { ...@@ -2492,6 +2491,9 @@ class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep {
job_->DoSync<PrepareAndStartCompile>(std::move(result).value(), true); job_->DoSync<PrepareAndStartCompile>(std::move(result).value(), true);
} }
} }
private:
Counters* const counters_;
}; };
//========================================================================== //==========================================================================
...@@ -2706,7 +2708,7 @@ void AsyncStreamingProcessor::FinishAsyncCompileJobWithError(ResultBase error) { ...@@ -2706,7 +2708,7 @@ void AsyncStreamingProcessor::FinishAsyncCompileJobWithError(ResultBase error) {
bool AsyncStreamingProcessor::ProcessModuleHeader(Vector<const uint8_t> bytes, bool AsyncStreamingProcessor::ProcessModuleHeader(Vector<const uint8_t> bytes,
uint32_t offset) { uint32_t offset) {
TRACE_STREAMING("Process module header...\n"); TRACE_STREAMING("Process module header...\n");
decoder_.StartDecoding(job_->async_counters().get(), decoder_.StartDecoding(job_->isolate()->counters(),
job_->isolate()->wasm_engine()->allocator()); job_->isolate()->wasm_engine()->allocator());
decoder_.DecodeModuleHeader(bytes, offset); decoder_.DecodeModuleHeader(bytes, offset);
if (!decoder_.ok()) { if (!decoder_.ok()) {
......
...@@ -95,11 +95,6 @@ class AsyncCompileJob { ...@@ -95,11 +95,6 @@ class AsyncCompileJob {
class CompileWrappers; // Step 5 (sync) class CompileWrappers; // Step 5 (sync)
class FinishModule; // Step 6 (sync) class FinishModule; // Step 6 (sync)
const std::shared_ptr<Counters>& async_counters() const {
return async_counters_;
}
Counters* counters() const { return async_counters().get(); }
void PrepareRuntimeObjects(std::shared_ptr<const WasmModule>); void PrepareRuntimeObjects(std::shared_ptr<const WasmModule>);
void FinishCompile(bool compile_wrappers); void FinishCompile(bool compile_wrappers);
...@@ -136,7 +131,6 @@ class AsyncCompileJob { ...@@ -136,7 +131,6 @@ class AsyncCompileJob {
Isolate* isolate_; Isolate* isolate_;
const WasmFeatures enabled_features_; const WasmFeatures enabled_features_;
const std::shared_ptr<Counters> async_counters_;
// Copy of the module wire bytes, moved into the {native_module_} on its // Copy of the module wire bytes, moved into the {native_module_} on its
// creation. // creation.
std::unique_ptr<byte[]> bytes_copy_; std::unique_ptr<byte[]> bytes_copy_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment