Index: src/wasm/module-compiler.h |
diff --git a/src/wasm/module-compiler.h b/src/wasm/module-compiler.h |
index 4f496c50e956655bf4fb77d78c0d459e2b698bee..2d66cb15b120bb08dcfa9736b99b4bf2144d0a5c 100644 |
--- a/src/wasm/module-compiler.h |
+++ b/src/wasm/module-compiler.h |
@@ -59,8 +59,7 @@ class ModuleCompiler { |
Isolate* isolate_; |
std::unique_ptr<WasmModule> module_; |
- std::shared_ptr<Counters> counters_shared_; |
- Counters* counters_; |
+ const std::shared_ptr<Counters> counters_shared_; |
bool is_sync_; |
std::vector<std::unique_ptr<compiler::WasmCompilationUnit>> |
compilation_units_; |
@@ -71,6 +70,8 @@ class ModuleCompiler { |
// This flag should only be set while holding result_mutex_. |
bool finisher_is_running_ = false; |
+ Counters* counters() const { return counters_shared_.get(); } |
+ |
// Run by each compilation task and by the main thread. The |
// no_finisher_callback is called within the result_mutex_ lock when no |
// finishing task is running, i.e. when the finisher_is_running_ flag is not |
@@ -156,8 +157,7 @@ class InstanceBuilder { |
Isolate* isolate_; |
WasmModule* const module_; |
- std::shared_ptr<Counters> counters_shared_; |
- Counters* counters_; |
+ const std::shared_ptr<Counters> counters_shared_; |
ErrorThrower* thrower_; |
Handle<WasmModuleObject> module_object_; |
Handle<JSReceiver> ffi_; // TODO(titzer): Use MaybeHandle |
@@ -169,6 +169,8 @@ class InstanceBuilder { |
JSToWasmWrapperCache js_to_wasm_cache_; |
WeakCallbackInfo<void>::Callback instance_finalizer_callback_; |
+ Counters* counters() const { return counters_shared_.get(); } |
+ |
// Helper routines to print out errors with imports. |
#define ERROR_THROWER_WITH_MESSAGE(TYPE) \ |
void Report##TYPE(const char* error, uint32_t index, \ |
@@ -260,8 +262,7 @@ class AsyncCompileJob { |
private: |
Isolate* isolate_; |
- std::shared_ptr<Counters> counters_shared_; |
- Counters* counters_; |
+ const std::shared_ptr<Counters> counters_shared_; |
std::unique_ptr<byte[]> bytes_copy_; |
ModuleWireBytes wire_bytes_; |
Handle<Context> context_; |
@@ -280,6 +281,8 @@ class AsyncCompileJob { |
size_t outstanding_units_ = 0; |
size_t num_background_tasks_ = 0; |
+ Counters* counters() const { return counters_shared_.get(); } |
+ |
void ReopenHandlesInDeferredScope(); |
void AsyncCompileFailed(ErrorThrower& thrower); |