Index: src/wasm/signature-map.cc |
diff --git a/src/wasm/signature-map.cc b/src/wasm/signature-map.cc |
index e7f8b2fc94d16d66caad53f8778f3e0e7836da24..e7ee4eba4e21361977a0f363990c219e441a2af5 100644 |
--- a/src/wasm/signature-map.cc |
+++ b/src/wasm/signature-map.cc |
@@ -8,7 +8,10 @@ namespace v8 { |
namespace internal { |
namespace wasm { |
+SignatureMap::SignatureMap() : mutex_(new base::Mutex()) {} |
+ |
uint32_t SignatureMap::FindOrInsert(FunctionSig* sig) { |
+ base::LockGuard<base::Mutex> guard(mutex_.get()); |
auto pos = map_.find(sig); |
if (pos != map_.end()) { |
return pos->second; |
@@ -20,6 +23,7 @@ uint32_t SignatureMap::FindOrInsert(FunctionSig* sig) { |
} |
int32_t SignatureMap::Find(FunctionSig* sig) const { |
+ base::LockGuard<base::Mutex> guard(mutex_.get()); |
auto pos = map_.find(sig); |
if (pos != map_.end()) { |
return static_cast<int32_t>(pos->second); |