diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/src/wasm/wasm-module.cc | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-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.cc')
-rw-r--r-- | chromium/v8/src/wasm/wasm-module.cc | 78 |
1 files changed, 25 insertions, 53 deletions
diff --git a/chromium/v8/src/wasm/wasm-module.cc b/chromium/v8/src/wasm/wasm-module.cc index 5111a783728..405586107a2 100644 --- a/chromium/v8/src/wasm/wasm-module.cc +++ b/chromium/v8/src/wasm/wasm-module.cc @@ -50,8 +50,11 @@ LazilyGeneratedNames::LookupNameFromImportsAndExports( Vector<const WasmImport> import_table, Vector<const WasmExport> export_table) const { base::MutexGuard lock(&mutex_); - DCHECK(kind == kExternalGlobal || kind == kExternalMemory); - auto& names = kind == kExternalGlobal ? global_names_ : memory_names_; + DCHECK(kind == kExternalGlobal || kind == kExternalMemory || + kind == kExternalTable); + auto& names = kind == kExternalGlobal + ? global_names_ + : kind == kExternalMemory ? memory_names_ : table_names_; if (!names) { names.reset( new std::unordered_map<uint32_t, @@ -215,7 +218,16 @@ std::ostream& operator<<(std::ostream& os, const WasmFunctionName& name) { } WasmModule::WasmModule(std::unique_ptr<Zone> signature_zone) - : signature_zone(std::move(signature_zone)) {} + : signature_zone(std::move(signature_zone)), + subtyping_cache(this->signature_zone.get() == nullptr + ? nullptr + : new ZoneUnorderedSet<std::pair<uint32_t, uint32_t>>( + this->signature_zone.get())), + type_equivalence_cache( + this->signature_zone.get() == nullptr + ? nullptr + : new ZoneUnorderedSet<std::pair<uint32_t, uint32_t>>( + this->signature_zone.get())) {} bool IsWasmCodegenAllowed(Isolate* isolate, Handle<Context> context) { // TODO(wasm): Once wasm has its own CSP policy, we should introduce a @@ -239,50 +251,10 @@ namespace { // Converts the given {type} into a string representation that can be used in // reflective functions. Should be kept in sync with the {GetValueType} helper. Handle<String> ToValueTypeString(Isolate* isolate, ValueType type) { - // TODO(ahaas/jkummerow): This could be as simple as: - // return isolate->factory()->InternalizeUtf8String(type.type_name()); - // if we clean up all occurrences of "anyfunc" in favor of "funcref". - Factory* factory = isolate->factory(); - Handle<String> string; - switch (type.kind()) { - case i::wasm::ValueType::kI32: { - string = factory->InternalizeUtf8String("i32"); - break; - } - case i::wasm::ValueType::kI64: { - string = factory->InternalizeUtf8String("i64"); - break; - } - case i::wasm::ValueType::kF32: { - string = factory->InternalizeUtf8String("f32"); - break; - } - case i::wasm::ValueType::kF64: { - string = factory->InternalizeUtf8String("f64"); - break; - } - case i::wasm::ValueType::kAnyRef: { - string = factory->InternalizeUtf8String("anyref"); - break; - } - case i::wasm::ValueType::kFuncRef: { - string = factory->InternalizeUtf8String("anyfunc"); - break; - } - case i::wasm::ValueType::kNullRef: { - string = factory->InternalizeUtf8String("nullref"); - break; - } - case i::wasm::ValueType::kExnRef: { - string = factory->InternalizeUtf8String("exnref"); - break; - } - default: - UNREACHABLE(); - } - return string; + return isolate->factory()->InternalizeUtf8String( + type == kWasmFuncRef ? CStrVector("anyfunc") + : VectorOf(type.type_name())); } - } // namespace Handle<JSObject> GetTypeForFunction(Isolate* isolate, const FunctionSig* sig) { @@ -357,13 +329,14 @@ Handle<JSObject> GetTypeForTable(Isolate* isolate, ValueType type, Factory* factory = isolate->factory(); Handle<String> element; - if (type == kWasmFuncRef) { - // TODO(wasm): We should define the "anyfunc" string in one central place - // and then use that constant everywhere. + if (type.is_reference_to(kHeapFunc)) { + // TODO(wasm): We should define the "anyfunc" string in one central + // place and then use that constant everywhere. element = factory->InternalizeUtf8String("anyfunc"); } else { - DCHECK(WasmFeatures::FromFlags().has_anyref() && type == kWasmAnyRef); - element = factory->InternalizeUtf8String("anyref"); + DCHECK(WasmFeatures::FromFlags().has_reftypes() && + type.is_reference_to(kHeapExtern)); + element = factory->InternalizeUtf8String("externref"); } Handle<JSFunction> object_function = isolate->object_function(); @@ -458,9 +431,8 @@ Handle<JSArray> GetImports(Isolate* isolate, case kExternalException: import_kind = exception_string; break; - default: - UNREACHABLE(); } + DCHECK(!import_kind->is_null()); Handle<String> import_module = WasmModuleObject::ExtractUtf8StringFromModuleBytes( |