summaryrefslogtreecommitdiff
path: root/chromium/v8/src/wasm/wasm-module.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/src/wasm/wasm-module.h
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/src/wasm/wasm-module.h')
-rw-r--r--chromium/v8/src/wasm/wasm-module.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/chromium/v8/src/wasm/wasm-module.h b/chromium/v8/src/wasm/wasm-module.h
index a189964ad73..f0f8db890b4 100644
--- a/chromium/v8/src/wasm/wasm-module.h
+++ b/chromium/v8/src/wasm/wasm-module.h
@@ -15,6 +15,7 @@
#include "src/wasm/struct-types.h"
#include "src/wasm/wasm-constants.h"
#include "src/wasm/wasm-opcodes.h"
+#include "src/zone/zone-containers.h"
namespace v8 {
@@ -117,7 +118,7 @@ struct WasmElemSegment {
// Construct an active segment.
WasmElemSegment(uint32_t table_index, WasmInitExpr offset)
- : type(kWasmFuncRef),
+ : type(ValueType::Ref(kHeapFunc, kNullable)),
table_index(table_index),
offset(offset),
status(kStatusActive) {}
@@ -125,7 +126,7 @@ struct WasmElemSegment {
// Construct a passive or declarative segment, which has no table index or
// offset.
explicit WasmElemSegment(bool declarative)
- : type(kWasmFuncRef),
+ : type(ValueType::Ref(kHeapFunc, kNullable)),
table_index(0),
status(declarative ? kStatusDeclarative : kStatusPassive) {}
@@ -206,7 +207,7 @@ class V8_EXPORT_PRIVATE LazilyGeneratedNames {
void AddForTesting(int function_index, WireBytesRef name);
private:
- // {function_names_}, {global_names_} and {memory_names_} are
+ // {function_names_}, {global_names_}, {memory_names_} and {table_names_} are
// populated lazily after decoding, and therefore need a mutex to protect
// concurrent modifications from multiple {WasmModuleObject}.
mutable base::Mutex mutex_;
@@ -218,6 +219,9 @@ class V8_EXPORT_PRIVATE LazilyGeneratedNames {
mutable std::unique_ptr<
std::unordered_map<uint32_t, std::pair<WireBytesRef, WireBytesRef>>>
memory_names_;
+ mutable std::unique_ptr<
+ std::unordered_map<uint32_t, std::pair<WireBytesRef, WireBytesRef>>>
+ table_names_;
};
class V8_EXPORT_PRIVATE AsmJsOffsetInformation {
@@ -327,6 +331,28 @@ struct V8_EXPORT_PRIVATE WasmModule {
bool has_array(uint32_t index) const {
return index < types.size() && type_kinds[index] == kWasmArrayTypeCode;
}
+ bool is_cached_subtype(uint32_t subtype, uint32_t supertype) const {
+ return subtyping_cache->count(std::make_pair(subtype, supertype)) == 1;
+ }
+ void cache_subtype(uint32_t subtype, uint32_t supertype) const {
+ subtyping_cache->emplace(subtype, supertype);
+ }
+ void uncache_subtype(uint32_t subtype, uint32_t supertype) const {
+ subtyping_cache->erase(std::make_pair(subtype, supertype));
+ }
+ bool is_cached_equivalent_type(uint32_t type1, uint32_t type2) const {
+ if (type1 > type2) std::swap(type1, type2);
+ return type_equivalence_cache->count(std::make_pair(type1, type2)) == 1;
+ }
+ void cache_type_equivalence(uint32_t type1, uint32_t type2) const {
+ if (type1 > type2) std::swap(type1, type2);
+ type_equivalence_cache->emplace(type1, type2);
+ }
+ void uncache_type_equivalence(uint32_t type1, uint32_t type2) const {
+ if (type1 > type2) std::swap(type1, type2);
+ type_equivalence_cache->erase(std::make_pair(type1, type2));
+ }
+
std::vector<WasmFunction> functions;
std::vector<WasmDataSegment> data_segments;
std::vector<WasmTable> tables;
@@ -347,6 +373,15 @@ struct V8_EXPORT_PRIVATE WasmModule {
explicit WasmModule(std::unique_ptr<Zone> signature_zone = nullptr);
+ private:
+ // Cache for discovered subtyping pairs.
+ std::unique_ptr<ZoneUnorderedSet<std::pair<uint32_t, uint32_t>>>
+ subtyping_cache;
+ // Cache for discovered equivalent type pairs.
+ // Indexes are stored in increasing order.
+ std::unique_ptr<ZoneUnorderedSet<std::pair<uint32_t, uint32_t>>>
+ type_equivalence_cache;
+
DISALLOW_COPY_AND_ASSIGN(WasmModule);
};