summaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/wasm-import-wrapper-cache.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-08-01 08:38:30 +0200
committerMichaël Zasso <targos@protonmail.com>2019-08-01 12:53:56 +0200
commit2dcc3665abf57c3607cebffdeeca062f5894885d (patch)
tree4f560748132edcfb4c22d6f967a7e80d23d7ea2c /deps/v8/src/wasm/wasm-import-wrapper-cache.cc
parent1ee47d550c6de132f06110aa13eceb7551d643b3 (diff)
downloadandroid-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.gz
android-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.bz2
android-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.zip
deps: update V8 to 7.6.303.28
PR-URL: https://github.com/nodejs/node/pull/28016 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/v8/src/wasm/wasm-import-wrapper-cache.cc')
-rw-r--r--deps/v8/src/wasm/wasm-import-wrapper-cache.cc41
1 files changed, 18 insertions, 23 deletions
diff --git a/deps/v8/src/wasm/wasm-import-wrapper-cache.cc b/deps/v8/src/wasm/wasm-import-wrapper-cache.cc
index caa9eb7904..b586d07ff4 100644
--- a/deps/v8/src/wasm/wasm-import-wrapper-cache.cc
+++ b/deps/v8/src/wasm/wasm-import-wrapper-cache.cc
@@ -6,39 +6,34 @@
#include <vector>
-#include "src/counters.h"
+#include "src/logging/counters.h"
#include "src/wasm/wasm-code-manager.h"
namespace v8 {
namespace internal {
namespace wasm {
+WasmCode*& WasmImportWrapperCache::ModificationScope::operator[](
+ const CacheKey& key) {
+ return cache_->entry_map_[key];
+}
+
+WasmCode* WasmImportWrapperCache::Get(compiler::WasmImportCallKind kind,
+ FunctionSig* sig) const {
+ auto it = entry_map_.find({kind, sig});
+ DCHECK(it != entry_map_.end());
+ return it->second;
+}
+
WasmImportWrapperCache::~WasmImportWrapperCache() {
std::vector<WasmCode*> ptrs;
ptrs.reserve(entry_map_.size());
- for (auto& e : entry_map_) ptrs.push_back(e.second);
- WasmCode::DecrementRefCount(VectorOf(ptrs));
-}
-
-WasmCode* WasmImportWrapperCache::GetOrCompile(
- WasmEngine* wasm_engine, Counters* counters,
- compiler::WasmImportCallKind kind, FunctionSig* sig) {
- base::MutexGuard lock(&mutex_);
- CacheKey key(static_cast<uint8_t>(kind), *sig);
- WasmCode*& cached = entry_map_[key];
- if (cached == nullptr) {
- // TODO(wasm): no need to hold the lock while compiling an import wrapper.
- bool source_positions = native_module_->module()->origin == kAsmJsOrigin;
- // Keep the {WasmCode} alive until we explicitly call {IncRef}.
- WasmCodeRefScope code_ref_scope;
- cached = compiler::CompileWasmImportCallWrapper(
- wasm_engine, native_module_, kind, sig, source_positions);
- cached->IncRef();
- counters->wasm_generated_code_size()->Increment(
- cached->instructions().length());
- counters->wasm_reloc_size()->Increment(cached->reloc_info().length());
+ for (auto& e : entry_map_) {
+ if (e.second) {
+ ptrs.push_back(e.second);
+ }
}
- return cached;
+ WasmCode::DecrementRefCount(VectorOf(ptrs));
}
} // namespace wasm