summaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/wasm-module.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/wasm/wasm-module.h')
-rw-r--r--deps/v8/src/wasm/wasm-module.h47
1 files changed, 28 insertions, 19 deletions
diff --git a/deps/v8/src/wasm/wasm-module.h b/deps/v8/src/wasm/wasm-module.h
index 2ffc92e390..9c54f17b9c 100644
--- a/deps/v8/src/wasm/wasm-module.h
+++ b/deps/v8/src/wasm/wasm-module.h
@@ -266,6 +266,7 @@ struct V8_EXPORT_PRIVATE WasmModule {
uint32_t maximum_pages = 0; // maximum size of the memory in 64k pages
bool has_shared_memory = false; // true if memory is a SharedArrayBuffer
bool has_maximum_pages = false; // true if there is a maximum memory size
+ bool is_memory64 = false; // true if the memory is 64 bit
bool has_memory = false; // true if the memory was defined or imported
bool mem_export = false; // true if the memory is exported
int start_function_index = -1; // start function, >= 0 if any
@@ -283,9 +284,12 @@ struct V8_EXPORT_PRIVATE WasmModule {
uint32_t num_declared_data_segments = 0; // From the DataCount section.
WireBytesRef code = {0, 0};
WireBytesRef name = {0, 0};
- std::vector<TypeDefinition> types; // by type index
- std::vector<uint8_t> type_kinds; // by type index
- std::vector<uint32_t> signature_ids; // by signature index
+ std::vector<TypeDefinition> types; // by type index
+ std::vector<uint8_t> type_kinds; // by type index
+ // Map from each type index to the index of its corresponding canonical type.
+ // Note: right now, only functions are canonicalized, and arrays and structs
+ // map to themselves.
+ std::vector<uint32_t> canonicalized_type_ids;
bool has_type(uint32_t index) const { return index < types.size(); }
@@ -293,37 +297,43 @@ struct V8_EXPORT_PRIVATE WasmModule {
types.push_back(TypeDefinition(sig));
type_kinds.push_back(kWasmFunctionTypeCode);
uint32_t canonical_id = sig ? signature_map.FindOrInsert(*sig) : 0;
- signature_ids.push_back(canonical_id);
- }
- const FunctionSig* signature(uint32_t index) const {
- DCHECK(type_kinds[index] == kWasmFunctionTypeCode);
- return types[index].function_sig;
+ canonicalized_type_ids.push_back(canonical_id);
}
bool has_signature(uint32_t index) const {
return index < types.size() && type_kinds[index] == kWasmFunctionTypeCode;
}
+ const FunctionSig* signature(uint32_t index) const {
+ DCHECK(has_signature(index));
+ return types[index].function_sig;
+ }
+
void add_struct_type(const StructType* type) {
types.push_back(TypeDefinition(type));
type_kinds.push_back(kWasmStructTypeCode);
- }
- const StructType* struct_type(uint32_t index) const {
- DCHECK(type_kinds[index] == kWasmStructTypeCode);
- return types[index].struct_type;
+ // No canonicalization for structs.
+ canonicalized_type_ids.push_back(0);
}
bool has_struct(uint32_t index) const {
return index < types.size() && type_kinds[index] == kWasmStructTypeCode;
}
+ const StructType* struct_type(uint32_t index) const {
+ DCHECK(has_struct(index));
+ return types[index].struct_type;
+ }
+
void add_array_type(const ArrayType* type) {
types.push_back(TypeDefinition(type));
type_kinds.push_back(kWasmArrayTypeCode);
- }
- const ArrayType* array_type(uint32_t index) const {
- DCHECK(type_kinds[index] == kWasmArrayTypeCode);
- return types[index].array_type;
+ // No canonicalization for arrays.
+ canonicalized_type_ids.push_back(0);
}
bool has_array(uint32_t index) const {
return index < types.size() && type_kinds[index] == kWasmArrayTypeCode;
}
+ const ArrayType* array_type(uint32_t index) const {
+ DCHECK(has_array(index));
+ return types[index].array_type;
+ }
std::vector<WasmFunction> functions;
std::vector<WasmDataSegment> data_segments;
@@ -344,9 +354,8 @@ struct V8_EXPORT_PRIVATE WasmModule {
std::unique_ptr<AsmJsOffsetInformation> asm_js_offset_information;
explicit WasmModule(std::unique_ptr<Zone> signature_zone = nullptr);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WasmModule);
+ WasmModule(const WasmModule&) = delete;
+ WasmModule& operator=(const WasmModule&) = delete;
};
// Static representation of a wasm indirect call table.