5 #ifndef V8_WASM_WASM_IMPORT_WRAPPER_CACHE_INL_H_ 6 #define V8_WASM_WASM_IMPORT_WRAPPER_CACHE_INL_H_ 8 #include "src/compiler/wasm-compiler.h" 9 #include "src/counters.h" 10 #include "src/handles-inl.h" 11 #include "src/objects/code-inl.h" 12 #include "src/wasm/value-type.h" 13 #include "src/wasm/wasm-code-manager.h" 22 WasmCode* GetOrCompile(
Isolate* isolate, compiler::WasmImportCallKind kind,
25 base::MutexGuard lock(&mutex_);
26 CacheKey key(static_cast<uint8_t>(kind), *sig);
28 if (cached ==
nullptr) {
31 bool source_positions = native_module_->module()->origin == kAsmJsOrigin;
32 cached = compiler::CompileWasmImportCallWrapper(
33 isolate, native_module_, kind, sig, source_positions);
34 auto counters = isolate->counters();
35 counters->wasm_generated_code_size()->Increment(
36 cached->instructions().length());
37 counters->wasm_reloc_size()->Increment(cached->reloc_info().length());
46 using CacheKey = std::pair<uint8_t, FunctionSig>;
47 std::unordered_map<CacheKey, WasmCode*, base::hash<CacheKey>> entry_map_;
50 : native_module_(native_module) {}
57 #endif // V8_WASM_WASM_IMPORT_WRAPPER_CACHE_INL_H_